From 9d1660270272180cd71147d6ddd53d1382643d2e Mon Sep 17 00:00:00 2001
From: wenxiangchao <wenxiangchao@ihengxin.com.cn>
Date: 星期一, 02 十一月 2026 18:00:14 +0800
Subject: [PATCH] merge: 并入远程 Initial commit 作为历史根节点

---
 Plugin.SeqEditor/SeqEditor.xaml.cs |  143 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 143 insertions(+), 0 deletions(-)

diff --git a/Plugin.SeqEditor/SeqEditor.xaml.cs b/Plugin.SeqEditor/SeqEditor.xaml.cs
new file mode 100644
index 0000000..7bef44c
--- /dev/null
+++ b/Plugin.SeqEditor/SeqEditor.xaml.cs
@@ -0,0 +1,143 @@
+using HMI.Base;
+using HMI.UI;
+using Panuon.WPF.UI;
+using Plugin.SeqEditor.Entity;
+using Plugin.SeqEditor.Util;
+using Plugin.SeqEditor.ViewModel;
+using System.Web.UI.WebControls;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Input;
+
+namespace Plugin.SeqEditor;
+
+/// <summary>
+/// Interaction logic for UserControl1.xaml
+/// </summary>
+public partial class SeqEditor : PluginControl
+{
+    public SeqEditor()
+    {
+        InitializeComponent();
+        CbFilter.ItemsSource = (IEnumerable<MultiComboBoxData>)
+            new MultiComboBoxDataConverter().Convert(FilterTypeData.ItemSource,
+            null, null, null
+            );
+    }
+
+    public override void InitFinish()
+    {
+        this.DataContext = new SeqEditorViewModel(this, log);
+    }
+
+    public void BackgroundAction(Action action, string message)
+    {
+        new MaskWindow((WindowX)Window.GetWindow(this),
+                  (win) =>
+                  {
+                      action?.Invoke();
+                  }
+                  ).Info(message);
+    }
+
+    /// <summary>
+    /// 树数据展示过滤
+    /// </summary>
+    /// <param name="sender"></param>
+    /// <param name="e"></param>
+    private void CollectionViewSource_Filter(object sender, FilterEventArgs e)
+    {
+        if (e.Item is TreeItemData data)
+        {
+            e.Accepted = data.IsVisible;
+        }
+    }
+
+    // <summary>
+    /// 树展开/关闭事件
+    /// </summary>
+    /// <param name="sender"></param>
+    /// <param name="e"></param>
+    private void treeDataGrid_ExpandedChange(object sender, bool e)
+    {
+        //CollectionViewSource cvs = this.Resources["TreeGridFilter"] as CollectionViewSource;
+        //cvs?.View.Refresh();
+    }
+
+    private void treeDataGrid_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
+    {
+        e.Handled = false;
+    }
+
+    private void Expander_PreviewMouseDown(object sender, MouseButtonEventArgs e)
+    {
+        e.Handled = false;
+    }
+
+    private void TreeListView_SizeChanged(object sender, SizeChangedEventArgs e)
+    {
+        //var treeListView = sender as TreeListView;
+        //var columns = treeListView.Columns;
+        //var width = treeListView.ActualWidth;
+
+        //columns[0].Width = columns[0].Width + (width - columns[0].Width - columns[1].Width - columns[2].Width - columns[3].Width);
+
+        //foreach (var col in columns) { 
+        //    col.Width = 
+        //}
+    }
+
+    public void HandleStatus(ItemContainerGenerator cg, StepUI step, bool status)
+    {
+        DependencyObject dObject = cg.ContainerFromItem(step);
+        if (status == true)
+        {
+            if (dObject is TreeViewItem item)
+            {
+                if (step.Children != null && step.Children.Count > 0)
+                {
+                    if (item.IsExpanded != status)
+                    {
+                        item.IsExpanded = status;
+                        item.UpdateLayout();
+                    }
+                    foreach (var child in step.Children)
+                    {
+                        HandleStatus(item.ItemContainerGenerator, child, status);
+                    }
+                }
+            }
+        }
+        else
+        {
+            if (dObject is TreeViewItem item)
+            {
+                if (step.Children != null && step.Children.Count > 0)
+                {
+                    foreach (var child in step.Children)
+                    {
+                        HandleStatus(item.ItemContainerGenerator, child, status);
+                    }
+                    item.IsExpanded = status;
+                }
+            }
+        }
+    }
+
+    public bool expandAll = false;
+    private void Button_Click(object sender, RoutedEventArgs e)
+    {
+        treeList.UpdateLayout();
+        foreach (var item in treeList.Items)
+        {
+            if (item is StepUI step)
+            {
+                HandleStatus(treeList.ItemContainerGenerator, step, !expandAll);
+            }
+        }
+        expandAll = !expandAll;
+        //treeAll.Content = expandAll ? "一键收起" : "一键展开";
+    }
+}
+

--
Gitblit v1.9.1