终端一体化运控平台
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 

114 righe
3.9 KiB

  1. using BPASmartClient.Helper;
  2. using FryPot_DosingSystem.Model;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. using System.Windows.Controls;
  10. using System.Windows.Data;
  11. using System.Windows.Documents;
  12. using System.Windows.Input;
  13. using System.Windows.Media;
  14. using System.Windows.Media.Imaging;
  15. using System.Windows.Shapes;
  16. namespace FryPot_DosingSystem.View
  17. {
  18. /// <summary>
  19. /// FlowProcessView.xaml 的交互逻辑
  20. /// </summary>
  21. public partial class FlowProcessView : Window
  22. {
  23. public FlowProcessView()
  24. {
  25. InitializeComponent();
  26. this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); };
  27. ActionManage.GetInstance.CancelRegister("CloseFlowProcessView");
  28. ActionManage.GetInstance.Register(new Action(() =>
  29. {
  30. this.Close();
  31. }), "CloseFlowProcessView");
  32. }
  33. private void Label_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  34. {
  35. Label txt = sender as Label;
  36. if (txt != null)
  37. {
  38. StackPanel oldSp = FindFirstVisualChild(itemcontrols, "stk");
  39. if (oldSp != null)
  40. oldSp.Background = new SolidColorBrush(Color.FromRgb(38, 76, 115));
  41. StackPanel sp = VisualTreeHelper.GetParent(txt) as StackPanel;
  42. sp.Background = new SolidColorBrush(Color.FromRgb(8, 20, 36));
  43. ActionManage.GetInstance.Send("CurrentItemId", txt.Content);
  44. }
  45. }
  46. public StackPanel FindFirstVisualChild(DependencyObject obj, string childName)
  47. {
  48. for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++)
  49. {
  50. DependencyObject child = VisualTreeHelper.GetChild(obj, i);
  51. if (child != null && child is StackPanel && child.GetValue(NameProperty).ToString() == childName)
  52. {
  53. if (child is StackPanel stack && stack.Background?.ToString() == "#FF081424")
  54. return stack;
  55. }
  56. else
  57. {
  58. StackPanel SP = FindFirstVisualChild(child, childName);
  59. if (SP != null)
  60. {
  61. return SP;
  62. }
  63. }
  64. }
  65. return null;
  66. }
  67. //private void ComboBox_KeyUp(object sender, KeyEventArgs e)
  68. //{
  69. // var res = sender as ComboBox;
  70. // Json<FlowProcessNames>.Read();
  71. // if (res.Text != null && res.Text != String.Empty)
  72. // {
  73. // var datas = Json<FlowProcessNames>.Data.Names.Where(s => s.Contains(res.Text.Trim()));
  74. // // var datas = Json<MaterialNames>.Data.Names.ToList().FindAll(s => s.Contains(res.Text.Trim()));
  75. // if (datas.Count() > 0)
  76. // {
  77. // res.ItemsSource = datas;
  78. // res.IsDropDownOpen = true;
  79. // }
  80. // else
  81. // {
  82. // res.IsDropDownOpen = false;
  83. // }
  84. // }
  85. //}
  86. //private void ComboBox_LostFocus(object sender, RoutedEventArgs e)
  87. //{
  88. // var res = sender as ComboBox;
  89. // if (res.Text != null && res.Text != String.Empty)
  90. // {
  91. // if (!Json<FlowProcessNames>.Data.Names.Contains(res.Text.Trim()))//判断是否存在原料
  92. // {
  93. // //FlowProcessNames.GetInstance.Names.Add(res.Text.Trim());
  94. // //Json<FlowProcessNames>.Data = FlowProcessNames.GetInstance;
  95. // Json<FlowProcessNames>.Data.Names.Add(res.Text.Trim());
  96. // Json<FlowProcessNames>.Save();
  97. // }
  98. // }
  99. //}
  100. }
  101. }