123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- namespace OINA.Extender.WPF.Testharness
- {
- using System.Collections.Specialized;
- using System.Linq;
- using System.Windows;
- /// <summary>
- /// Interaction logic for AutoIdSettings.xaml
- /// </summary>
- public partial class AutoIdSettings : Window
- {
- /// <summary>
- /// Auto ID Settings form constructor
- /// </summary>
- public AutoIdSettings()
- {
- this.InitializeComponent();
- this.periodicTableAutoID.IncludeElements(OIHelper.AutoIdSettings.KnownElements.ToArray<int>());
- this.periodicTableAutoID.ExcludeElements(OIHelper.AutoIdSettings.ExcludedElements.ToArray<int>());
- this.periodicTableAutoID.EnableElements(false, OIHelper.AutoIdSettings.DisabledElements.ToArray<int>());
- ((INotifyCollectionChanged)this.periodicTableAutoID.ExcludedElements).CollectionChanged += this.PeriodicTableExcludedElements_CollectionChanged;
- ((INotifyCollectionChanged)this.periodicTableAutoID.IncludedElements).CollectionChanged += this.PeriodicTableIncludedElements_CollectionChanged;
- }
- /// <summary>
- /// PeriodicTableIncludedElements Collection Changed Event Handler
- /// </summary>
- /// <param name="sender">sender</param>
- /// <param name="e">EventArgs</param>
- private void PeriodicTableIncludedElements_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
- {
- switch (e.Action)
- {
- case NotifyCollectionChangedAction.Add:
- foreach (int element in e.NewItems.Cast<int>())
- {
- OIHelper.AutoIdSettings.SetKnownElement(element, true);
- }
- break;
- case NotifyCollectionChangedAction.Remove:
- foreach (int element in e.OldItems.Cast<int>())
- {
- OIHelper.AutoIdSettings.SetKnownElement(element, false);
- }
- break;
- default:
- break;
- }
- }
- /// <summary>
- /// PeriodicTableExcludedElements Collection Changed Event Handler
- /// </summary>
- /// <param name="sender">sender</param>
- /// <param name="e">EventArgs</param>
- private void PeriodicTableExcludedElements_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
- {
- switch (e.Action)
- {
- case NotifyCollectionChangedAction.Add:
- foreach (int elements in e.NewItems.Cast<int>())
- {
- OIHelper.AutoIdSettings.SetExcludedElement(elements, true);
- }
- break;
- case NotifyCollectionChangedAction.Remove:
- foreach (int elements in e.OldItems.Cast<int>())
- {
- OIHelper.AutoIdSettings.SetExcludedElement(elements, false);
- }
- break;
- default:
- break;
- }
- }
- }
- }
|