1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
| using CommunityToolkit.Mvvm.ComponentModel;
| using System.Globalization;
| using System.Windows;
| using System.Windows.Controls;
| using System.Windows.Data;
|
| namespace Plugin.BurnIn
| {
| public enum CellStatus
| {
| Testing = 0,
| OK = 1,
| NG = 2,
| Closed = 99,
| Open = 100,
| Waiting = 101
| }
|
| public class CellStatusConverter : IValueConverter
| {
| public static CellStatusConverter Instance = new CellStatusConverter();
|
| public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
| {
| if (value is bool b)
| {
| return b ? CellStatus.Open : CellStatus.Closed;
| }
| return CellStatus.Closed;
| }
|
| public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
| {
| return null;
| }
| }
|
| /// <summary>
| /// ManualCell.xaml 的交互逻辑
| /// </summary>
| [ObservableObject]
| public partial class StatusCell : UserControl
| {
| [ObservableProperty]
| private string title;
|
| public static readonly DependencyProperty StatusProperty = DependencyProperty.Register(
| "Status",
| typeof(CellStatus),
| typeof(StatusCell),
| new PropertyMetadata(CellStatus.Closed));
|
| public CellStatus Status
| {
| get => (CellStatus)GetValue(StatusProperty);
| set
| {
| SetValue(StatusProperty, value);
| }
| }
|
| [ObservableProperty]
| private int index;
|
| public StatusCell()
| {
| this.DataContext = this;
| InitializeComponent();
| }
| }
| }
|
|