IOItem.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. public string DisplayName { get; set; }
  16. }
  17. public class IOItem<T> : IOItem
  18. {
  19. public static DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(T), typeof(IOItem<T>));
  20. public T Value
  21. {
  22. get
  23. {
  24. return (T)GetValue(ValueProperty);
  25. }
  26. set
  27. {
  28. SetValue(ValueProperty, value);
  29. }
  30. }
  31. }
  32. public class AOItem : IOItem<short>
  33. {
  34. public static readonly DependencyProperty NewValueProperty = DependencyProperty.Register("NewValue", typeof(short), typeof(AOItem), new PropertyMetadata((short)0));
  35. public short NewValue
  36. {
  37. get { return (short)GetValue(NewValueProperty); }
  38. set { SetValue(NewValueProperty, value); }
  39. }
  40. public static readonly DependencyProperty TextSavedProperty = DependencyProperty.Register("TextSaved", typeof(bool), typeof(AOItem), new PropertyMetadata(true));
  41. public bool TextSaved
  42. {
  43. get { return (bool)GetValue(TextSavedProperty); }
  44. set { SetValue(TextSavedProperty, value); }
  45. }
  46. }
  47. public class AOItemFloat : IOItem<float>
  48. {
  49. public static readonly DependencyProperty NewValueFloatProperty = DependencyProperty.Register("NewValueFloat", typeof(float), typeof(AOItem), new PropertyMetadata((float)0));
  50. public float NewValueFloat
  51. {
  52. get { return (float)GetValue(NewValueFloatProperty); }
  53. set { SetValue(NewValueFloatProperty, value); }
  54. }
  55. public static readonly DependencyProperty TextSavedFloatProperty = DependencyProperty.Register("TextSavedFloat", typeof(bool), typeof(AOItem), new PropertyMetadata(true));
  56. public bool TextSavedFloat
  57. {
  58. get { return (bool)GetValue(TextSavedFloatProperty); }
  59. set { SetValue(TextSavedFloatProperty, value); }
  60. }
  61. }
  62. }