From a585333636b4b90babdfc35570f970814649bc7f Mon Sep 17 00:00:00 2001 From: hsc Date: Tue, 4 Nov 2025 14:31:06 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E6=A4=8D=E7=A8=8B=E5=BA=8F=EF=BC=8C?= =?UTF-8?q?=E5=AE=8C=E6=88=90commandtree=E7=9A=84MVVM=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BaseFrame.sln => BOB.sln | 8 +- {BaseFrame => BOB}/App.xaml | 4 +- {BaseFrame => BOB}/App.xaml.cs | 10 +- {BaseFrame => BOB}/AssemblyInfo.cs | 0 BaseFrame/BaseFrame.csproj => BOB/BOB.csproj | 1 + BOB/Models/InstructionNode.cs | 16 + BOB/Models/SubProgramItem.cs | 15 + {BaseFrame => BOB}/Resources/Images/error.png | Bin {BaseFrame => BOB}/Resources/Images/info.png | Bin .../Resources/Images/warning.png | Bin .../Resources/Styles/WindowStyle.xaml | 0 BOB/SystemConfig.cs | 96 ++++ BOB/ViewModels/CommandTreeViewModel.cs | 333 ++++++++++++ .../ViewModels/Dialogs/MessageBoxViewModel.cs | 2 +- BOB/ViewModels/LogAreaViewModel.cs | 16 + .../ViewModels/MainViewModel.cs | 2 +- BOB/ViewModels/ParametersManagerViewModel.cs | 16 + .../ViewModels/ShellViewModel.cs | 4 +- BOB/ViewModels/SingleStepEditViewModel.cs | 16 + BOB/ViewModels/StepsManagerViewModel.cs | 16 + BOB/Views/CommandTree.xaml | 74 +++ BOB/Views/CommandTree.xaml.cs | 28 ++ .../Views/Dialogs/MessageBoxView.xaml | 4 +- .../Views/Dialogs/MessageBoxView.xaml.cs | 2 +- BOB/Views/LogArea.xaml | 29 ++ BOB/Views/LogArea.xaml.cs | 28 ++ BOB/Views/MainView.xaml | 43 ++ {BaseFrame => BOB}/Views/MainView.xaml.cs | 2 +- BOB/Views/ParametersManager.xaml | 135 +++++ BOB/Views/ParametersManager.xaml.cs | 28 ++ {BaseFrame => BOB}/Views/ProgressView.xaml | 4 +- {BaseFrame => BOB}/Views/ProgressView.xaml.cs | 2 +- {BaseFrame => BOB}/Views/ShellView.xaml | 16 +- {BaseFrame => BOB}/Views/ShellView.xaml.cs | 13 +- BOB/Views/SingleStepEdit.xaml | 135 +++++ BOB/Views/SingleStepEdit.xaml.cs | 28 ++ BOB/Views/StepsManager.xaml | 123 +++++ BOB/Views/StepsManager.xaml.cs | 28 ++ BaseFrame/Views/MainView.xaml | 15 - Command/Command.csproj | 14 + Command/CommandApplication.cs | 268 ++++++++++ Command/CommandArray.cs | 261 ++++++++++ Command/CommandMath.cs | 473 ++++++++++++++++++ Command/CommandRadixChange.cs | 153 ++++++ Command/CommandStringProcessing.cs | 196 ++++++++ Command/CommandSystem.cs | 463 +++++++++++++++++ Command/CommandTime.cs | 95 ++++ Command/Delay.cs | 58 +++ Common/Attributes/ATSCommandAttribute.cs | 32 ++ Logger/LoggerHelper.cs | 2 +- 50 files changed, 3264 insertions(+), 43 deletions(-) rename BaseFrame.sln => BOB.sln (84%) rename {BaseFrame => BOB}/App.xaml (95%) rename {BaseFrame => BOB}/App.xaml.cs (87%) rename {BaseFrame => BOB}/AssemblyInfo.cs (100%) rename BaseFrame/BaseFrame.csproj => BOB/BOB.csproj (98%) create mode 100644 BOB/Models/InstructionNode.cs create mode 100644 BOB/Models/SubProgramItem.cs rename {BaseFrame => BOB}/Resources/Images/error.png (100%) rename {BaseFrame => BOB}/Resources/Images/info.png (100%) rename {BaseFrame => BOB}/Resources/Images/warning.png (100%) rename {BaseFrame => BOB}/Resources/Styles/WindowStyle.xaml (100%) create mode 100644 BOB/SystemConfig.cs create mode 100644 BOB/ViewModels/CommandTreeViewModel.cs rename {BaseFrame => BOB}/ViewModels/Dialogs/MessageBoxViewModel.cs (98%) create mode 100644 BOB/ViewModels/LogAreaViewModel.cs rename {BaseFrame => BOB}/ViewModels/MainViewModel.cs (98%) create mode 100644 BOB/ViewModels/ParametersManagerViewModel.cs rename {BaseFrame => BOB}/ViewModels/ShellViewModel.cs (97%) create mode 100644 BOB/ViewModels/SingleStepEditViewModel.cs create mode 100644 BOB/ViewModels/StepsManagerViewModel.cs create mode 100644 BOB/Views/CommandTree.xaml create mode 100644 BOB/Views/CommandTree.xaml.cs rename {BaseFrame => BOB}/Views/Dialogs/MessageBoxView.xaml (96%) rename {BaseFrame => BOB}/Views/Dialogs/MessageBoxView.xaml.cs (94%) create mode 100644 BOB/Views/LogArea.xaml create mode 100644 BOB/Views/LogArea.xaml.cs create mode 100644 BOB/Views/MainView.xaml rename {BaseFrame => BOB}/Views/MainView.xaml.cs (95%) create mode 100644 BOB/Views/ParametersManager.xaml create mode 100644 BOB/Views/ParametersManager.xaml.cs rename {BaseFrame => BOB}/Views/ProgressView.xaml (89%) rename {BaseFrame => BOB}/Views/ProgressView.xaml.cs (95%) rename {BaseFrame => BOB}/Views/ShellView.xaml (96%) rename {BaseFrame => BOB}/Views/ShellView.xaml.cs (77%) create mode 100644 BOB/Views/SingleStepEdit.xaml create mode 100644 BOB/Views/SingleStepEdit.xaml.cs create mode 100644 BOB/Views/StepsManager.xaml create mode 100644 BOB/Views/StepsManager.xaml.cs delete mode 100644 BaseFrame/Views/MainView.xaml create mode 100644 Command/Command.csproj create mode 100644 Command/CommandApplication.cs create mode 100644 Command/CommandArray.cs create mode 100644 Command/CommandMath.cs create mode 100644 Command/CommandRadixChange.cs create mode 100644 Command/CommandStringProcessing.cs create mode 100644 Command/CommandSystem.cs create mode 100644 Command/CommandTime.cs create mode 100644 Command/Delay.cs create mode 100644 Common/Attributes/ATSCommandAttribute.cs diff --git a/BaseFrame.sln b/BOB.sln similarity index 84% rename from BaseFrame.sln rename to BOB.sln index e46fe6b..f5d88c8 100644 --- a/BaseFrame.sln +++ b/BOB.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.14.36221.1 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BaseFrame", "BaseFrame\BaseFrame.csproj", "{FC10E4D4-0AA3-487B-B023-F8D2949E45ED}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BOB", "BOB\BOB.csproj", "{FC10E4D4-0AA3-487B-B023-F8D2949E45ED}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Model", "Model\Model.csproj", "{6D9764D9-B4DA-43E2-A9D7-40A6C871A6B3}" EndProject @@ -15,6 +15,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Service", "Service\Service. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "Common\Common.csproj", "{6C684FE1-C773-4B9D-89F1-9266C7B32DC0}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Command", "Command\Command.csproj", "{49D249DE-CB09-4390-89DC-6165965C3933}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -45,6 +47,10 @@ Global {6C684FE1-C773-4B9D-89F1-9266C7B32DC0}.Debug|Any CPU.Build.0 = Debug|Any CPU {6C684FE1-C773-4B9D-89F1-9266C7B32DC0}.Release|Any CPU.ActiveCfg = Release|Any CPU {6C684FE1-C773-4B9D-89F1-9266C7B32DC0}.Release|Any CPU.Build.0 = Release|Any CPU + {49D249DE-CB09-4390-89DC-6165965C3933}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {49D249DE-CB09-4390-89DC-6165965C3933}.Debug|Any CPU.Build.0 = Debug|Any CPU + {49D249DE-CB09-4390-89DC-6165965C3933}.Release|Any CPU.ActiveCfg = Release|Any CPU + {49D249DE-CB09-4390-89DC-6165965C3933}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/BaseFrame/App.xaml b/BOB/App.xaml similarity index 95% rename from BaseFrame/App.xaml rename to BOB/App.xaml index 363f5af..21d7209 100644 --- a/BaseFrame/App.xaml +++ b/BOB/App.xaml @@ -1,7 +1,7 @@ - diff --git a/BaseFrame/App.xaml.cs b/BOB/App.xaml.cs similarity index 87% rename from BaseFrame/App.xaml.cs rename to BOB/App.xaml.cs index c3e560c..ad9f236 100644 --- a/BaseFrame/App.xaml.cs +++ b/BOB/App.xaml.cs @@ -1,7 +1,7 @@ -using BaseFrame.ViewModels; -using BaseFrame.ViewModels.Dialogs; -using BaseFrame.Views; -using BaseFrame.Views.Dialogs; +using BOB.ViewModels; +using BOB.ViewModels.Dialogs; +using BOB.Views; +using BOB.Views.Dialogs; using Castle.DynamicProxy; using System.Configuration; using System.Data; @@ -9,7 +9,7 @@ using System.Reflection; using System.Windows; using static System.Runtime.InteropServices.JavaScript.JSType; -namespace BaseFrame +namespace BOB { /// /// Interaction logic for App.xaml diff --git a/BaseFrame/AssemblyInfo.cs b/BOB/AssemblyInfo.cs similarity index 100% rename from BaseFrame/AssemblyInfo.cs rename to BOB/AssemblyInfo.cs diff --git a/BaseFrame/BaseFrame.csproj b/BOB/BOB.csproj similarity index 98% rename from BaseFrame/BaseFrame.csproj rename to BOB/BOB.csproj index 9be13d0..79445af 100644 --- a/BaseFrame/BaseFrame.csproj +++ b/BOB/BOB.csproj @@ -42,6 +42,7 @@ + diff --git a/BOB/Models/InstructionNode.cs b/BOB/Models/InstructionNode.cs new file mode 100644 index 0000000..57e421f --- /dev/null +++ b/BOB/Models/InstructionNode.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BOB.Models +{ + public class InstructionNode + { + public string Name { get; set; } + public ObservableCollection Children { get; set; } = new(); + } + +} diff --git a/BOB/Models/SubProgramItem.cs b/BOB/Models/SubProgramItem.cs new file mode 100644 index 0000000..c5c9e1d --- /dev/null +++ b/BOB/Models/SubProgramItem.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BOB.Models +{ + public class SubProgramItem + { + public string Name { get; set; } = ""; + + public string FilePath { get; set; } = ""; + } +} diff --git a/BaseFrame/Resources/Images/error.png b/BOB/Resources/Images/error.png similarity index 100% rename from BaseFrame/Resources/Images/error.png rename to BOB/Resources/Images/error.png diff --git a/BaseFrame/Resources/Images/info.png b/BOB/Resources/Images/info.png similarity index 100% rename from BaseFrame/Resources/Images/info.png rename to BOB/Resources/Images/info.png diff --git a/BaseFrame/Resources/Images/warning.png b/BOB/Resources/Images/warning.png similarity index 100% rename from BaseFrame/Resources/Images/warning.png rename to BOB/Resources/Images/warning.png diff --git a/BaseFrame/Resources/Styles/WindowStyle.xaml b/BOB/Resources/Styles/WindowStyle.xaml similarity index 100% rename from BaseFrame/Resources/Styles/WindowStyle.xaml rename to BOB/Resources/Styles/WindowStyle.xaml diff --git a/BOB/SystemConfig.cs b/BOB/SystemConfig.cs new file mode 100644 index 0000000..c38b855 --- /dev/null +++ b/BOB/SystemConfig.cs @@ -0,0 +1,96 @@ +using Logger; +using Newtonsoft.Json; +using System; +using System.IO; +using System.Reflection; + +namespace BOB +{ + public class SystemConfig + { + private static readonly object _lock = new(); + + private static SystemConfig? _instance; + + public static SystemConfig Instance + { + get + { + lock (_lock) + { + if (_instance == null) + { + _instance = new(); + _instance.LoadFromFile(); + } + return _instance; + } + } + } + + [JsonIgnore] + public string SystemPath { get; set; } = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "BOB系统"); + + public int PerformanceLevel { get; set; } = 50; + + public string DLLFilePath { get; set; } = @"D:\BOB\指令\"; + + public string SubProgramFilePath { get; set; } = @"D:\BOB\子程序\"; + + public string DefaultSubProgramFilePath { get; set; } = ""; + + // 配置加载方法 + public void LoadFromFile() + { + string configPath = Path.Combine(SystemPath, "system.config"); + + if (!File.Exists(configPath)) + { + string json = JsonConvert.SerializeObject(Instance, Formatting.Indented); + File.WriteAllText(configPath, json); + return; + } + try + { + string json = File.ReadAllText(configPath); + var loadedConfig = JsonConvert.DeserializeObject(json); + + // 复制所有可写属性(排除JsonIgnore属性) + PropertyInfo[] properties = typeof(SystemConfig).GetProperties(); + foreach (var prop in properties) + { + if (prop.CanWrite && !Attribute.IsDefined(prop, typeof(JsonIgnoreAttribute))) + { + prop.SetValue(this, prop.GetValue(loadedConfig)); + } + } + } + catch (Exception ex) + { + LoggerHelper.Logger.Error($"配置加载失败: {ex.Message}"); + } + } + public void SaveToFile() + { + lock (_lock) + { + try + { + if (!Directory.Exists(SystemPath)) + Directory.CreateDirectory(SystemPath); + + string configPath = Path.Combine(SystemPath, "system.config"); + string json = JsonConvert.SerializeObject(this, Formatting.Indented); + + File.WriteAllText(configPath, json); + + LoggerHelper.Logger.Info("系统配置已保存。"); + } + catch (Exception ex) + { + LoggerHelper.Logger.Error($"配置保存失败: {ex.Message}"); + } + } + } + } +} \ No newline at end of file diff --git a/BOB/ViewModels/CommandTreeViewModel.cs b/BOB/ViewModels/CommandTreeViewModel.cs new file mode 100644 index 0000000..bc0461c --- /dev/null +++ b/BOB/ViewModels/CommandTreeViewModel.cs @@ -0,0 +1,333 @@ +using BOB.Models; +using Common.Attributes; +using Logger; +using Microsoft.IdentityModel.Logging; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Xml; + +namespace BOB.ViewModels +{ + public class CommandTreeViewModel:BindableBase + { + #region 属性 + private string _SearchText; + + public string SearchText + { + get => _SearchText; + set => SetProperty(ref _SearchText, value); + } + public ObservableCollection _InstructionTree=new(); + public ObservableCollection InstructionTree + { + get => _InstructionTree; + set => SetProperty(ref _InstructionTree, value); + } + + public ObservableCollection Assemblies { get; set; } = []; + + public ObservableCollection SubPrograms { get; set; } = []; + + + private Dictionary _treeViewItemMap = []; + + private TreeViewItem _subProgramRootNode; + + private readonly Dictionary _xmlDocumentCache = []; + + #endregion + public ICommand LoadedCommand { get; set; } + public ICommand SearchEnterCommand { get; set; } + public ICommand TreeDoubleClickCommand { get; set; } + public ICommand ReloadCommand { get; set; } + public CommandTreeViewModel() + { + LoadedCommand = new DelegateCommand(Loaded); + SearchEnterCommand = new DelegateCommand(Search); + TreeDoubleClickCommand = new DelegateCommand(TreeDoubleClick); + ReloadCommand = new DelegateCommand(Reload); + } + + + #region 委托命令 + private void Reload() + { + LoadAllAssemblies(); + LoadSubPrograms(); + LoadInstructionsToTreeView(); + } + private void TreeDoubleClick() + { + + } + private void Search() + { + + } + + private void Loaded() + { + Directory.CreateDirectory(SystemConfig.Instance.DLLFilePath); + Directory.CreateDirectory(SystemConfig.Instance.SubProgramFilePath); + LoadAllAssemblies(); + LoadSubPrograms(); + LoadInstructionsToTreeView(); + + } + #endregion + #region 加载指令 + /// + /// 加载指定目录下的所有DLL + /// + private void LoadAllAssemblies() + { + Assemblies.Clear(); + + foreach (var dllPath in Directory.GetFiles(SystemConfig.Instance.DLLFilePath, "*.dll")) + { + try + { + var assembly = Assembly.LoadFrom(dllPath); + Assemblies.Add(assembly); + + // 加载对应的XML注释文件 + string xmlPath = Path.ChangeExtension(dllPath, ".xml"); + if (File.Exists(xmlPath)) + { + try + { + XmlDocument xmlDoc = new XmlDocument(); + xmlDoc.Load(xmlPath); + _xmlDocumentCache[assembly.FullName!] = xmlDoc; + } + catch (Exception xmlEx) + { + LoggerHelper.Logger.Warn($"加载XML注释失败: {Path.GetFileName(xmlPath)} - {xmlEx.Message}"); + } + } + } + catch (Exception ex) + { + LoggerHelper.Logger.Warn($"无法加载程序集 {Path.GetFileName(dllPath)}: {ex.Message}"); + } + } + } + // 子程序加载方法 + private void LoadSubPrograms() + { + SubPrograms.Clear(); + + if (!Directory.Exists(SystemConfig.Instance.SubProgramFilePath)) + { + Directory.CreateDirectory(SystemConfig.Instance.SubProgramFilePath); + return; + } + + foreach (var filePath in Directory.GetFiles(SystemConfig.Instance.SubProgramFilePath, "*.ats")) + { + try + { + SubPrograms.Add(new SubProgramItem + { + Name = Path.GetFileNameWithoutExtension(filePath), + FilePath = filePath + }); + } + catch (Exception ex) + { + LoggerHelper.Logger.Warn($"加载子程序错误: {filePath} - {ex.Message}"); + } + } + } + /// + /// 加载指令集到TreeView + /// + private void LoadInstructionsToTreeView() + { + InstructionTree.Clear(); + var controlRootNode = new InstructionNode + { + Name = "系统指令", + }; + InstructionTree.Add(controlRootNode); + + // 循环开始 + controlRootNode.Children.Add(new InstructionNode + { + Name = "循环开始", + }); + + // 循环结束 + controlRootNode.Children.Add(new InstructionNode + { + Name = "循环结束", + }); + + // ---------------------- + // 子程序 根节点 + // ---------------------- + var subProgramRoot = new InstructionNode + { + Name = "子程序", + }; + InstructionTree.Add(subProgramRoot); + + foreach (var subProgram in SubPrograms) + { + subProgramRoot.Children.Add(new InstructionNode + { + Name = subProgram.Name, + }); + } + + // ---------------------- + // 动态 DLL 指令 + // ---------------------- + foreach (var assembly in Assemblies) + { + List validTypes = new List(); + + try + { + var types = assembly.GetTypes().Where(t => + t.IsPublic && + !t.IsNested && + (t.IsClass || t.IsValueType) && + (!t.IsAbstract || t.IsSealed) && + t.GetCustomAttribute() != null); + + foreach (var type in types) + { + if (type.GetCustomAttribute()?.Browsable == false) + continue; + + var allMethods = new HashSet(); + GetPublicMethods(type, allMethods); + + if (allMethods.Count > 0) + validTypes.Add(type); + } + } + catch (Exception ex) + { + LoggerHelper.Logger.Error($"加载类型错误: {assembly.FullName} - {ex.Message}"); + } + + if (validTypes.Count > 0) + { + var assemblyNode = new InstructionNode + { + Name = assembly.GetName().Name, + }; + InstructionTree.Add(assemblyNode); + _treeViewItemMap[assembly] = assemblyNode; + + foreach (var type in validTypes) + { + var typeNode = new InstructionNode + { + Name = type.Name, + + }; + assemblyNode.Children.Add(typeNode); + _treeViewItemMap[type] = typeNode; + + var allMethods = new HashSet(); + GetPublicMethods(type, allMethods); + + foreach (var method in allMethods) + { + if (method.IsSpecialName) continue; + if (method.DeclaringType == typeof(object)) continue; + + string[] ignoreMethods = { "GetType", "ToString", "Equals", "GetHashCode" }; + if (ignoreMethods.Contains(method.Name)) continue; + + if (method.GetCustomAttribute()?.Browsable == false) continue; + if (type.IsAbstract && type.IsSealed && !method.IsStatic) continue; + + var parameters = method.GetParameters(); + var paramText = string.Join(", ", parameters.Select(p => $"{p.ParameterType.Name} {p.Name}")); + + var methodNode = new InstructionNode + { + Name = $"{method.Name}({paramText})", + + }; + + typeNode.Children.Add(methodNode); + _treeViewItemMap[method] = methodNode; + } + } + } + } + } + + #endregion + /// + /// 递归获取类型的所有公共方法(包括继承的方法),但跳过被重写的方法 + /// + /// 要处理的目标类型 + /// 存储方法的集合 + private void GetPublicMethods(Type type, HashSet methods) + { + // 获取当前类型的所有公共方法(包括继承的) + var allMethods = type.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static) + .Where(m => !m.IsSpecialName && + m.DeclaringType != typeof(object)) + .ToList(); + + // 按方法签名分组 + var groupedMethods = allMethods + .GroupBy(m => new { m.Name, Parameters = string.Join(",", m.GetParameters().Select(p => p.ParameterType.FullName)) }); + + foreach (var group in groupedMethods) + { + // 从组中选择声明类型最接近当前类型(即继承层次最深)的方法 + MethodInfo? selectedMethod = null; + int minDepth = int.MaxValue; + + foreach (var method in group) + { + // 计算声明类型的深度 + int depth = 0; + Type? current = type; + Type declaringType = method.DeclaringType!; + + while (current != null && current != declaringType) + { + depth++; + current = current.BaseType; + } + + // 如果找到声明类型且在继承链上 + if (current == declaringType) + { + if (selectedMethod == null || depth < minDepth) + { + selectedMethod = method; + minDepth = depth; + } + } + } + + if (selectedMethod != null) + { + methods.Add(selectedMethod); + } + } + } + + } +} diff --git a/BaseFrame/ViewModels/Dialogs/MessageBoxViewModel.cs b/BOB/ViewModels/Dialogs/MessageBoxViewModel.cs similarity index 98% rename from BaseFrame/ViewModels/Dialogs/MessageBoxViewModel.cs rename to BOB/ViewModels/Dialogs/MessageBoxViewModel.cs index e2e19a6..ffd8480 100644 --- a/BaseFrame/ViewModels/Dialogs/MessageBoxViewModel.cs +++ b/BOB/ViewModels/Dialogs/MessageBoxViewModel.cs @@ -4,7 +4,7 @@ using Prism.Commands; using Prism.Mvvm; using System.Windows.Input; -namespace BaseFrame.ViewModels.Dialogs +namespace BOB.ViewModels.Dialogs { public class MessageBoxViewModel : BindableBase, IDialogAware { diff --git a/BOB/ViewModels/LogAreaViewModel.cs b/BOB/ViewModels/LogAreaViewModel.cs new file mode 100644 index 0000000..d5be75e --- /dev/null +++ b/BOB/ViewModels/LogAreaViewModel.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BOB.ViewModels +{ + public class LogAreaViewModel + { + public LogAreaViewModel() + { + + } + } +} diff --git a/BaseFrame/ViewModels/MainViewModel.cs b/BOB/ViewModels/MainViewModel.cs similarity index 98% rename from BaseFrame/ViewModels/MainViewModel.cs rename to BOB/ViewModels/MainViewModel.cs index f75c58c..05c7c4f 100644 --- a/BaseFrame/ViewModels/MainViewModel.cs +++ b/BOB/ViewModels/MainViewModel.cs @@ -11,7 +11,7 @@ using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Windows.Input; -namespace BaseFrame.ViewModels +namespace BOB.ViewModels { public class MainViewModel : BindableBase,INavigationAware,IDialogAware { diff --git a/BOB/ViewModels/ParametersManagerViewModel.cs b/BOB/ViewModels/ParametersManagerViewModel.cs new file mode 100644 index 0000000..98e5c59 --- /dev/null +++ b/BOB/ViewModels/ParametersManagerViewModel.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BOB.ViewModels +{ + public class ParametersManagerViewModel + { + public ParametersManagerViewModel() + { + + } + } +} diff --git a/BaseFrame/ViewModels/ShellViewModel.cs b/BOB/ViewModels/ShellViewModel.cs similarity index 97% rename from BaseFrame/ViewModels/ShellViewModel.cs rename to BOB/ViewModels/ShellViewModel.cs index 1a908bd..cb77620 100644 --- a/BaseFrame/ViewModels/ShellViewModel.cs +++ b/BOB/ViewModels/ShellViewModel.cs @@ -1,4 +1,4 @@ -using BaseFrame.Views; +using BOB.Views; using Common.PubEvents; using MaterialDesignThemes.Wpf; using System; @@ -9,7 +9,7 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Input; -namespace BaseFrame.ViewModels +namespace BOB.ViewModels { public class ShellViewModel : BindableBase { diff --git a/BOB/ViewModels/SingleStepEditViewModel.cs b/BOB/ViewModels/SingleStepEditViewModel.cs new file mode 100644 index 0000000..5ac345f --- /dev/null +++ b/BOB/ViewModels/SingleStepEditViewModel.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BOB.ViewModels +{ + public class SingleStepEditViewModel + { + public SingleStepEditViewModel() + { + + } + } +} diff --git a/BOB/ViewModels/StepsManagerViewModel.cs b/BOB/ViewModels/StepsManagerViewModel.cs new file mode 100644 index 0000000..b5f1bd0 --- /dev/null +++ b/BOB/ViewModels/StepsManagerViewModel.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BOB.ViewModels +{ + public class StepsManagerViewModel + { + public StepsManagerViewModel() + { + + } + } +} diff --git a/BOB/Views/CommandTree.xaml b/BOB/Views/CommandTree.xaml new file mode 100644 index 0000000..a681389 --- /dev/null +++ b/BOB/Views/CommandTree.xaml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BOB/Views/CommandTree.xaml.cs b/BOB/Views/CommandTree.xaml.cs new file mode 100644 index 0000000..2480d20 --- /dev/null +++ b/BOB/Views/CommandTree.xaml.cs @@ -0,0 +1,28 @@ +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.Navigation; +using System.Windows.Shapes; + +namespace BOB.Views +{ + /// + /// CommandTreeView.xaml 的交互逻辑 + /// + public partial class CommandTree : UserControl + { + public CommandTree() + { + InitializeComponent(); + } + } +} diff --git a/BaseFrame/Views/Dialogs/MessageBoxView.xaml b/BOB/Views/Dialogs/MessageBoxView.xaml similarity index 96% rename from BaseFrame/Views/Dialogs/MessageBoxView.xaml rename to BOB/Views/Dialogs/MessageBoxView.xaml index cc88cad..74aaf5e 100644 --- a/BaseFrame/Views/Dialogs/MessageBoxView.xaml +++ b/BOB/Views/Dialogs/MessageBoxView.xaml @@ -1,9 +1,9 @@ - /// MessageBoxView.xaml 的交互逻辑 diff --git a/BOB/Views/LogArea.xaml b/BOB/Views/LogArea.xaml new file mode 100644 index 0000000..a8be49f --- /dev/null +++ b/BOB/Views/LogArea.xaml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + diff --git a/BOB/Views/LogArea.xaml.cs b/BOB/Views/LogArea.xaml.cs new file mode 100644 index 0000000..75da110 --- /dev/null +++ b/BOB/Views/LogArea.xaml.cs @@ -0,0 +1,28 @@ +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.Navigation; +using System.Windows.Shapes; + +namespace BOB.Views +{ + /// + /// LogArea.xaml 的交互逻辑 + /// + public partial class LogArea : UserControl + { + public LogArea() + { + InitializeComponent(); + } + } +} diff --git a/BOB/Views/MainView.xaml b/BOB/Views/MainView.xaml new file mode 100644 index 0000000..d264e00 --- /dev/null +++ b/BOB/Views/MainView.xaml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/BaseFrame/Views/MainView.xaml.cs b/BOB/Views/MainView.xaml.cs similarity index 95% rename from BaseFrame/Views/MainView.xaml.cs rename to BOB/Views/MainView.xaml.cs index 64e7e78..4000c59 100644 --- a/BaseFrame/Views/MainView.xaml.cs +++ b/BOB/Views/MainView.xaml.cs @@ -13,7 +13,7 @@ using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; -namespace BaseFrame.Views +namespace BOB.Views { /// /// MainView.xaml 的交互逻辑 diff --git a/BOB/Views/ParametersManager.xaml b/BOB/Views/ParametersManager.xaml new file mode 100644 index 0000000..a5c829a --- /dev/null +++ b/BOB/Views/ParametersManager.xaml @@ -0,0 +1,135 @@ + + + + + + IsVisible + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BOB/Views/ParametersManager.xaml.cs b/BOB/Views/ParametersManager.xaml.cs new file mode 100644 index 0000000..7e9a34b --- /dev/null +++ b/BOB/Views/ParametersManager.xaml.cs @@ -0,0 +1,28 @@ +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.Navigation; +using System.Windows.Shapes; + +namespace BOB.Views +{ + /// + /// ParametersManager.xaml 的交互逻辑 + /// + public partial class ParametersManager : UserControl + { + public ParametersManager() + { + InitializeComponent(); + } + } +} diff --git a/BaseFrame/Views/ProgressView.xaml b/BOB/Views/ProgressView.xaml similarity index 89% rename from BaseFrame/Views/ProgressView.xaml rename to BOB/Views/ProgressView.xaml index 326eda8..0d6a4e9 100644 --- a/BaseFrame/Views/ProgressView.xaml +++ b/BOB/Views/ProgressView.xaml @@ -1,9 +1,9 @@ - diff --git a/BaseFrame/Views/ProgressView.xaml.cs b/BOB/Views/ProgressView.xaml.cs similarity index 95% rename from BaseFrame/Views/ProgressView.xaml.cs rename to BOB/Views/ProgressView.xaml.cs index 92c6591..2ebea04 100644 --- a/BaseFrame/Views/ProgressView.xaml.cs +++ b/BOB/Views/ProgressView.xaml.cs @@ -12,7 +12,7 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; -namespace BaseFrame.Views +namespace BOB.Views { /// /// ProgressView.xaml 的交互逻辑 diff --git a/BaseFrame/Views/ShellView.xaml b/BOB/Views/ShellView.xaml similarity index 96% rename from BaseFrame/Views/ShellView.xaml rename to BOB/Views/ShellView.xaml index 803f778..51bf13d 100644 --- a/BaseFrame/Views/ShellView.xaml +++ b/BOB/Views/ShellView.xaml @@ -1,11 +1,11 @@ - - - - + + + + @@ -51,7 +53,9 @@ - + diff --git a/BaseFrame/Views/ShellView.xaml.cs b/BOB/Views/ShellView.xaml.cs similarity index 77% rename from BaseFrame/Views/ShellView.xaml.cs rename to BOB/Views/ShellView.xaml.cs index a54f044..f76c4cc 100644 --- a/BaseFrame/Views/ShellView.xaml.cs +++ b/BOB/Views/ShellView.xaml.cs @@ -1,5 +1,6 @@ using Common.PubEvent; using Common.PubEvents; +using MahApps.Metro.Controls; using Prism.Events; using System; using System.Collections.Generic; @@ -15,12 +16,12 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; -namespace BaseFrame.Views +namespace BOB.Views { /// /// ShellView.xaml 的交互逻辑 /// - public partial class ShellView : Window + public partial class ShellView { public ShellView(IEventAggregator eventAggregator) { @@ -43,5 +44,13 @@ namespace BaseFrame.Views if (DialogHost.IsOpen) DialogHost.DialogContent = new ProgressView(); } + + private void ColorZone_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + if (e.LeftButton == MouseButtonState.Pressed) + { + Window.GetWindow(this)?.DragMove(); + } + } } } diff --git a/BOB/Views/SingleStepEdit.xaml b/BOB/Views/SingleStepEdit.xaml new file mode 100644 index 0000000..23186ae --- /dev/null +++ b/BOB/Views/SingleStepEdit.xaml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +