15
15
using Microsoft . UI . Xaml ;
16
16
using Microsoft . UI . Xaml . Controls ;
17
17
using Microsoft . UI . Xaml . Controls . Primitives ;
18
+ using Microsoft . UI . Xaml . Documents ;
18
19
using Microsoft . UI . Xaml . Media ;
19
20
using WinRT . Interop ;
20
21
using WindowActivatedEventArgs = Microsoft . UI . Xaml . WindowActivatedEventArgs ;
@@ -30,8 +31,8 @@ public enum AgentStatus
30
31
31
32
public partial class Agent
32
33
{
33
- public string Hostname { get ; set ; } // without suffix
34
- public string Suffix { get ; set ; }
34
+ public required string Hostname { get ; set ; } // without suffix
35
+ public required string Suffix { get ; set ; }
35
36
public AgentStatus Status { get ; set ; }
36
37
37
38
public Brush StatusColor => Status switch
@@ -82,6 +83,26 @@ private void AgentHostnameCopyButton_Click(object parameter)
82
83
FlyoutBase . SetAttachedFlyout ( frameworkElement , flyout ) ;
83
84
FlyoutBase . ShowAttachedFlyout ( frameworkElement ) ;
84
85
}
86
+
87
+ public void AgentHostnameText_OnLoaded ( object sender , RoutedEventArgs e )
88
+ {
89
+ if ( sender is not TextBlock textBlock ) return ;
90
+ textBlock . Inlines . Clear ( ) ;
91
+ textBlock . Inlines . Add ( new Run
92
+ {
93
+ Text = Hostname ,
94
+ Foreground =
95
+ ( SolidColorBrush ) Application . Current . Resources . ThemeDictionaries [
96
+ "DefaultTextForegroundThemeBrush" ] ,
97
+ } ) ;
98
+ textBlock . Inlines . Add ( new Run
99
+ {
100
+ Text = Suffix ,
101
+ Foreground =
102
+ ( SolidColorBrush ) Application . Current . Resources . ThemeDictionaries [
103
+ "SystemControlForegroundBaseMediumBrush" ] ,
104
+ } ) ;
105
+ }
85
106
}
86
107
87
108
public sealed partial class TrayWindow : Window
0 commit comments