|
- using BPASmartClient.Helper;
- using FryPot_DosingSystem.Model;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Shapes;
-
- namespace FryPot_DosingSystem.View
- {
- /// <summary>
- /// FlowProcessView.xaml 的交互逻辑
- /// </summary>
- public partial class FlowProcessView : Window
- {
-
- public FlowProcessView()
- {
- InitializeComponent();
- this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); };
- ActionManage.GetInstance.CancelRegister("CloseFlowProcessView");
- ActionManage.GetInstance.Register(new Action(() =>
- {
- this.Close();
- }), "CloseFlowProcessView");
-
-
- }
-
- private void Label_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
- {
- Label txt = sender as Label;
- if (txt != null)
- {
- StackPanel oldSp = FindFirstVisualChild(itemcontrols, "stk");
- if (oldSp != null)
- oldSp.Background = new SolidColorBrush(Color.FromRgb(38, 76, 115));
- StackPanel sp = VisualTreeHelper.GetParent(txt) as StackPanel;
- sp.Background = new SolidColorBrush(Color.FromRgb(8, 20, 36));
- ActionManage.GetInstance.Send("CurrentItemId", txt.Content);
- }
- }
-
-
- public StackPanel FindFirstVisualChild(DependencyObject obj, string childName)
- {
- for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++)
- {
- DependencyObject child = VisualTreeHelper.GetChild(obj, i);
- if (child != null && child is StackPanel && child.GetValue(NameProperty).ToString() == childName)
- {
- if (child is StackPanel stack && stack.Background?.ToString() == "#FF081424")
- return stack;
- }
- else
- {
- StackPanel SP = FindFirstVisualChild(child, childName);
- if (SP != null)
- {
- return SP;
- }
- }
- }
- return null;
- }
-
- //private void ComboBox_KeyUp(object sender, KeyEventArgs e)
- //{
- // var res = sender as ComboBox;
- // Json<FlowProcessNames>.Read();
-
- // if (res.Text != null && res.Text != String.Empty)
- // {
- // var datas = Json<FlowProcessNames>.Data.Names.Where(s => s.Contains(res.Text.Trim()));
- // // var datas = Json<MaterialNames>.Data.Names.ToList().FindAll(s => s.Contains(res.Text.Trim()));
- // if (datas.Count() > 0)
- // {
- // res.ItemsSource = datas;
- // res.IsDropDownOpen = true;
- // }
- // else
- // {
- // res.IsDropDownOpen = false;
- // }
- // }
- //}
-
- //private void ComboBox_LostFocus(object sender, RoutedEventArgs e)
- //{
- // var res = sender as ComboBox;
- // if (res.Text != null && res.Text != String.Empty)
- // {
- // if (!Json<FlowProcessNames>.Data.Names.Contains(res.Text.Trim()))//判断是否存在原料
- // {
- // //FlowProcessNames.GetInstance.Names.Add(res.Text.Trim());
- // //Json<FlowProcessNames>.Data = FlowProcessNames.GetInstance;
- // Json<FlowProcessNames>.Data.Names.Add(res.Text.Trim());
- // Json<FlowProcessNames>.Save();
-
- // }
-
- // }
- //}
- }
- }
|