IOItem.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. namespace OpenSEMI.ClientBase.IO
  8. {
  9. public class IOItem : DependencyObject
  10. {
  11. public int Index { get; set; }
  12. public string Name { get; set; }
  13. public string Address { get; set; }
  14. public string Key { get; set; }
  15. }
  16. public class IOItem<T> : IOItem
  17. {
  18. public static DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(T), typeof(IOItem<T>));
  19. public T Value
  20. {
  21. get
  22. {
  23. return (T)GetValue(ValueProperty);
  24. }
  25. set
  26. {
  27. SetValue(ValueProperty, value);
  28. }
  29. }
  30. }
  31. public class AOItem : IOItem<short>
  32. {
  33. public static readonly DependencyProperty NewValueProperty = DependencyProperty.Register("NewValue", typeof(short), typeof(AOItem), new PropertyMetadata((short)0));
  34. public short NewValue
  35. {
  36. get { return (short)GetValue(NewValueProperty); }
  37. set { SetValue(NewValueProperty, value); }
  38. }
  39. public static readonly DependencyProperty TextSavedProperty = DependencyProperty.Register("TextSaved", typeof(bool), typeof(AOItem), new PropertyMetadata(true));
  40. public bool TextSaved
  41. {
  42. get { return (bool)GetValue(TextSavedProperty); }
  43. set { SetValue(TextSavedProperty, value); }
  44. }
  45. }
  46. }