@@ -31,7 +31,7 @@ namespace BPASmart.ConfigurationSoftware | |||
OpenVarManagerCommand = new RelayCommand(() => { ServiceCenter.GetInstance.OpenVariableManagerTool(); }); | |||
SelectedPageCommand = new RelayCommand<object>((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<object>((o) => { ServiceCenter.GetInstance.RemovePageCommand(o); }); | |||
ReNameCommand = new RelayCommand<object>((o) => { ServiceCenter.GetInstance.ReNameCommand(o); }); | |||
SetStartPageCommand = new RelayCommand<object>((o) => { ServiceCenter.GetInstance.SetStartPageCommand(o); }); | |||
@@ -282,34 +282,42 @@ namespace BPASmart.ConfigurationSoftware | |||
/// <summary> | |||
/// 应用程序打包程序 | |||
/// </summary> | |||
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<ProjectModel>.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<ProjectModel>.Data.ProjectName}\\"; | |||
//CreateShortcut($"{Json<ProjectModel>.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<ProjectModel>.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("打包完成"); | |||
})); | |||
} | |||
/// <summary> | |||
@@ -7,20 +7,12 @@ | |||
<UseWPF>true</UseWPF> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<None Remove="Images\bj.png" /> | |||
<None Remove="Images\fyf.ico" /> | |||
<None Remove="Images\logo-pic.png" /> | |||
<None Remove="Images\logo-Text.png" /> | |||
<None Remove="Images\top_h.png" /> | |||
<None Remove="Images\椭圆 22 副本 2.png" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Helper" Version="1.0.11" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BeDesignerSCADA\BeDesignerSCADA.csproj" /> | |||
<ProjectReference Include="..\BPASmart.Model\BPASmart.Model.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.MessageCommunication\BPASmartClient.MessageCommunication.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.MessageName\BPASmartClient.MessageName.csproj" /> | |||
@@ -39,25 +31,4 @@ | |||
</Reference> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Resource Include="Images\fyf.ico" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Resource Include="Images\bj.png" /> | |||
<Resource Include="Images\logo-pic.png" /> | |||
<Resource Include="Images\logo-Text.png" /> | |||
<Resource Include="Images\top_h.png" /> | |||
<Resource Include="Images\椭圆 22 副本 2.png" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Page Update="FControl\HBLControl.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
</Page> | |||
<Page Update="FControl\RunCanvas.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
</Page> | |||
</ItemGroup> | |||
</Project> |
@@ -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; | |||
} | |||
} | |||
} |
@@ -1,144 +0,0 @@ | |||
<UserControl x:Class="BPASmart.PageLoad.FControl.HBLControl" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmart.PageLoad.FControl" | |||
mc:Ignorable="d" | |||
d:DesignHeight="140" d:DesignWidth="140"> | |||
<UserControl.Resources> | |||
<ResourceDictionary> | |||
<LinearGradientBrush x:Key="yanjing" EndPoint="0,1"> | |||
<GradientStop Color="#CC00EAFF" Offset="0.08"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.08"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.16"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.16"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.24"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.24"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.32"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.32"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.40"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.40"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.48"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.48"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.56"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.56"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.64"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.64"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.72"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.72"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.80"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.80"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.88"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.88"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.96"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.96"></GradientStop> | |||
</LinearGradientBrush> | |||
<Storyboard x:Key="Storyboard1" RepeatBehavior="Forever"> | |||
<PointAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.StartPoint)" | |||
Storyboard.TargetName="rectangle"> | |||
<EasingPointKeyFrame KeyTime="0:0:0.5" Value="0.855,0.148"/> | |||
<EasingPointKeyFrame KeyTime="0:0:1" Value="0.852,0.855"/> | |||
<EasingPointKeyFrame KeyTime="0:0:1.5" Value="0.148,0.855"/> | |||
<EasingPointKeyFrame KeyTime="0:0:2" Value="0.144,0.149"/> | |||
<EasingPointKeyFrame KeyTime="0:0:2.5" Value="0,0"/> | |||
<EasingPointKeyFrame KeyTime="0:0:3" Value="0.855,0.148"/> | |||
<EasingPointKeyFrame KeyTime="0:0:3.5" Value="0.852,0.855"/> | |||
<EasingPointKeyFrame KeyTime="0:0:4" Value="0.148,0.855"/> | |||
<EasingPointKeyFrame KeyTime="0:0:4.5" Value="0.144,0.149"/> | |||
<EasingPointKeyFrame KeyTime="0:0:5" Value="0,0"/> | |||
</PointAnimationUsingKeyFrames> | |||
<PointAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.EndPoint)" | |||
Storyboard.TargetName="rectangle"> | |||
<EasingPointKeyFrame KeyTime="0:0:0.5" Value="0.145,0.852"/> | |||
<EasingPointKeyFrame KeyTime="0:0:1" Value="0.148,0.145"/> | |||
<EasingPointKeyFrame KeyTime="0:0:1.5" Value="0.852,0.145"/> | |||
<EasingPointKeyFrame KeyTime="0:0:2" Value="0.856,0.851"/> | |||
<EasingPointKeyFrame KeyTime="0:0:2.5" Value="0,1"/> | |||
<EasingPointKeyFrame KeyTime="0:0:3" Value="0.145,0.852"/> | |||
<EasingPointKeyFrame KeyTime="0:0:3.5" Value="0.148,0.145"/> | |||
<EasingPointKeyFrame KeyTime="0:0:4" Value="0.852,0.145"/> | |||
<EasingPointKeyFrame KeyTime="0:0:4.5" Value="0.856,0.851"/> | |||
<EasingPointKeyFrame KeyTime="0:0:5" Value="0,1"/> | |||
</PointAnimationUsingKeyFrames> | |||
<ColorAnimationUsingKeyFrames Storyboard.TargetName="rectangle" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[1].(GradientStop.Color)"> | |||
<EasingColorKeyFrame KeyTime="00:00:02" Value="Lime"/> | |||
<EasingColorKeyFrame KeyTime="00:00:02.5000000" Value="#FF075AFF"/> | |||
<EasingColorKeyFrame KeyTime="00:00:4.5" Value="Lime"/> | |||
<EasingColorKeyFrame KeyTime="00:00:5" Value="#FF075AFF"/> | |||
</ColorAnimationUsingKeyFrames> | |||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="ico_map"> | |||
<EasingDoubleKeyFrame KeyTime="0:0:2.5" Value="-180"/> | |||
<EasingDoubleKeyFrame KeyTime="0:0:5" Value="-360"/> | |||
</DoubleAnimationUsingKeyFrames> | |||
</Storyboard> | |||
<Storyboard x:Key="StoryboardZY" RepeatBehavior="Forever"> | |||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="border"> | |||
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="12"/> | |||
<EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="6"/> | |||
<EasingDoubleKeyFrame KeyTime="0:0:1.4" Value="12"/> | |||
<EasingDoubleKeyFrame KeyTime="0:0:3" Value="12"/> | |||
</DoubleAnimationUsingKeyFrames> | |||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="border1"> | |||
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="12"/> | |||
<EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="6"/> | |||
<EasingDoubleKeyFrame KeyTime="0:0:1.4" Value="12"/> | |||
<EasingDoubleKeyFrame KeyTime="0:0:3" Value="12"/> | |||
</DoubleAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</ResourceDictionary> | |||
</UserControl.Resources> | |||
<UserControl.Triggers> | |||
<EventTrigger RoutedEvent="FrameworkElement.Loaded"> | |||
<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/> | |||
<BeginStoryboard Storyboard="{StaticResource StoryboardZY}"/> | |||
</EventTrigger> | |||
</UserControl.Triggers> | |||
<Grid Width="100" Height="100" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="20"> | |||
<Image x:Name="ico_map" Width="85" Height="85" UseLayoutRounding="True" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="HighQuality" Source="/Images/椭圆 22 副本 2.png" RenderTransformOrigin="0.5,0.5" > | |||
<Image.RenderTransform> | |||
<TransformGroup> | |||
<ScaleTransform/> | |||
<SkewTransform/> | |||
<RotateTransform/> | |||
<TranslateTransform/> | |||
</TransformGroup> | |||
</Image.RenderTransform> | |||
</Image> | |||
<Image HorizontalAlignment="Center" Margin="0,90,0,0" UseLayoutRounding="True" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="HighQuality" VerticalAlignment="Top" Width="100" Height="20" Source="/Images/top_h.png" /> | |||
<Grid x:Name="grid_xiaoboluo" Width="100" Height="100" MouseEnter="grid_MouseEnter" MouseLeave="grid_MouseLeave"> | |||
<Grid> | |||
<Ellipse x:Name="rectangle" Width="70" Height="70" StrokeThickness="4" Fill="#FF022E50"> | |||
<Ellipse.Stroke> | |||
<LinearGradientBrush Opacity="1"> | |||
<GradientStop Color="Transparent" Offset="0"/> | |||
<GradientStop Color="#FF075AFF" Offset="1"/> | |||
</LinearGradientBrush> | |||
</Ellipse.Stroke> | |||
</Ellipse> | |||
<Image x:Name="ico" UseLayoutRounding="True" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="HighQuality" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="-20,25,0,0" Width="25" Height="30" Source="/Images/logo-pic.png" /> | |||
<Image Width="31.6" UseLayoutRounding="True" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="HighQuality" Height="7.9" Margin="20,0,0,25" Source="/Images/logo-Text.png" /> | |||
<TextBlock Margin="0,24,0,0" UseLayoutRounding="True" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="HighQuality" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14" Foreground="#FF00EAFF" FontFamily="黑体" FontWeight="Bold">智能卓越</TextBlock> | |||
</Grid> | |||
<Grid x:Name="grid_celine" Visibility="Collapsed"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition></ColumnDefinition> | |||
<ColumnDefinition></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<Ellipse Grid.ColumnSpan="2" Width="70" Height="70" Fill="#2571ac" ></Ellipse> | |||
<Grid x:Name="yanjing_move" Grid.ColumnSpan="2" Width="35" Height="35"> | |||
<Grid > | |||
<Border x:Name="border1" HorizontalAlignment="Left" Grid.Column="0" Background="{DynamicResource yanjing}" CornerRadius="2" Width="8" Height="12"/> | |||
<Border x:Name="border" HorizontalAlignment="Right" Grid.Column="1" Background="{DynamicResource yanjing}" CornerRadius="2" Width="8" Height="12"/> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
</UserControl> |
@@ -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 | |||
{ | |||
/// <summary> | |||
/// HBLControl.xaml 的交互逻辑 | |||
/// </summary> | |||
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; | |||
} | |||
} | |||
} |
@@ -1,32 +0,0 @@ | |||
<UserControl x:Class="BPASmart.PageLoad.FControl.RunCanvas" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmart.PageLoad.FControl" | |||
xmlns:con="clr-namespace:BPASmart.PageLoad.Converters" | |||
mc:Ignorable="d" | |||
d:DesignHeight="450" d:DesignWidth="800"> | |||
<UserControl.Resources> | |||
<con:ZoomConverter x:Key="ZoomX" IsHeight="False"/> | |||
<con:ZoomConverter x:Key="ZoomY" IsHeight="True"/> | |||
</UserControl.Resources> | |||
<Grid ClipToBounds="True"> | |||
<Canvas x:Name="RootCanvas" ClipToBounds="True" Background="Transparent" MouseLeftButtonUp="RootCanvas_MouseLeftButtonUp" | |||
MouseMove="RootCanvas_MouseMove" MouseLeftButtonDown="RootCanvas_MouseLeftButtoDown" MouseWheel="RootCanvas_MouseWheel"> | |||
<Canvas.RenderTransform> | |||
<TransformGroup> | |||
<ScaleTransform x:Name="Scale"/> | |||
<TranslateTransform x:Name="Translate"/> | |||
</TransformGroup> | |||
</Canvas.RenderTransform> | |||
</Canvas> | |||
<Grid VerticalAlignment="Bottom" Background="#4B959595"> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="8 0"> | |||
<CheckBox x:Name="DragEnable" Content="拖动" Margin="4"/> | |||
<CheckBox x:Name="ZoomEnable" Content="缩放" Margin="4"/> | |||
</StackPanel> | |||
</Grid> | |||
</Grid> | |||
</UserControl> |
@@ -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 | |||
{ | |||
/// <summary> | |||
/// RunCanvas.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class RunCanvas : UserControl | |||
{ | |||
public RunCanvas() | |||
{ | |||
InitializeComponent(); | |||
Unloaded += (s, e) => Destory(); | |||
} | |||
/// <summary> | |||
/// Dispose子集 | |||
/// </summary> | |||
public void Destory() | |||
{ | |||
foreach (var item in RootCanvas.Children) | |||
{ | |||
if (item is IDisposable disposable) | |||
{ | |||
disposable.Dispose(); | |||
} | |||
} | |||
} | |||
public List<EventReceiveMessage> Run(List<FrameworkElement> canvas) | |||
{ | |||
List<EventReceiveMessage> messages = new List<EventReceiveMessage>(); | |||
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 | |||
} | |||
} |
@@ -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"> | |||
<Grid> | |||
<Grid.Background> | |||
<ImageBrush ImageSource="/Images/bj.png" /> | |||
</Grid.Background> | |||
<ctrl:RunCanvas x:Name="runCanvas" /> | |||
</Grid> | |||
</Window> |
@@ -38,10 +38,10 @@ namespace BPASmart.PageLoad | |||
string path = $"{AppDomain.CurrentDomain.BaseDirectory}{FileConfigModel.PageDirName}\\{Serialization<BinConfigFile>.Data.StartPageName}.lay"; | |||
if (File.Exists(path)) | |||
{ | |||
//MainCanvasPanel | |||
runCanvas.LoadingData(path); | |||
} | |||
runCanvas.Run(); | |||
} | |||
} | |||
} | |||
@@ -14,6 +14,10 @@ namespace BPASmart.Server | |||
public void Init() | |||
{ | |||
BPASmartClient.Message.MessageLog.GetInstance.ShowDebugLog("通讯模块初始化"); | |||
MessageLog.GetInstance.NotifyShow = new Action<string>((s) => | |||
{ | |||
BPASmartClient.Message.MessageLog.GetInstance.ShowDebugLog(s); | |||
}); | |||
RedisHelper.GetInstance.ConnectAsync("124.222.238.75", 16000, "123456", 1); | |||
MqttInit(); | |||
Json<CommunicationPar>.Data.CommunicationDevices.ToList()?.ForEach(item => | |||