1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- namespace OINA.Extender.Testharness
- {
- using System.Collections.Specialized;
- using System.Linq;
- using System.Windows.Forms;
- using OINA.Extender.Controls;
- /// <summary>
- /// Auto Id Settings form
- /// </summary>
- public partial class AutoIdSettings : Form
- {
- /// <summary>
- /// Periodic table for Auto ID setting
- /// </summary>
- private PeriodicTableControl periodicTableAutoId = null;
- /// <summary>
- /// Auto ID Settings form constructor
- /// </summary>
- public AutoIdSettings()
- {
- this.InitializeComponent();
- this.periodicTableAutoId = new PeriodicTableControl();
- this.ehPeriodicTableAutoId.Child = this.periodicTableAutoId;
- 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;
- }
- }
- }
- }
|