终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

68 lines
2.0 KiB

  1. using BPASmart.Model;
  2. using BPASmart.VariableManager.ViewModels;
  3. using BPASmartClient.Helper;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Diagnostics;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows;
  11. using System.Windows.Controls;
  12. using System.Windows.Data;
  13. using System.Windows.Documents;
  14. using System.Windows.Input;
  15. using System.Windows.Media;
  16. using System.Windows.Media.Imaging;
  17. using System.Windows.Navigation;
  18. using System.Windows.Shapes;
  19. namespace BPASmart.VariableManager.Views
  20. {
  21. /// <summary>
  22. /// VariableConfig.xaml 的交互逻辑
  23. /// </summary>
  24. public partial class VariableConfig : UserControl
  25. {
  26. public VariableConfig()
  27. {
  28. InitializeComponent();
  29. this.IsVisibleChanged += VariableConfig_IsVisibleChanged;
  30. this.Unloaded += VariableConfig_Unloaded;
  31. }
  32. private void VariableConfig_Unloaded(object sender, RoutedEventArgs e)
  33. {
  34. Json<CommunicationPar>.Save();
  35. }
  36. private void VariableConfig_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
  37. {
  38. var obj = (VariableConfig)sender;
  39. if (!obj.IsVisible)
  40. {
  41. DelegationNotifi.GetInstance.VariableSave?.Invoke();
  42. DelegationNotifi.GetInstance.VariableSave = null;
  43. DelegationNotifi.GetInstance.VarNameChanged = null;
  44. }
  45. else
  46. {
  47. this.DataContext = new VariableConfigViewModel(this.Name);
  48. }
  49. }
  50. private void TabGrid_SizeChanged(object sender, SizeChangedEventArgs e)
  51. {
  52. var res = TabGrid.ColumnDefinitions;
  53. if (res != null && res.Count >= 3)
  54. {
  55. object[] widths = new object[] { 0, 0 };
  56. widths[0] = res.ElementAt(1).ActualWidth;
  57. widths[1] = res.ElementAt(2).ActualWidth;
  58. ActionManage.GetInstance.Send("TabGridSizeChanged", widths);
  59. }
  60. }
  61. }
  62. }