SimulatorIo1View.xaml.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using System;
  2. using System.Collections.ObjectModel;
  3. using System.Windows;
  4. using System.Windows.Controls;
  5. using System.Windows.Controls.Primitives;
  6. using System.Windows.Data;
  7. using Aitex.Common.Util;
  8. using Aitex.Core.UI.MVVM;
  9. using MECF.Framework.Common.IOCore;
  10. using EfemDualSimulator.Instances;
  11. namespace EfemDualSimulator.Views
  12. {
  13. /// <summary>
  14. /// IoView.xaml 的交互逻辑
  15. /// </summary>
  16. public partial class SimulatorIo1View : UserControl
  17. {
  18. public SimulatorIo1View()
  19. {
  20. InitializeComponent();
  21. DataContext = new IoViewModel(6731, "PMA.PLC", PathManager.GetCfgDir() + "_ioDefineVirgo.xml", "PMA");
  22. this.IsVisibleChanged += IOView_IsVisibleChanged;
  23. }
  24. private void IOView_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
  25. {
  26. if (this.DataContext == null)
  27. {
  28. }
  29. (DataContext as TimerViewModelBase).EnableTimer(IsVisible);
  30. }
  31. }
  32. //public class IoButton : ToggleButton
  33. //{
  34. // public static readonly DependencyProperty ONProperty;
  35. // static IoButton()
  36. // {
  37. // ONProperty = DependencyProperty.Register("ON", typeof(bool), typeof(IoButton));
  38. // }
  39. // public bool ON
  40. // {
  41. // get { return (bool)GetValue(ONProperty); }
  42. // set { SetValue(ONProperty, value); }
  43. // }
  44. //}
  45. //public class BoolBackgroundConverter : IValueConverter
  46. //{
  47. // public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  48. // {
  49. // bool? ret = (bool?)value;
  50. // return ret.HasValue && ret.Value ? "LightBlue" : "Transparent";
  51. // }
  52. // public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  53. // {
  54. // return null;
  55. // }
  56. //}
  57. }