alielie
2026-03-02 12e606635c42ea20f4b7c2bdda5204237a4b4c96
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
72
73
74
75
76
77
78
79
80
81
82
83
84
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows.Controls;
 
namespace Plugin.JarUI
{
    /// <summary>
    /// JarCell.xaml 的交互逻辑
    /// </summary>
    public partial class JarCell : 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 JarCell(int index)
        {
            DataContext = this;
            Index = index;
            Name = $"Socket_{index + 1}";
            SnText = $"SN{index + 1}";
            InitializeComponent();
        }
 
        #region Properties
        public int Index { get; private set; }
        public string Name { get; private set; }
 
        private string _status = "Ready";
 
        public string Status
        {
            get { return _status; }
            set { Set(ref _status, value); }
        }
 
        private string _info = "";
 
        public string Info
        {
            get { return _info; }
            set { Set(ref _info, value); }
        }
 
        private string _snText;
 
        public string SnText
        {
            get { return _snText; }
            set { Set(ref _snText, value); }
        }
        #endregion
 
        public void SetStatus(string status)
        {
            Status = status;
        }
 
        public void SetInfo(string info)
        {
            Info = info;
        }
 
        public void SetSn(string sn)
        {
            TbSn.Text = sn;
        }
    }
}