diff --git a/BPASmartClient.MinimalistUI/App.xaml b/BPASmartClient.MinimalistUI/App.xaml new file mode 100644 index 00000000..1faae9da --- /dev/null +++ b/BPASmartClient.MinimalistUI/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/BPASmartClient.MinimalistUI/App.xaml.cs b/BPASmartClient.MinimalistUI/App.xaml.cs new file mode 100644 index 00000000..42652296 --- /dev/null +++ b/BPASmartClient.MinimalistUI/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace BPASmartClient.MinimalistUI +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App :Application + { + } +} diff --git a/BPASmartClient.MinimalistUI/AssemblyInfo.cs b/BPASmartClient.MinimalistUI/AssemblyInfo.cs new file mode 100644 index 00000000..8b5504ec --- /dev/null +++ b/BPASmartClient.MinimalistUI/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/BPASmartClient.MinimalistUI/BPASmartClient.MinimalistUI.csproj b/BPASmartClient.MinimalistUI/BPASmartClient.MinimalistUI.csproj new file mode 100644 index 00000000..0cd74038 --- /dev/null +++ b/BPASmartClient.MinimalistUI/BPASmartClient.MinimalistUI.csproj @@ -0,0 +1,45 @@ + + + + WinExe + net6.0-windows + enable + true + Images\fyf.ico + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BPASmartClient.MinimalistUI/Converters/ZoomConverter.cs b/BPASmartClient.MinimalistUI/Converters/ZoomConverter.cs new file mode 100644 index 00000000..51879b44 --- /dev/null +++ b/BPASmartClient.MinimalistUI/Converters/ZoomConverter.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + + +namespace BPASmartClient.MinimalistUI.Converters +{ + public class ZoomConverter :IValueConverter + { + public bool IsHeight { get; set; } + public object Convert(object value,Type targetType,object parameter,CultureInfo culture) + { + if (double.TryParse(value.ToString(),out double zoom)) + { + return IsHeight ? zoom * 1080 : zoom * 1920; + } + else + { + return IsHeight ? 1080 : 1920; + } + } + + public object ConvertBack(object value,Type targetType,object parameter,CultureInfo culture) + { + return value; + } + } +} diff --git a/BPASmartClient.MinimalistUI/FControl/RunCanvas.xaml b/BPASmartClient.MinimalistUI/FControl/RunCanvas.xaml new file mode 100644 index 00000000..c783fa11 --- /dev/null +++ b/BPASmartClient.MinimalistUI/FControl/RunCanvas.xaml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BPASmartClient.MinimalistUI/FControl/RunCanvas.xaml.cs b/BPASmartClient.MinimalistUI/FControl/RunCanvas.xaml.cs new file mode 100644 index 00000000..7b7c212e --- /dev/null +++ b/BPASmartClient.MinimalistUI/FControl/RunCanvas.xaml.cs @@ -0,0 +1,135 @@ +using BPASmartClient.Compiler; +using BPASmartClient.MessageName.接收消息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.Navigation; +using System.Windows.Shapes; + +namespace BPASmartClient.MinimalistUI.FControl +{ + /// + /// RunCanvas.xaml 的交互逻辑 + /// + public partial class RunCanvas :UserControl + { + public RunCanvas() + { + InitializeComponent(); + Unloaded += (s,e) => Destory(); + } + + /// + /// Dispose子集 + /// + public void Destory() + { + foreach (var item in RootCanvas.Children) + { + if (item is IDisposable disposable) + { + disposable.Dispose(); + } + } + } + + public List Run(List canvas) + { + List messages = new List(); + RootCanvas.Children.Clear(); + foreach (FrameworkElement element in canvas) + { + if (element is IExecutable executable) + { + executable.IsExecuteState = true; + //if (executable.EventNameList != null && executable.EventNameList.Count > 0) + //{ + // messages.AddRange(executable.EventNameList); + //} + } + RootCanvas.Children.Add(element); + RegisterJsName(element); + } + return messages; + } + + // 注册名称到Js + static void RegisterJsName(FrameworkElement element) + { + Config.GetInstance().SetVariable(element.Name,element); + if (element is Panel panel) + { + foreach (var item in panel.Children) + { + RegisterJsName(item as FrameworkElement); + } + } + } + + #region 拖动与缩放 + private void RootCanvas_MouseMove(object sender,MouseEventArgs e) + { + if (DragEnable.IsChecked == false) + { + return; + } + + if (e.LeftButton == MouseButtonState.Pressed && isPressed) + { + Point point = e.GetPosition(this); + var movex = (point.X - last.X); + var movey = (point.Y - last.Y); + + Translate.X += movex; + Translate.Y += movey; + last = point; + + } + } + + bool isPressed = false; + Point last;//记录上次鼠标坐标位置 + private void RootCanvas_MouseLeftButtoDown(object sender,MouseButtonEventArgs e) + { + last = e.GetPosition(this); + isPressed = true; + } + + private void RootCanvas_MouseLeftButtonUp(object sender,MouseButtonEventArgs e) + { + isPressed = false; + } + + // 缩放 + private void RootCanvas_MouseWheel(object sender,MouseWheelEventArgs e) + { + if (ZoomEnable.IsChecked == false) + { + return; + } + var zoomS = (e.Delta / 960d); + var zoom = zoomS + Scale.ScaleX; + if (zoom > 3 || zoom < 0.8) + { + return; + } + Scale.ScaleX = Scale.ScaleY = zoom; + + Point mouse = e.GetPosition(RootCanvas); + Point newMouse = new Point(mouse.X * zoomS,mouse.Y * zoomS); + + Translate.X -= newMouse.X; + Translate.Y -= newMouse.Y; + } + #endregion + } +} diff --git a/BPASmartClient.MinimalistUI/Images/bj.png b/BPASmartClient.MinimalistUI/Images/bj.png new file mode 100644 index 00000000..f6b621e0 Binary files /dev/null and b/BPASmartClient.MinimalistUI/Images/bj.png differ diff --git a/BPASmartClient.MinimalistUI/Images/fyf.ico b/BPASmartClient.MinimalistUI/Images/fyf.ico new file mode 100644 index 00000000..346bbc6c Binary files /dev/null and b/BPASmartClient.MinimalistUI/Images/fyf.ico differ diff --git a/BPASmartClient.MinimalistUI/Images/logo-Text.png b/BPASmartClient.MinimalistUI/Images/logo-Text.png new file mode 100644 index 00000000..e0e17a7c Binary files /dev/null and b/BPASmartClient.MinimalistUI/Images/logo-Text.png differ diff --git a/BPASmartClient.MinimalistUI/Images/logo-pic.png b/BPASmartClient.MinimalistUI/Images/logo-pic.png new file mode 100644 index 00000000..3cc53241 Binary files /dev/null and b/BPASmartClient.MinimalistUI/Images/logo-pic.png differ diff --git a/BPASmartClient.MinimalistUI/Images/top_h.png b/BPASmartClient.MinimalistUI/Images/top_h.png new file mode 100644 index 00000000..d23acad5 Binary files /dev/null and b/BPASmartClient.MinimalistUI/Images/top_h.png differ diff --git a/BPASmartClient.MinimalistUI/Images/椭圆 22 副本 2.png b/BPASmartClient.MinimalistUI/Images/椭圆 22 副本 2.png new file mode 100644 index 00000000..7c9bbca6 Binary files /dev/null and b/BPASmartClient.MinimalistUI/Images/椭圆 22 副本 2.png differ diff --git a/BPASmartClient.MinimalistUI/MainWindow.xaml b/BPASmartClient.MinimalistUI/MainWindow.xaml new file mode 100644 index 00000000..40c18369 --- /dev/null +++ b/BPASmartClient.MinimalistUI/MainWindow.xaml @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 智能卓越 + + + + + + + + + + + + + + + + + + diff --git a/BPASmartClient.MinimalistUI/MainWindow.xaml.cs b/BPASmartClient.MinimalistUI/MainWindow.xaml.cs new file mode 100644 index 00000000..cc629e8f --- /dev/null +++ b/BPASmartClient.MinimalistUI/MainWindow.xaml.cs @@ -0,0 +1,74 @@ +using BPASmartClient.Compiler; +using BPASmartClient.MessageCommunication; +using BPASmartClient.MessageCommunication.MsgControl; +using BPASmartClient.MessageName; +using BPASmartClient.MessageName.EnumHelp; +using BPASmartClient.MessageName.发送消息Model; +using BPASmartClient.MessageName.接收消息Model; +using BPASmartClient.MessageName.接收消息Model.物料仓; +using Microsoft.Win32; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.IO; +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.Markup; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace BPASmartClient.MinimalistUI +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow :Window + { + public MainWindow() + { + InitializeComponent(); + LoadingData(System.AppDomain.CurrentDomain.BaseDirectory + "LayoutFile\\物料仓管理.lay"); + } + /// + /// 加载数据 + /// + public void LoadingData(string path) + { + //加载控件 + List Children = new List(); + FileStream fs = new FileStream(path,FileMode.Open,FileAccess.Read,FileShare.ReadWrite); + using (StreamReader sr = new StreamReader(fs,System.Text.Encoding.Unicode)) + { + while (sr.Peek() > -1) + { + string str = sr.ReadLine(); + var ele = XamlReader.Parse(str) as FrameworkElement; + Children.Add(ele); + } + } + if (Children.Count > 0) + { + runCanvas.Run(Children); + } + + } + + private void grid_MouseEnter(object sender,MouseEventArgs e) + { + grid_celine.Visibility = Visibility.Visible; + } + + private void grid_MouseLeave(object sender,MouseEventArgs e) + { + grid_celine.Visibility = Visibility.Collapsed; + } + } +} diff --git a/BPASmartClient.MinimalistUI/物料仓管理.lay b/BPASmartClient.MinimalistUI/物料仓管理.lay new file mode 100644 index 00000000..13e8dc88 Binary files /dev/null and b/BPASmartClient.MinimalistUI/物料仓管理.lay differ diff --git a/SmartClient.sln b/SmartClient.sln index 8fe7c0f3..e62573bb 100644 --- a/SmartClient.sln +++ b/SmartClient.sln @@ -170,6 +170,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerTestDemo", "Compute EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "5.加载UI程序", "5.加载UI程序", "{1DA0F827-5F3D-4B87-9B51-6C0BF5365A3F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MinimalistUI", "BPASmartClient.MinimalistUI\BPASmartClient.MinimalistUI.csproj", "{AE49009F-B7D9-482E-AD1F-4514435272E1}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1544,6 +1546,26 @@ Global {8940F1E2-693D-407E-AD03-722718860609}.Release|x64.Build.0 = Release|Any CPU {8940F1E2-693D-407E-AD03-722718860609}.Release|x86.ActiveCfg = Release|Any CPU {8940F1E2-693D-407E-AD03-722718860609}.Release|x86.Build.0 = Release|Any CPU + {AE49009F-B7D9-482E-AD1F-4514435272E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AE49009F-B7D9-482E-AD1F-4514435272E1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AE49009F-B7D9-482E-AD1F-4514435272E1}.Debug|ARM.ActiveCfg = Debug|Any CPU + {AE49009F-B7D9-482E-AD1F-4514435272E1}.Debug|ARM.Build.0 = Debug|Any CPU + {AE49009F-B7D9-482E-AD1F-4514435272E1}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {AE49009F-B7D9-482E-AD1F-4514435272E1}.Debug|ARM64.Build.0 = Debug|Any CPU + {AE49009F-B7D9-482E-AD1F-4514435272E1}.Debug|x64.ActiveCfg = Debug|Any CPU + {AE49009F-B7D9-482E-AD1F-4514435272E1}.Debug|x64.Build.0 = Debug|Any CPU + {AE49009F-B7D9-482E-AD1F-4514435272E1}.Debug|x86.ActiveCfg = Debug|Any CPU + {AE49009F-B7D9-482E-AD1F-4514435272E1}.Debug|x86.Build.0 = Debug|Any CPU + {AE49009F-B7D9-482E-AD1F-4514435272E1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AE49009F-B7D9-482E-AD1F-4514435272E1}.Release|Any CPU.Build.0 = Release|Any CPU + {AE49009F-B7D9-482E-AD1F-4514435272E1}.Release|ARM.ActiveCfg = Release|Any CPU + {AE49009F-B7D9-482E-AD1F-4514435272E1}.Release|ARM.Build.0 = Release|Any CPU + {AE49009F-B7D9-482E-AD1F-4514435272E1}.Release|ARM64.ActiveCfg = Release|Any CPU + {AE49009F-B7D9-482E-AD1F-4514435272E1}.Release|ARM64.Build.0 = Release|Any CPU + {AE49009F-B7D9-482E-AD1F-4514435272E1}.Release|x64.ActiveCfg = Release|Any CPU + {AE49009F-B7D9-482E-AD1F-4514435272E1}.Release|x64.Build.0 = Release|Any CPU + {AE49009F-B7D9-482E-AD1F-4514435272E1}.Release|x86.ActiveCfg = Release|Any CPU + {AE49009F-B7D9-482E-AD1F-4514435272E1}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1622,6 +1644,7 @@ Global {1062F7C7-0117-413C-A45E-8F9B525FC036} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086} {8940F1E2-693D-407E-AD03-722718860609} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086} {1DA0F827-5F3D-4B87-9B51-6C0BF5365A3F} = {7B0175AD-BB74-4A98-B9A7-1E289032485E} + {AE49009F-B7D9-482E-AD1F-4514435272E1} = {1DA0F827-5F3D-4B87-9B51-6C0BF5365A3F} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC}