|
1 |
| -using Windows.ApplicationModel.DataTransfer; |
2 |
| -using CommunityToolkit.Mvvm.Input; |
3 |
| -using Microsoft.UI.Xaml; |
4 |
| -using Microsoft.UI.Xaml.Controls; |
5 |
| -using Microsoft.UI.Xaml.Controls.Primitives; |
6 |
| - |
7 |
| -namespace Coder.Desktop.App.ViewModels; |
8 |
| - |
9 |
| -public enum AgentConnectionStatus |
10 |
| -{ |
11 |
| - Green, |
12 |
| - Red, |
13 |
| - Yellow, |
14 |
| - Gray, |
15 |
| -} |
16 |
| - |
17 |
| -public partial class AgentViewModel |
18 |
| -{ |
19 |
| - public required string Hostname { get; set; } |
20 |
| - |
21 |
| - public required string HostnameSuffix { get; set; } // including leading dot |
22 |
| - |
23 |
| - public required AgentConnectionStatus ConnectionStatus { get; set; } |
24 |
| - |
25 |
| - public string FullHostname => Hostname + HostnameSuffix; |
26 |
| - |
27 |
| - public required string DashboardUrl { get; set; } |
28 |
| - |
29 |
| - [RelayCommand] |
30 |
| - private void CopyHostname(object parameter) |
31 |
| - { |
32 |
| - var dataPackage = new DataPackage |
33 |
| - { |
34 |
| - RequestedOperation = DataPackageOperation.Copy, |
35 |
| - }; |
36 |
| - dataPackage.SetText(FullHostname); |
37 |
| - Clipboard.SetContent(dataPackage); |
38 |
| - |
39 |
| - if (parameter is not FrameworkElement frameworkElement) return; |
40 |
| - |
41 |
| - var flyout = new Flyout |
42 |
| - { |
43 |
| - Content = new TextBlock |
44 |
| - { |
45 |
| - Text = "DNS Copied", |
46 |
| - Margin = new Thickness(4), |
47 |
| - }, |
48 |
| - }; |
49 |
| - FlyoutBase.SetAttachedFlyout(frameworkElement, flyout); |
50 |
| - FlyoutBase.ShowAttachedFlyout(frameworkElement); |
51 |
| - } |
52 |
| -} |
| 1 | +using Windows.ApplicationModel.DataTransfer; |
| 2 | +using CommunityToolkit.Mvvm.Input; |
| 3 | +using Microsoft.UI.Xaml; |
| 4 | +using Microsoft.UI.Xaml.Controls; |
| 5 | +using Microsoft.UI.Xaml.Controls.Primitives; |
| 6 | + |
| 7 | +namespace Coder.Desktop.App.ViewModels; |
| 8 | + |
| 9 | +public enum AgentConnectionStatus |
| 10 | +{ |
| 11 | + Green, |
| 12 | + Red, |
| 13 | + Gray, |
| 14 | +} |
| 15 | + |
| 16 | +public partial class AgentViewModel |
| 17 | +{ |
| 18 | + public required string Hostname { get; set; } |
| 19 | + |
| 20 | + public required string HostnameSuffix { get; set; } // including leading dot |
| 21 | + |
| 22 | + public required AgentConnectionStatus ConnectionStatus { get; set; } |
| 23 | + |
| 24 | + public string FullHostname => Hostname + HostnameSuffix; |
| 25 | + |
| 26 | + public required string DashboardUrl { get; set; } |
| 27 | + |
| 28 | + [RelayCommand] |
| 29 | + private void CopyHostname(object parameter) |
| 30 | + { |
| 31 | + var dataPackage = new DataPackage |
| 32 | + { |
| 33 | + RequestedOperation = DataPackageOperation.Copy, |
| 34 | + }; |
| 35 | + dataPackage.SetText(FullHostname); |
| 36 | + Clipboard.SetContent(dataPackage); |
| 37 | + |
| 38 | + if (parameter is not FrameworkElement frameworkElement) return; |
| 39 | + |
| 40 | + var flyout = new Flyout |
| 41 | + { |
| 42 | + Content = new TextBlock |
| 43 | + { |
| 44 | + Text = "DNS Copied", |
| 45 | + Margin = new Thickness(4), |
| 46 | + }, |
| 47 | + }; |
| 48 | + FlyoutBase.SetAttachedFlyout(frameworkElement, flyout); |
| 49 | + FlyoutBase.ShowAttachedFlyout(frameworkElement); |
| 50 | + } |
| 51 | +} |
0 commit comments