using PdmSwPlugin.Common.Entity.DrawAudit;
using PdmSwPlugin.UI;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Threading;
namespace PdmSwPlugin.Commmon.Control
{
///
/// MultiExWindow.xaml 的交互逻辑
///
public partial class RichHisWindow : Window, INotifyPropertyChanged
{
#region ...
public virtual event PropertyChangedEventHandler PropertyChanged;
public virtual void RaisePropertyChanged(string name)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
public void RaiseAndSetIfChanged(ref T old, T @new, [CallerMemberName] string propertyName = null)
{
old = @new;
if (propertyName != null)
{
RaisePropertyChanged(propertyName);
}
}
#endregion
public readonly static CustomRichBox box = new CustomRichBox();
private string _title;
public string title
{
get => _title;
set => RaiseAndSetIfChanged(ref _title, value);
}
private ObservableCollection _hisList;
public ObservableCollection HisList
{
get => _hisList;
set => RaiseAndSetIfChanged(ref _hisList, value);
}
public RichHisWindow(DependencyObject parent, string title, List hisList)
{
InitializeComponent();
this.title = title;
DataContext = this;
if (hisList == null)
{
this.HisList = new ObservableCollection();
}
else
{
this.HisList = new ObservableCollection(hisList);
table.ScrollIntoView(HisList[0]);
}
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Dispatcher.Invoke(() =>
{
// table.ItemsSource = new ObservableCollection(HisList);
});
}
}
}