using BPASmartClient.Helper; 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 BPASmart.RecipeManagement.View { /// /// TechnologyProcess.xaml 的交互逻辑 /// public partial class TechnologyProcess : Window { public TechnologyProcess() { InitializeComponent(); this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); }; ActionManage.GetInstance.CancelRegister("CloseTechnologyProcessView"); ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "CloseTechnologyProcessView"); } 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; } } }