|
1 |
| -using System; |
2 |
| -using Windows.UI; |
3 |
| -using Coder.Desktop.App.ViewModels; |
4 |
| -using Microsoft.UI.Xaml.Data; |
5 |
| -using Microsoft.UI.Xaml.Media; |
6 |
| - |
7 |
| -namespace Coder.Desktop.App.Converters; |
8 |
| - |
9 |
| -public class AgentStatusToColorConverter : IValueConverter |
10 |
| -{ |
11 |
| - private static readonly SolidColorBrush Green = new(Color.FromArgb(255, 52, 199, 89)); |
12 |
| - private static readonly SolidColorBrush Red = new(Color.FromArgb(255, 255, 59, 48)); |
13 |
| - private static readonly SolidColorBrush Gray = new(Color.FromArgb(255, 142, 142, 147)); |
14 |
| - |
15 |
| - public object Convert(object value, Type targetType, object parameter, string language) |
16 |
| - { |
17 |
| - if (value is not AgentConnectionStatus status) return Gray; |
18 |
| - |
19 |
| - return status switch |
20 |
| - { |
21 |
| - AgentConnectionStatus.Green => Green, |
22 |
| - AgentConnectionStatus.Red => Red, |
23 |
| - _ => Gray, |
24 |
| - }; |
25 |
| - } |
26 |
| - |
27 |
| - public object ConvertBack(object value, Type targetType, object parameter, string language) |
28 |
| - { |
29 |
| - throw new NotImplementedException(); |
30 |
| - } |
31 |
| -} |
| 1 | +using System; |
| 2 | +using Windows.UI; |
| 3 | +using Coder.Desktop.App.ViewModels; |
| 4 | +using Microsoft.UI.Xaml.Data; |
| 5 | +using Microsoft.UI.Xaml.Media; |
| 6 | + |
| 7 | +namespace Coder.Desktop.App.Converters; |
| 8 | + |
| 9 | +public class AgentStatusToColorConverter : IValueConverter |
| 10 | +{ |
| 11 | + private static readonly SolidColorBrush Green = new(Color.FromArgb(255, 52, 199, 89)); |
| 12 | + private static readonly SolidColorBrush Red = new(Color.FromArgb(255, 255, 59, 48)); |
| 13 | + private static readonly SolidColorBrush Gray = new(Color.FromArgb(255, 142, 142, 147)); |
| 14 | + private static readonly SolidColorBrush Yellow = new(Color.FromArgb(255, 204, 1, 0)); |
| 15 | + |
| 16 | + public object Convert(object value, Type targetType, object parameter, string language) |
| 17 | + { |
| 18 | + if (value is not AgentConnectionStatus status) return Gray; |
| 19 | + |
| 20 | + return status switch |
| 21 | + { |
| 22 | + AgentConnectionStatus.Green => Green, |
| 23 | + AgentConnectionStatus.Red => Red, |
| 24 | + AgentConnectionStatus.Yellow => Yellow, |
| 25 | + _ => Gray, |
| 26 | + }; |
| 27 | + } |
| 28 | + |
| 29 | + public object ConvertBack(object value, Type targetType, object parameter, string language) |
| 30 | + { |
| 31 | + throw new NotImplementedException(); |
| 32 | + } |
| 33 | +} |
0 commit comments