using OS.Spin.Common;
using OS.Spin.ViewModle.Flaw;
using System;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Controls;
namespace OS.Spin.View.MainWindowControls
{
///
/// UCFlawListOnTime.xaml 的交互逻辑
///
public partial class UCFlawListOnTime : UserControl
{
public static readonly DependencyProperty AllIconsProperty =
DependencyProperty.Register("AllIcons", typeof(ObservableCollection), typeof(UCFlawListOnTime), new PropertyMetadata(default(ObservableCollection)));
private ObservableCollection Tmps = new ObservableCollection();
private ObservableCollection AllIcons
{
get { return (ObservableCollection)GetValue(AllIconsProperty); }
set { SetValue(AllIconsProperty, value); }
}
public UCFlawListOnTime()
{
InitializeComponent();
AllIcons = Tmps;
}
public void Zero()
{
AllIcons.Clear();
}
public void AddFlaw(MFlaw flaw)
{
try
{
flaw.Id = (AllIcons.Count + 1).ToString();
AllIcons.Add(flaw);
Flaws.ScrollIntoView(Flaws.Items[Flaws.Items.Count - 1]);
}
catch (Exception ex)
{
LogisTrac.WriteLog(string.Format("AddFlaw:{0}", ex.Message));
}
}
}
}