From 6bcafc823e836ecd5790f87178a906333699f868 Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期四, 10 四月 2025 10:46:47 +0800
Subject: [PATCH] 优化插件结构;

---
 Plugin.TestBuilder/TestBuilder.xaml.cs |  179 ++++++++++++++++++++++-------------------------------------
 1 files changed, 66 insertions(+), 113 deletions(-)

diff --git a/WPFProject/UI/WorkControl.xaml.cs b/Plugin.TestBuilder/TestBuilder.xaml.cs
similarity index 62%
copy from WPFProject/UI/WorkControl.xaml.cs
copy to Plugin.TestBuilder/TestBuilder.xaml.cs
index 725407c..9907291 100644
--- a/WPFProject/UI/WorkControl.xaml.cs
+++ b/Plugin.TestBuilder/TestBuilder.xaml.cs
@@ -1,22 +1,20 @@
-锘縰sing System;
+锘縰sing HMI.Base;
+using Plugin.TestBuilder.Entity;
+using Plugin.TestBuilder.UI;
+using System;
 using System.Collections.Generic;
 using System.Windows;
 using System.Windows.Controls;
-using HMI.Base;
-using log4net;
-using WPFProject.Controls;
-using WPFProject.Models;
-using WPFProject.Utils;
+using System.Windows.Media;
 
-namespace WPFProject.UI
+namespace Plugin.TestBuilder
 {
     /// <summary>
     /// WorkControl.xaml 鐨勪氦浜掗�昏緫
     /// </summary>
-    public partial class WorkControl : PluginControl
+    public partial class TestBuilder : PluginControl
     {
-        private ILog log;
-        public WorkControl()
+        public TestBuilder()
         {
             InitializeComponent();
             Loaded += UserControl_Loaded;
@@ -69,49 +67,49 @@
 
         private void UserControl_Loaded(object sender, RoutedEventArgs e)
         {
-            //List<CanvasPosition> pos = InitGridSize();
-            //ProgramList programList = new ProgramList();
-            //InnerWindow p = new InnerWindow(pos[0])
-            //{
-            //    Title = "绋嬪簭鍒楄〃",
-            //    Content = programList
-            //};
-            //HandleInnerWindow(p);
+            List<CanvasPosition> pos = InitGridSize();
+            ProgramList programList = new ProgramList();
+            InnerWindow p = new InnerWindow(pos[0])
+            {
+                Title = "绋嬪簭鍒楄〃",
+                Content = programList
+            };
+            HandleInnerWindow(p);
 
-            //InnerWindow p1 = new InnerWindow(pos[1])
-            //{
-            //    Title = "鍥剧墖",
-            //};
-            //HandleInnerWindow(p1);
+            InnerWindow p1 = new InnerWindow(pos[1])
+            {
+                Title = "鍥剧墖"
+            };
+            HandleInnerWindow(p1);
 
-            //SequnceList sequnceList = new SequnceList();
-            //programList.ProgramChanged += sequnceList.Selected_Program_Changed;
+            SequnceList sequnceList = new SequnceList();
+            programList.ProgramChanged += sequnceList.Selected_Program_Changed;
 
-            //InnerWindow p2 = new InnerWindow(pos[2])
-            //{
-            //    Title = "搴忓垪",
-            //    Content = sequnceList
-            //};
-            //HandleInnerWindow(p2);
+            InnerWindow p2 = new InnerWindow(pos[2])
+            {
+                Title = "搴忓垪",
+                Content = sequnceList
+            };
+            HandleInnerWindow(p2);
 
-            //FunctionSetting functionSetting = new FunctionSetting();
-            //InnerWindow p3 = new InnerWindow(pos[3])
-            //{
-            //    Title = "鍑芥暟",
-            //    Content = functionSetting
-            //};
-            //HandleInnerWindow(p3);
+            FunctionSetting functionSetting = new FunctionSetting();
+            InnerWindow p3 = new InnerWindow(pos[3])
+            {
+                Title = "鍑芥暟",
+                Content = functionSetting
+            };
+            HandleInnerWindow(p3);
 
-            //StepSetting stepSetting = new StepSetting();
-            //InnerWindow p4 = new InnerWindow(pos[4])
-            //{
-            //    Title = "鍗曟璁剧疆",
-            //    Content = stepSetting
-            //};
-            //HandleInnerWindow(p4);
+            StepSetting stepSetting = new StepSetting();
+            InnerWindow p4 = new InnerWindow(pos[4])
+            {
+                Title = "鍗曟璁剧疆",
+                Content = stepSetting
+            };
+            HandleInnerWindow(p4);
 
 
-            //SizeChanged += WorkControl_SizeChanged;
+            SizeChanged += WorkControl_SizeChanged;
             Loaded -= UserControl_Loaded;
 
         }
@@ -199,30 +197,30 @@
         /// <param name="e"></param>
         private void WorkControl_SizeChanged(object sender, SizeChangedEventArgs e)
         {
-            //Size newSize = e.NewSize;
-            //Size previousSize = e.PreviousSize;
+            Size newSize = e.NewSize;
+            Size previousSize = e.PreviousSize;
 
-            //double xRate = newSize.Width / previousSize.Width;
-            //double yRate = newSize.Height / previousSize.Height;
-            //for (int i = 0; i < VisualTreeHelper.GetChildrenCount(WorkArea); i++)
-            //{
-            //    UIElement child = VisualTreeHelper.GetChild(WorkArea, i) as UIElement;
-            //    Canvas.SetLeft(child, Canvas.GetLeft(child) * xRate);
-            //    Canvas.SetTop(child, Canvas.GetTop(child) * yRate);
-            //}
+            double xRate = newSize.Width / previousSize.Width;
+            double yRate = newSize.Height / previousSize.Height;
+            for (int i = 0; i < VisualTreeHelper.GetChildrenCount(WorkArea); i++)
+            {
+                UIElement child = VisualTreeHelper.GetChild(WorkArea, i) as UIElement;
+                Canvas.SetLeft(child, Canvas.GetLeft(child) * xRate);
+                Canvas.SetTop(child, Canvas.GetTop(child) * yRate);
+            }
 
-            //for (int i = 0; i < VisualTreeHelper.GetChildrenCount(WorkArea); i++)
-            //{
-            //    UIElement child = VisualTreeHelper.GetChild(WorkArea, i) as UIElement;
-            //    if (Canvas.GetLeft(child) >= newSize.Width)
-            //    {
-            //        Canvas.SetLeft(child, Canvas.GetLeft(child) + newSize.Width - previousSize.Width);
-            //    }
-            //    if (Canvas.GetTop(child) >= newSize.Height)
-            //    {
-            //        Canvas.SetTop(child, Canvas.GetTop(child) + newSize.Height - previousSize.Height);
-            //    }
-            //}
+            for (int i = 0; i < VisualTreeHelper.GetChildrenCount(WorkArea); i++)
+            {
+                UIElement child = VisualTreeHelper.GetChild(WorkArea, i) as UIElement;
+                if (Canvas.GetLeft(child) >= newSize.Width)
+                {
+                    Canvas.SetLeft(child, Canvas.GetLeft(child) + newSize.Width - previousSize.Width);
+                }
+                if (Canvas.GetTop(child) >= newSize.Height)
+                {
+                    Canvas.SetTop(child, Canvas.GetTop(child) + newSize.Height - previousSize.Height);
+                }
+            }
         }
         #endregion
 
@@ -264,50 +262,5 @@
         }
         #endregion
 
-        public void OnTabChange(object sender, SelectionChangedEventArgs args)
-        {
-            if (args.AddedItems.Count > 0)
-            {
-                IconTabItem newTab = args.AddedItems[0] as IconTabItem;
-                if (newTab != null && newTab.Content == this)
-                {
-
-                }
-            }
-
-            if (args.RemovedItems.Count > 0)
-            {
-                IconTabItem oldTab = args.RemovedItems[0] as IconTabItem;
-                if (oldTab != null && oldTab.Content == this)
-                {
-
-                }
-            }
-        }
-
-        public object Active()
-        {
-            return null;
-        }
-
-        public object DeActive()
-        {
-            return null;
-        }
-
-        public void OnTabChange(object sender, object args)
-        {
-
-        }
-
-        public object Init()
-        {
-            return null;
-        }
-
-        public void SetLogger(ILog logger)
-        {
-            log = logger;
-        }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1