diff --git a/BPASmart.ConfigurationSoftware/MainWindowViewModel.cs b/BPASmart.ConfigurationSoftware/MainWindowViewModel.cs index 9756004a..3834b3e8 100644 --- a/BPASmart.ConfigurationSoftware/MainWindowViewModel.cs +++ b/BPASmart.ConfigurationSoftware/MainWindowViewModel.cs @@ -31,7 +31,7 @@ namespace BPASmart.ConfigurationSoftware OpenVarManagerCommand = new RelayCommand(() => { ServiceCenter.GetInstance.OpenVariableManagerTool(); }); SelectedPageCommand = new RelayCommand((o) => { ServiceCenter.GetInstance.SelectedPage(o); }); SaveProjectCommand = new RelayCommand(() => { ServiceCenter.GetInstance.ProjectSave(); }); - GengrateCommand = new RelayCommand(() => { ServiceCenter.GetInstance.ApplicationBale(); }); + GengrateCommand = new RelayCommand(() => { ServiceCenter.GetInstance.ApplicationBaleAsync(); }); RemovePageCommand = new RelayCommand((o) => { ServiceCenter.GetInstance.RemovePageCommand(o); }); ReNameCommand = new RelayCommand((o) => { ServiceCenter.GetInstance.ReNameCommand(o); }); SetStartPageCommand = new RelayCommand((o) => { ServiceCenter.GetInstance.SetStartPageCommand(o); }); diff --git a/BPASmart.ConfigurationSoftware/ServiceCenter.cs b/BPASmart.ConfigurationSoftware/ServiceCenter.cs index 8bbdb1cf..bed35097 100644 --- a/BPASmart.ConfigurationSoftware/ServiceCenter.cs +++ b/BPASmart.ConfigurationSoftware/ServiceCenter.cs @@ -282,34 +282,42 @@ namespace BPASmart.ConfigurationSoftware /// /// 应用程序打包程序 /// - public void ApplicationBale() + public async Task ApplicationBaleAsync() { - if (string.IsNullOrEmpty(FileConfigModel.ConstPath)) + await Task.Factory.StartNew(new Action(() => { - MessageLog.GetInstance.Show("打包路径不合法,打包失败"); - return; - } - MessageLog.GetInstance.Show("开始打包"); - string path = $"{FileConfigModel.ConstPath}\\Publish\\{Json.Data.ProjectName}"; - Directory.CreateDirectory(path); - MessageLog.GetInstance.Show($"打包路径:{path}"); - - //打包组件 - string dllPath = AppDomain.CurrentDomain.BaseDirectory; - if (Directory.Exists(dllPath)) CopyFolder(dllPath, $"{path}", new string[] { FileConfigModel.ConfigDirName, "Videos" }); - - //打包配置文件 - string ConfigFilePath = $"{FileConfigModel.ConstPath}\\{FileConfigModel.ConfigDirName}"; - if (Directory.Exists(ConfigFilePath)) CopyFolder(ConfigFilePath, $"{path}\\{FileConfigModel.ConfigDirName}"); - - //打包页面文件 - string pageFilePath = $"{FileConfigModel.ConstPath}\\{FileConfigModel.PageDirName}"; - if (Directory.Exists(pageFilePath)) CopyFolder(pageFilePath, $"{path}\\{FileConfigModel.PageDirName}"); - - //生成启动快捷方式 - //string createPath = $"{FileConfigModel.ConstPath}\\Publish\\{Json.Data.ProjectName}\\"; - //CreateShortcut($"{Json.Data.ProjectName}.exe", createPath); - MessageLog.GetInstance.Show("打包完成"); + if (string.IsNullOrEmpty(FileConfigModel.ConstPath)) + { + MessageLog.GetInstance.Show("打包路径不合法,打包失败"); + return; + } + + string publishPath = $"{FileConfigModel.ConstPath}\\Publish"; + if (Directory.Exists(publishPath)) + { + MessageLog.GetInstance.Show("清理旧数据"); + Directory.Delete(publishPath, true); + } + + MessageLog.GetInstance.Show("开始打包"); + string path = $"{FileConfigModel.ConstPath}\\Publish\\{Json.Data.ProjectName}"; + Directory.CreateDirectory(path); + MessageLog.GetInstance.Show($"打包路径:{path}"); + + //打包组件 + string dllPath = AppDomain.CurrentDomain.BaseDirectory; + if (Directory.Exists(dllPath)) CopyFolder(dllPath, $"{path}", new string[] { FileConfigModel.ConfigDirName, "Videos" }); + + //打包配置文件 + string ConfigFilePath = $"{FileConfigModel.ConstPath}\\{FileConfigModel.ConfigDirName}"; + if (Directory.Exists(ConfigFilePath)) CopyFolder(ConfigFilePath, $"{path}\\{FileConfigModel.ConfigDirName}"); + + //打包页面文件 + string pageFilePath = $"{FileConfigModel.ConstPath}\\{FileConfigModel.PageDirName}"; + if (Directory.Exists(pageFilePath)) CopyFolder(pageFilePath, $"{path}\\{FileConfigModel.PageDirName}"); + + MessageLog.GetInstance.Show("打包完成"); + })); } /// diff --git a/BPASmart.PageLoad/BPASmart.PageLoad.csproj b/BPASmart.PageLoad/BPASmart.PageLoad.csproj index dcc0f28d..3d96a976 100644 --- a/BPASmart.PageLoad/BPASmart.PageLoad.csproj +++ b/BPASmart.PageLoad/BPASmart.PageLoad.csproj @@ -7,20 +7,12 @@ true - - - - - - - - - + @@ -39,25 +31,4 @@ - - - - - - - - - - - - - - - $(DefaultXamlRuntime) - - - $(DefaultXamlRuntime) - - - diff --git a/BPASmart.PageLoad/Converters/ZoomConverter.cs b/BPASmart.PageLoad/Converters/ZoomConverter.cs deleted file mode 100644 index d69706c4..00000000 --- a/BPASmart.PageLoad/Converters/ZoomConverter.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Data; - - -namespace BPASmart.PageLoad.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/BPASmart.PageLoad/FControl/HBLControl.xaml b/BPASmart.PageLoad/FControl/HBLControl.xaml deleted file mode 100644 index ff3a0cfd..00000000 --- a/BPASmart.PageLoad/FControl/HBLControl.xaml +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 智能卓越 - - - - - - - - - - - - - - - - - diff --git a/BPASmart.PageLoad/FControl/HBLControl.xaml.cs b/BPASmart.PageLoad/FControl/HBLControl.xaml.cs deleted file mode 100644 index 49598e2e..00000000 --- a/BPASmart.PageLoad/FControl/HBLControl.xaml.cs +++ /dev/null @@ -1,37 +0,0 @@ -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 BPASmart.PageLoad.FControl -{ - /// - /// HBLControl.xaml 的交互逻辑 - /// - public partial class HBLControl : UserControl - { - public HBLControl() - { - InitializeComponent(); - } - 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/BPASmart.PageLoad/FControl/RunCanvas.xaml b/BPASmart.PageLoad/FControl/RunCanvas.xaml deleted file mode 100644 index fef21eee..00000000 --- a/BPASmart.PageLoad/FControl/RunCanvas.xaml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/BPASmart.PageLoad/FControl/RunCanvas.xaml.cs b/BPASmart.PageLoad/FControl/RunCanvas.xaml.cs deleted file mode 100644 index 9a6e220b..00000000 --- a/BPASmart.PageLoad/FControl/RunCanvas.xaml.cs +++ /dev/null @@ -1,135 +0,0 @@ -//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 BPASmart.PageLoad.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/BPASmart.PageLoad/Images/bj.png b/BPASmart.PageLoad/Images/bj.png deleted file mode 100644 index f6b621e0..00000000 Binary files a/BPASmart.PageLoad/Images/bj.png and /dev/null differ diff --git a/BPASmart.PageLoad/Images/fyf.ico b/BPASmart.PageLoad/Images/fyf.ico deleted file mode 100644 index 346bbc6c..00000000 Binary files a/BPASmart.PageLoad/Images/fyf.ico and /dev/null differ diff --git a/BPASmart.PageLoad/Images/logo-Text.png b/BPASmart.PageLoad/Images/logo-Text.png deleted file mode 100644 index e0e17a7c..00000000 Binary files a/BPASmart.PageLoad/Images/logo-Text.png and /dev/null differ diff --git a/BPASmart.PageLoad/Images/logo-pic.png b/BPASmart.PageLoad/Images/logo-pic.png deleted file mode 100644 index 3cc53241..00000000 Binary files a/BPASmart.PageLoad/Images/logo-pic.png and /dev/null differ diff --git a/BPASmart.PageLoad/Images/top_h.png b/BPASmart.PageLoad/Images/top_h.png deleted file mode 100644 index d23acad5..00000000 Binary files a/BPASmart.PageLoad/Images/top_h.png and /dev/null differ diff --git a/BPASmart.PageLoad/Images/椭圆 22 副本 2.png b/BPASmart.PageLoad/Images/椭圆 22 副本 2.png deleted file mode 100644 index 7c9bbca6..00000000 Binary files a/BPASmart.PageLoad/Images/椭圆 22 副本 2.png and /dev/null differ diff --git a/BPASmart.PageLoad/MainWindow.xaml b/BPASmart.PageLoad/MainWindow.xaml index bd8d5b4d..76e5f8ce 100644 --- a/BPASmart.PageLoad/MainWindow.xaml +++ b/BPASmart.PageLoad/MainWindow.xaml @@ -2,18 +2,16 @@ x:Class="BPASmart.PageLoad.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:ctrl="clr-namespace:BPASmart.PageLoad.FControl" + xmlns:ctrl="clr-namespace:BeDesignerSCADA.Controls;assembly=BeDesignerSCADA" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:BPASmart.PageLoad" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Title="MainWindow" Width="800" Height="450" + WindowState="Maximized" mc:Ignorable="d"> - - - diff --git a/BPASmart.PageLoad/MainWindow.xaml.cs b/BPASmart.PageLoad/MainWindow.xaml.cs index cf4235a4..f62ee79c 100644 --- a/BPASmart.PageLoad/MainWindow.xaml.cs +++ b/BPASmart.PageLoad/MainWindow.xaml.cs @@ -38,10 +38,10 @@ namespace BPASmart.PageLoad string path = $"{AppDomain.CurrentDomain.BaseDirectory}{FileConfigModel.PageDirName}\\{Serialization.Data.StartPageName}.lay"; if (File.Exists(path)) { - //MainCanvasPanel + runCanvas.LoadingData(path); } - runCanvas.Run(); + } } } diff --git a/BPASmart.Server/CommunicationServer.cs b/BPASmart.Server/CommunicationServer.cs index 8622d88b..a6eeb23c 100644 --- a/BPASmart.Server/CommunicationServer.cs +++ b/BPASmart.Server/CommunicationServer.cs @@ -14,6 +14,10 @@ namespace BPASmart.Server public void Init() { BPASmartClient.Message.MessageLog.GetInstance.ShowDebugLog("通讯模块初始化"); + MessageLog.GetInstance.NotifyShow = new Action((s) => + { + BPASmartClient.Message.MessageLog.GetInstance.ShowDebugLog(s); + }); RedisHelper.GetInstance.ConnectAsync("124.222.238.75", 16000, "123456", 1); MqttInit(); Json.Data.CommunicationDevices.ToList()?.ForEach(item =>