using AIStudio.Wpf.Controls;
|
using System.Collections.ObjectModel;
|
using System.ComponentModel;
|
using System.Runtime.CompilerServices;
|
using System.Windows.Controls;
|
using WPFProject.Models;
|
|
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<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;
|
}
|
|
}
|
}
|