alielie
2025-03-13 ba6207f52db76ab47cd6534de0cf1712674ff179
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
85
86
87
88
89
90
91
92
93
94
95
96
97
using AIStudio.Wpf.Controls;
using GongSolutions.Wpf.DragDrop;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows.Controls;
using WPFProject.Models;
using WPFProject.Utils;
 
namespace WPFProject.UI.Test
{
 
 
    /// <summary>
    /// SequnceList.xaml 的交互逻辑
    /// </summary>
    public partial class SequnceList : UserControl, INotifyPropertyChanged
    {
        public virtual event PropertyChangedEventHandler PropertyChanged;
 
        protected virtual void RaisePropertyChanged(string name)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
        }
 
        protected void RaiseAndSetIfChanged<T>(ref T old, T @new, [CallerMemberName] string propertyName = null)
        {
            old = @new;
            if (propertyName != null)
            {
                RaisePropertyChanged(propertyName);
            }
        }
        public SequnceList()
        {
            DataContext = this;
 
            Sequences = new ObservableCollection<Sequence>
            {
                new Sequence{ Name="SSSSS"},
                new Sequence{ Name="SSSSS2"},
            };
 
            Steps = Sequences[0].Steps;
 
            InitializeComponent();
        }
        private ObservableCollection<Program> _ps = new ObservableCollection<Program>();
        public ObservableCollection<Program> Ps
        {
            get => _ps;
            set => RaiseAndSetIfChanged(ref _ps, value);
        }
 
 
        private ObservableCollection<Sequence> _Sequences;
        public ObservableCollection<Sequence> Sequences
        {
            get => _Sequences;
            set
            {
                if (value != null && value.Count > 0)
                {
                    Steps = value[0].Steps;
                }
                else {
                    Steps = null;
                }
                RaiseAndSetIfChanged(ref _Sequences, value);
            }
        }
 
        private ObservableCollection<Step> _Steps;
        public ObservableCollection<Step> Steps
        {
            get => _Steps;
            set => RaiseAndSetIfChanged(ref _Steps, value);
        }
 
 
        public void Selected_Program_Changed(object sender, Program program)
        {
            this.Sequences = program.Sequences;
        }
 
        private void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count > 0)
            {
                Steps = (e.AddedItems[0] as Sequence).Steps;
            }
        }
 
        public IDropTarget dropHandler { get; set; } = new DdDropHandler();
 
    }
}