SwitchValueDialog.xaml.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. using Aitex.Core.RT.Log;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Navigation;
  15. using System.Windows.Shapes;
  16. namespace MECF.Framework.UI.Core.Control
  17. {
  18. /// <summary>
  19. /// SwitchDialog.xaml 的交互逻辑
  20. /// </summary>
  21. public partial class SwitchValueDialog : Window
  22. {
  23. public Action<bool> CommandDelegate;
  24. public bool IsOpen { get; set; }
  25. public bool IsOpenChecked { get; set; }
  26. public bool IsCloseChecked { get; set; }
  27. public bool IsSave { get; set; }
  28. private string _deviceName;
  29. public string DeviceName
  30. {
  31. get
  32. {
  33. return _deviceName;
  34. }
  35. set
  36. {
  37. _deviceName = value;
  38. this.TxtDeviceName.Text = value;
  39. }
  40. }
  41. public SwitchValueDialog()
  42. {
  43. InitializeComponent();
  44. }
  45. protected override void OnSourceInitialized(EventArgs e)
  46. {
  47. base.OnSourceInitialized(e);
  48. opencheck.IsChecked = IsOpen;
  49. closecheck.IsChecked = !IsOpen;
  50. }
  51. private void RadioButton_Click(object sender, RoutedEventArgs e)
  52. {
  53. try
  54. {
  55. IsOpen = true;
  56. }
  57. catch (Exception ex)
  58. {
  59. LOG.Error(ex.Message);
  60. }
  61. }
  62. private void RadioButton_Click_1(object sender, RoutedEventArgs e)
  63. {
  64. try
  65. {
  66. IsOpen = false;
  67. }
  68. catch (Exception ex)
  69. {
  70. LOG.Error(ex.Message);
  71. }
  72. }
  73. private void Button_Click(object sender, RoutedEventArgs e)
  74. {
  75. IsSave = false;
  76. Close();
  77. }
  78. private void Button_Click_1(object sender, RoutedEventArgs e)
  79. {
  80. IsSave = true;
  81. Close();
  82. }
  83. }
  84. }