| | |
| | | using CommunityToolkit.Mvvm.ComponentModel; |
| | | using System.ComponentModel; |
| | | using System.Runtime.CompilerServices; |
| | | using System.Windows; |
| | | using System.Windows.Controls; |
| | | |
| | | namespace Util.SB |
| | | namespace Util.ManualDebug |
| | | { |
| | | // 状态枚举 |
| | | public enum DebugStatus |
| | |
| | | /// <summary> |
| | | /// StatusBtn.xaml 的交互逻辑 |
| | | /// </summary> |
| | | [ObservableObject] |
| | | public partial class StatusBtn : UserControl |
| | | public partial class StatusBtn : UserControl, INotifyPropertyChanged |
| | | { |
| | | #region ... |
| | | public event PropertyChangedEventHandler PropertyChanged; |
| | | |
| | | protected void Set([CallerMemberName] string name = null) |
| | | { |
| | | |
| | | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); |
| | | } |
| | | |
| | | protected void Set<T>(ref T old, T @new, [CallerMemberName] string propertyName = null) |
| | | { |
| | | old = @new; |
| | | if (propertyName != null) |
| | | { |
| | | Set(propertyName); |
| | | } |
| | | } |
| | | #endregion |
| | | public event RoutedEventHandler BtnClick; |
| | | |
| | | public StatusBtn() |
| | |
| | | InitializeComponent(); |
| | | } |
| | | |
| | | [ObservableProperty] |
| | | private string title = string.Empty; |
| | | public string Title |
| | | { |
| | | get => title; |
| | | set |
| | | { |
| | | Set(ref title, value); |
| | | } |
| | | } |
| | | |
| | | [ObservableProperty] |
| | | private DebugStatus status = DebugStatus.Idle; |
| | | public DebugStatus Status |
| | | { |
| | | get => status; |
| | | set |
| | | { |
| | | Set(ref status, value); |
| | | } |
| | | } |
| | | |
| | | private void Button_Click(object sender, RoutedEventArgs e) |
| | | { |