alielie
2025-03-03 ee9b94104cbb5597c6033d46ec356771d383b21b
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
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows;
 
namespace Plugin.TestResult_WPF
{
    /// <summary>
    /// ChartWindow.xaml 的交互逻辑
    /// </summary>
    public partial class ChartWindow : Window, INotifyPropertyChanged
    {
        #region ...
        public event PropertyChangedEventHandler PropertyChanged;
 
        public virtual void RaisePropertyChanged(string name)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
        }
 
        public void RaiseAndSetIfchanged<T>(ref T old, T @new, [CallerMemberName] string propertyName = null)
        {
            old = @new;
            if (propertyName != null) RaisePropertyChanged(propertyName);
        }
        #endregion
        private string _title;
        public string title
        {
            get => _title;
            set => RaiseAndSetIfchanged(ref _title, value);
        }
 
        public ChartWindow(string title)
        {
            this.title = $"{title}详细曲线";
            this.DataContext = this;
            InitializeComponent();
        }
 
        private void Window_Unloaded(object sender, RoutedEventArgs e)
        {
            this.mainGrid.Children.Clear();
        }
    }
}