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
| using CommunityToolkit.Mvvm.ComponentModel;
| using System.Windows;
| using System.Windows.Controls;
|
| namespace Util.SB
| {
| // 状态枚举
| public enum DebugStatus
| {
| Idle = 0, // 空闲
| Testing = 1, // 测试中
| OK = 2, // 通过
| NG = 3 // 失败
| }
| /// <summary>
| /// StatusBtn.xaml 的交互逻辑
| /// </summary>
| [ObservableObject]
| public partial class StatusBtn : UserControl
| {
| public event RoutedEventHandler BtnClick;
|
| public StatusBtn()
| {
| DataContext = this;
| InitializeComponent();
| }
|
| [ObservableProperty]
| private string title = string.Empty;
|
| [ObservableProperty]
| private DebugStatus status = DebugStatus.Idle;
|
| private void Button_Click(object sender, RoutedEventArgs e)
| {
| BtnClick?.Invoke(this, e);
| }
| }
| }
|
|