Преглед на файлове

上位机设计框架搭建

样式分支
pry преди 2 години
родител
ревизия
6426aef4db
променени са 29 файла, в които са добавени 1724 реда и са изтрити 746 реда
  1. +8
    -0
      BPASmart.ConfigurationSoftware/App.xaml
  2. +17
    -0
      BPASmart.ConfigurationSoftware/App.xaml.cs
  3. +10
    -0
      BPASmart.ConfigurationSoftware/AssemblyInfo.cs
  4. +28
    -0
      BPASmart.ConfigurationSoftware/BPASmart.ConfigurationSoftware.csproj
  5. +207
    -0
      BPASmart.ConfigurationSoftware/MainWindow.xaml
  6. +31
    -0
      BPASmart.ConfigurationSoftware/MainWindow.xaml.cs
  7. +93
    -0
      BPASmart.ConfigurationSoftware/MainWindowViewModel.cs
  8. +19
    -0
      BPASmart.ConfigurationSoftware/Model/NewDataModel.cs
  9. +54
    -0
      BPASmart.ConfigurationSoftware/NewPageView.xaml
  10. +45
    -0
      BPASmart.ConfigurationSoftware/NewPageView.xaml.cs
  11. +73
    -0
      BPASmart.ConfigurationSoftware/NewProjectView.xaml
  12. +41
    -0
      BPASmart.ConfigurationSoftware/NewProjectView.xaml.cs
  13. +56
    -0
      BPASmart.ConfigurationSoftware/NewProjectViewModel.cs
  14. +3
    -0
      BPASmart.Model/Config/CommunicationPar.cs
  15. +29
    -0
      BPASmart.Model/Config/ConnectPar.cs
  16. +0
    -0
      BPASmart.Model/MQTT/PublishInfo.cs
  17. +0
    -0
      BPASmart.Model/MQTT/PublishModel.cs
  18. +1
    -0
      BPASmart.Model/NoticeBase.cs
  19. +26
    -0
      BPASmart.Model/Topics.cs
  20. +33
    -210
      BPASmart.Server/CommunicationServer.cs
  21. +9
    -0
      BPASmart.SmallBatchingSystem/BPASmart.SmallBatchingSystem.csproj
  22. +44
    -0
      BPASmart.SmallBatchingSystem/DataModel.cs
  23. +14
    -0
      BPASmart.SmallBatchingSystem/Main.cs
  24. +104
    -77
      BPASmartClient.CustomResource/Pages/View/NfcSetView.xaml
  25. +420
    -272
      BPASmartClient.SCADAControl/Themes/Generic.xaml
  26. +7
    -8
      BeDesignerSCADA/App.xaml
  27. +36
    -19
      BeDesignerSCADA/Controls/RunCanvas.xaml
  28. +270
    -160
      BeDesignerSCADA/Themes/Styles.xaml
  29. +46
    -0
      SmartClient.sln

+ 8
- 0
BPASmart.ConfigurationSoftware/App.xaml Целия файл

@@ -0,0 +1,8 @@
<Application
x:Class="BPASmart.ConfigurationSoftware.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:BPASmart.ConfigurationSoftware"
StartupUri="MainWindow.xaml">
<Application.Resources />
</Application>

+ 17
- 0
BPASmart.ConfigurationSoftware/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 BPASmart.ConfigurationSoftware
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

+ 10
- 0
BPASmart.ConfigurationSoftware/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)
)]

+ 28
- 0
BPASmart.ConfigurationSoftware/BPASmart.ConfigurationSoftware.csproj Целия файл

@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.7" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BeDesignerSCADA\BeDesignerSCADA.csproj" />
<ProjectReference Include="..\BPASmart.DataServer\BPASmart.DataServer.csproj" />
<ProjectReference Include="..\BPASmart.Model\BPASmart.Model.csproj" />
<ProjectReference Include="..\BPASmart.RecipeManagement\BPASmart.RecipeManagement.csproj" />
<ProjectReference Include="..\BPASmart.VariableManager\BPASmart.VariableManager.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="ViewModel\" />
<Folder Include="View\" />
</ItemGroup>

</Project>

+ 207
- 0
BPASmart.ConfigurationSoftware/MainWindow.xaml Целия файл

@@ -0,0 +1,207 @@
<Window
x:Class="BPASmart.ConfigurationSoftware.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmart.ConfigurationSoftware"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="MainWindow"
Width="800"
Height="450"
Topmost="False"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">

<Window.DataContext>
<local:MainWindowViewModel />
</Window.DataContext>

<Window.Resources>

<!--#region 下拉列表单选按钮样式-->
<Style x:Key="RadioMiniButtonStyle" TargetType="{x:Type RadioButton}">
<Setter Property="Margin" Value="20,1,1,1" />
<!--<Setter Property="Width" Value="160" />-->
<!--<Setter Property="Height" Value="30" />-->
<Setter Property="FontSize" Value="14" />
<Setter Property="FontFamily" Value="粗体" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="left" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Background" Value="#ddd" />
<Setter Property="HorizontalAlignment" Value="left" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Grid
x:Name="templateRoot"
Background="Transparent"
SnapsToDevicePixels="True">
<Border x:Name="border2" />
<ContentPresenter
x:Name="contentPresenter"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Focusable="False"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />

</Grid>
<ControlTemplate.Triggers>
<Trigger Property="HasContent" Value="True">
<Setter Property="FocusVisualStyle">
<Setter.Value>
<Style>
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle
Margin="14,0,0,0"
SnapsToDevicePixels="True"
Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
StrokeDashArray="1 2"
StrokeThickness="1" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="Padding" Value="4,-1,0,0" />
</Trigger>
<Trigger Property="IsChecked" Value="{x:Null}" />

<Trigger Property="IsChecked" Value="true">
<!--<Setter Property="Foreground" Value="White" />-->
<Setter TargetName="border2" Property="Background" Value="red" />
</Trigger>

<Trigger Property="IsChecked" Value="false">
<Setter TargetName="border2" Property="Background" Value="Transparent" />
<!--<Setter Property="Foreground" Value="#4B8EC4" />-->
</Trigger>

<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="false" />
<Condition Property="IsMouseOver" Value="True" />
</MultiTrigger.Conditions>
<MultiTrigger.Setters>
<Setter TargetName="border2" Property="Background" Value="#55007acc" />
</MultiTrigger.Setters>
</MultiTrigger>

</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

</Window.Resources>

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition />
</Grid.RowDefinitions>

<StackPanel Orientation="Horizontal">
<Button
Width="60"
Margin="5"
Command="{Binding NewCommand}"
Content="新建" />

<Button
Width="60"
Margin="5"
Command="{Binding NewCommand}"
Content="保存" />

<Button
Width="60"
Margin="5"
Command="{Binding}"
Content="打开" />

<Button
Width="60"
Margin="5"
Content="运行" />

<Button
Width="60"
Margin="5"
Command="{Binding OpenVarManagerCommand}"
Content="变量管理" />
</StackPanel>

<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="20" />
<RowDefinition />
</Grid.RowDefinitions>

<TextBlock
Margin="5,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Text="{Binding Head}">
<TextBlock.ContextMenu>
<ContextMenu>
<MenuItem Command="{Binding NewPageCommand}" Header="新建页面" />
</ContextMenu>
</TextBlock.ContextMenu>
</TextBlock>

<ScrollViewer
Grid.Row="1"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding Pages}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<RadioButton
Command="{Binding DataContext.SelectedCommand, RelativeSource={RelativeSource AncestorType=Window, Mode=FindAncestor}}"
CommandParameter="{Binding}"
Content="{Binding}"
GroupName="All"
Style="{StaticResource RadioMiniButtonStyle}">
<RadioButton.ContextMenu>
<ContextMenu>
<MenuItem Header="删除页面" />
<MenuItem Header="设为启动界面" />
<MenuItem Header="重命名" />
</ContextMenu>
</RadioButton.ContextMenu>
</RadioButton>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>

<Canvas Name="cav" Grid.Column="1" Grid.Row="1">

</Canvas>

</Grid>



</Grid>
</Window>

+ 31
- 0
BPASmart.ConfigurationSoftware/MainWindow.xaml.cs Целия файл

@@ -0,0 +1,31 @@
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.ConfigurationSoftware
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();

}


}
}

+ 93
- 0
BPASmart.ConfigurationSoftware/MainWindowViewModel.cs Целия файл

@@ -0,0 +1,93 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPASmart.Model;
using Microsoft.Toolkit.Mvvm.Input;
using System.Collections.ObjectModel;
using System.Windows.Forms;
using System.IO;
using BPA.Helper;
using System.Diagnostics;
using BeDesignerSCADA;

namespace BPASmart.ConfigurationSoftware
{
public class MainWindowViewModel : NoticeBase
{
string LayoutPath
{
get
{
Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"AccessFile\\Layouts"));
return $"{AppDomain.CurrentDomain.BaseDirectory}AccessFile\\Layouts\\";
}
}

public MainWindowViewModel()
{
ActionManage.GetInstance.Register(new Action<object>((o) =>
{
Pages.Add(o.ToString());
File.WriteAllText(LayoutPath + o.ToString(), null, Encoding.Unicode);
}), "PageName");
NewCommand = new RelayCommand(() =>
{
NewProjectView newProjectView = new NewProjectView();
bool? result = newProjectView.ShowDialog();
if (result != null && result == true)
{
if (newProjectView.Tag != null && newProjectView.Tag is NewDataModel objModel)
{
Directory.CreateDirectory(Path.Combine(objModel.ProjectPath, objModel.ProjectName));
Head = objModel.ProjectName;
}
}
});

NewPageCommand = new RelayCommand(() =>
{
NewPageView newPageView = new NewPageView();
newPageView.ShowDialog();
});

OpenVarManagerCommand = new RelayCommand(() =>
{
string path = $"{AppDomain.CurrentDomain.BaseDirectory}BPASmart.VariableManager.exe";
if (File.Exists(path))
{
Process[] pro = Process.GetProcesses();
if (pro?.ToList().FirstOrDefault(p => p.ProcessName.Contains("BPASmart.VariableManager")) == null)
{
Process.Start(path);
}
}
});

SelectedCommand = new RelayCommand<object>((o) =>
{

});
}

public RelayCommand NewCommand { get; set; }

public RelayCommand OpenVarManagerCommand { get; set; }

public RelayCommand<object> SelectedCommand { get; set; }

public RelayCommand SaveCommand { get; set; }

public RelayCommand NewPageCommand { get; set; }

public string Head { get { return _mHead; } set { _mHead = value; OnPropertyChanged(); } }
private string _mHead;

//public ObservableCollection<MainCanvasPanel>

public ObservableCollection<string> Pages { get; set; } = new ObservableCollection<string>();


}
}

+ 19
- 0
BPASmart.ConfigurationSoftware/Model/NewDataModel.cs Целия файл

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPASmart.Model;

namespace BPASmart.ConfigurationSoftware
{
public class NewDataModel : NoticeBase
{
public string ProjectName { get { return _mProjectName; } set { _mProjectName = value; OnPropertyChanged(); } }
private string _mProjectName;


public string ProjectPath { get { return _mProjectPath; } set { _mProjectPath = value; OnPropertyChanged(); } }
private string _mProjectPath;
}
}

+ 54
- 0
BPASmart.ConfigurationSoftware/NewPageView.xaml Целия файл

@@ -0,0 +1,54 @@
<Window
x:Class="BPASmart.ConfigurationSoftware.NewPageView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmart.ConfigurationSoftware"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="新建页面"
Width="300"
Height="180"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<TextBlock
Margin="0,0,0,5"
VerticalAlignment="Bottom"
Text="页面名称:" />
<TextBox
Name="pageName"
Grid.Row="1"
Height="30"
VerticalAlignment="Top"
FontSize="16"
Text="{Binding NewData.ProjectName}" />


<Grid Grid.Row="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="35*" />
<ColumnDefinition Width="32*" />
<ColumnDefinition Width="3*" />
</Grid.ColumnDefinitions>

<Button Margin="10,2,10,2" Content="创建" Click="Button_Click_1" />
<Button
Grid.Column="1"
Grid.ColumnSpan="2"
Margin="10,2,10,2"
Content="取消" Click="Button_Click" />

</Grid>


</Grid>

</Window>

+ 45
- 0
BPASmart.ConfigurationSoftware/NewPageView.xaml.cs Целия файл

@@ -0,0 +1,45 @@
using BPA.Helper;
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.Shapes;

namespace BPASmart.ConfigurationSoftware
{
/// <summary>
/// NewPageView.xaml 的交互逻辑
/// </summary>
public partial class NewPageView : Window
{
public NewPageView()
{
InitializeComponent();
}

private void Button_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
this.Close();
}

private void Button_Click_1(object sender, RoutedEventArgs e)
{
if (this.pageName.Text.Trim().Length > 0)
{
this.DialogResult = true;
ActionManage.GetInstance.Send("PageName", this.pageName.Text);
this.Close();
}

}
}
}

+ 73
- 0
BPASmart.ConfigurationSoftware/NewProjectView.xaml Целия файл

@@ -0,0 +1,73 @@
<Window
x:Class="BPASmart.ConfigurationSoftware.NewProjectView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmart.ConfigurationSoftware"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="创建新项目"
Width="300"
Height="180"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">


<Window.DataContext>
<local:NewProjectViewModel />
</Window.DataContext>

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<TextBlock VerticalAlignment="Center" Text="项目名称:" />
<TextBox
Grid.Row="1"
VerticalAlignment="Center"
Text="{Binding NewData.ProjectName}" />

<TextBlock
Grid.Row="2"
VerticalAlignment="Center"
Text="项目路径:" />
<Grid Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="30" />
</Grid.ColumnDefinitions>
<TextBlock VerticalAlignment="Center" Text="{Binding NewData.ProjectPath}" />
<Button
Grid.Column="1"
VerticalAlignment="Center"
Command="{Binding OpenBrowserDialogCommand}"
Content="..." />
</Grid>

<Grid Grid.Row="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="35*" />
<ColumnDefinition Width="32*" />
<ColumnDefinition Width="3*" />
</Grid.ColumnDefinitions>

<Button
Margin="10,2,10,2"
Command="{Binding CreateCommand}"
Content="创建" />
<Button
Grid.Column="1"
Grid.ColumnSpan="2"
Margin="10,2,10,2"
Command="{Binding CancelCommand}"
Content="取消" />

</Grid>


</Grid>
</Window>

+ 41
- 0
BPASmart.ConfigurationSoftware/NewProjectView.xaml.cs Целия файл

@@ -0,0 +1,41 @@
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.Shapes;
using BPA.Helper;

namespace BPASmart.ConfigurationSoftware
{
/// <summary>
/// NewProjectView.xaml 的交互逻辑
/// </summary>
public partial class NewProjectView : Window
{
public NewProjectView()
{
InitializeComponent();
ActionManage.GetInstance.Register(new Action<object>((o) =>
{
this.DialogResult = true;
this.Tag = o;
this.Close();
}), "CreateCommand", true);
ActionManage.GetInstance.Register(new Action(() =>
{
this.DialogResult = false;
this.Close();
}), "CancelCommand", true);
}


}
}

+ 56
- 0
BPASmart.ConfigurationSoftware/NewProjectViewModel.cs Целия файл

@@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPASmart.Model;
using Microsoft.Toolkit.Mvvm.Input;
using System.Windows;
using BPA.Helper;
using System.Windows.Forms;
namespace BPASmart.ConfigurationSoftware
{
public class NewProjectViewModel : NoticeBase
{
public NewProjectViewModel()
{
OpenBrowserDialogCommand = new RelayCommand(() =>
{
FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
{
NewData.ProjectPath = folderBrowserDialog.SelectedPath;
}
});

CreateCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("CreateCommand", NewData);
});

CancelCommand = new RelayCommand(() => { ActionManage.GetInstance.Send("CancelCommand"); });

}



public NewDataModel NewData { get { return _mNewData; } set { _mNewData = value; OnPropertyChanged(); } }
private NewDataModel _mNewData = new NewDataModel();



//public string ProjectName { get { return _mProjectName; } set { _mProjectName = value; OnPropertyChanged(); } }
//private string _mProjectName;


//public string ProjectPath { get { return _mProjectPath; } set { _mProjectPath = value; OnPropertyChanged(); } }
//private string _mProjectPath;

public RelayCommand CreateCommand { get; set; }

public RelayCommand OpenBrowserDialogCommand { get; set; }

public RelayCommand CancelCommand { get; set; }

}
}

BPASmart.Model/CommunicationPar.cs → BPASmart.Model/Config/CommunicationPar.cs Целия файл

@@ -7,6 +7,9 @@ using System.Collections.ObjectModel;

namespace BPASmart.Model
{
/// <summary>
/// 通讯参数配置
/// </summary>
public class CommunicationPar
{
public ObservableCollection<CommunicationModel> CommunicationDevices { get; set; } = new ObservableCollection<CommunicationModel>();

+ 29
- 0
BPASmart.Model/Config/ConnectPar.cs Целия файл

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmart.Model
{
/// <summary>
/// 连接参数
/// </summary>
public class ConnectPar
{
#region Redis 连接信息
public string Redis_Host { get; set; }
public int Redis_Port { get; set; }
public string Redis_Password { get; set; }
public int Redis_DB { get; set; }
#endregion

#region MQTT 连接信息
public string MQTT_IP { get; set; }
public int MQTT_Port { get; set; }
public string MQTT_UserName { get; set; }
public string MQTT_Password { get; set; }
#endregion

}
}

BPASmart.Model/PublishInfo.cs → BPASmart.Model/MQTT/PublishInfo.cs Целия файл


BPASmart.Model/PublishModel.cs → BPASmart.Model/MQTT/PublishModel.cs Целия файл


+ 1
- 0
BPASmart.Model/NoticeBase.cs Целия файл

@@ -11,5 +11,6 @@ namespace BPASmart.Model
{
public class NoticeBase : ObservableObject
{

}
}

+ 26
- 0
BPASmart.Model/Topics.cs Целия файл

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmart.Model
{
public class Topics
{
/// <summary>
/// 设备控制主题
/// </summary>
public const string DeviceControl = "DistributedHostComputer/Control";

/// <summary>
/// 配方下发主题
/// </summary>
public const string RecipeIssued = "DistributedHostComputer/RecipeIssued";

/// <summary>
/// 业务主题下发
/// </summary>
public const string Business = "DistributedHostComputer/Business";
}
}

+ 33
- 210
BPASmart.Server/CommunicationServer.cs Целия файл

@@ -19,7 +19,6 @@ namespace BPASmart.Server
MqttInit();
Json<CommunicationPar>.Data.CommunicationDevices.ToList()?.ForEach(item =>
{

ThreadManage.GetInstance().Start(new Action(() =>
{
switch (item.CommDevice)
@@ -35,82 +34,38 @@ namespace BPASmart.Server
ThreadManage.GetInstance().StartLong(new Action(() =>
{
item.VarTableModels.GetReadDataModels().ToList()?.ForEach(temp =>
{
//switch (temp.Key)
//{
// case EDataType.Bool:
// temp.Value?.ForEach(value =>
// {
// //var res = modbusTcpMaster.ReadBool(value.StartAddress.ToString(), value.Length);
// var res = modbusTcpMaster.Read<bool[]>(value.StartAddress.ToString(), value.Length);
// SetValue(res.Content, item.DeviceName, value, 1);
// });
// break;
// case EDataType.Byte:
// break;
// case EDataType.Int:
// break;
// case EDataType.Word:
// temp.Value?.ForEach(value =>
// {
// //var res = modbusTcpMaster.ReadUshort(value.StartAddress.ToString(), value.Length);
// var res = modbusTcpMaster.Read<ushort[]>(value.StartAddress.ToString(), value.Length);
// SetValue(res.Content, item.DeviceName, value, 1);
// });
// break;
// case EDataType.Dint:
// break;
// case EDataType.Dword:
// temp.Value?.ForEach(value =>
// {
// //var res = modbusTcpMaster.ReadUint(value.StartAddress.ToString(), value.Length);
// var res = modbusTcpMaster.Read<uint[]>(value.StartAddress.ToString(), value.Length);
// SetValue(res.Content, item.DeviceName, value, 2);
// });
// break;
// case EDataType.Float:
// temp.Value?.ForEach(value =>
// {
// //var res = modbusTcpMaster.ReadFloat(value.StartAddress.ToString(), value.Length);
// var res = modbusTcpMaster.Read<float[]>(value.StartAddress.ToString(), value.Length);
// SetValue(res.Content, item.DeviceName, value, 2);
// });
// break;
// default:
// break;
//}

Array ResultArray = null;
temp.Value?.ForEach(value =>
{
switch (temp.Key)
{
case EDataType.Bool:
ResultArray = modbusTcpMaster.Read<bool[]>(value.StartAddress.ToString(), value.Length)?.Content;
break;
case EDataType.Byte:
break;
case EDataType.Int:
ResultArray = modbusTcpMaster.Read<short[]>(value.StartAddress.ToString(), value.Length)?.Content;
break;
case EDataType.Word:
ResultArray = modbusTcpMaster.Read<ushort[]>(value.StartAddress.ToString(), value.Length)?.Content;
break;
case EDataType.Dint:
ResultArray = modbusTcpMaster.Read<int[]>(value.StartAddress.ToString(), value.Length)?.Content;
break;
case EDataType.Dword:
ResultArray = modbusTcpMaster.Read<uint[]>(value.StartAddress.ToString(), value.Length)?.Content;
break;
case EDataType.Float:
ResultArray = modbusTcpMaster.Read<float[]>(value.StartAddress.ToString(), value.Length)?.Content;
break;
default:
break;
}
SetValue(ResultArray, item.DeviceName, value, temp.Key);
});
});
{
Array ResultArray = null;
temp.Value?.ForEach(value =>
{
switch (temp.Key)
{
case EDataType.Bool:
ResultArray = modbusTcpMaster.Read<bool[]>(value.StartAddress.ToString(), value.Length)?.Content;
break;
case EDataType.Byte:
break;
case EDataType.Int:
ResultArray = modbusTcpMaster.Read<short[]>(value.StartAddress.ToString(), value.Length)?.Content;
break;
case EDataType.Word:
ResultArray = modbusTcpMaster.Read<ushort[]>(value.StartAddress.ToString(), value.Length)?.Content;
break;
case EDataType.Dint:
ResultArray = modbusTcpMaster.Read<int[]>(value.StartAddress.ToString(), value.Length)?.Content;
break;
case EDataType.Dword:
ResultArray = modbusTcpMaster.Read<uint[]>(value.StartAddress.ToString(), value.Length)?.Content;
break;
case EDataType.Float:
ResultArray = modbusTcpMaster.Read<float[]>(value.StartAddress.ToString(), value.Length)?.Content;
break;
default:
break;
}
SetValue(ResultArray, item.DeviceName, value, temp.Key);
});
});

Thread.Sleep(100);
}), $"{item.DeviceName} 设备数据采集");
@@ -135,7 +90,7 @@ namespace BPASmart.Server
mqttHelper.Connect("admin", "fengyoufu067101!@#", "124.222.238.75", 61613, $"分布式上位机:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
mqttHelper.ConnectOk = new Action(() =>
{
mqttHelper.Subscrib("DistributedHostComputer/Control");
mqttHelper.Subscrib(Topics.DeviceControl);
ThreadManage.GetInstance().StartLong(new Action(() =>
{
while (msg.Count > 0)
@@ -175,31 +130,24 @@ namespace BPASmart.Server
switch (item.DataType)
{
case EDataType.Bool:
//CommunicationDevices[item.DeviceName].Write(address, Convert.ToBoolean(item.Value));
CommunicationDevices[item.DeviceName].Write(address, Convert.ToBoolean(item.Value));
break;
case EDataType.Byte:
//CommunicationDevices[item.DeviceName].Write(address, Convert.ToByte(item.Value));
CommunicationDevices[item.DeviceName].Write(address, Convert.ToByte(item.Value));
break;
case EDataType.Int:
//CommunicationDevices[item.DeviceName].Write(address, Convert.ToInt16(item.Value));
CommunicationDevices[item.DeviceName].Write(address, Convert.ToInt16(item.Value));
break;
case EDataType.Word:
//CommunicationDevices[item.DeviceName].Write(address, Convert.ToUInt16(item.Value));
CommunicationDevices[item.DeviceName].Write(address, Convert.ToUInt16(item.Value));
break;
case EDataType.Dint:
//CommunicationDevices[item.DeviceName].Write(address, Convert.ToInt32(item.Value));
CommunicationDevices[item.DeviceName].Write(address, Convert.ToInt32(item.Value));
break;
case EDataType.Dword:
//CommunicationDevices[item.DeviceName].Write(address, Convert.ToUInt32(item.Value));
CommunicationDevices[item.DeviceName].Write(address, Convert.ToUInt32(item.Value));
break;
case EDataType.Float:
//CommunicationDevices[item.DeviceName].Write(address, Convert.ToSingle(item.Value));
CommunicationDevices[item.DeviceName].Write(address, Convert.ToSingle(item.Value));
break;
default:
@@ -213,64 +161,6 @@ namespace BPASmart.Server
}
}

//private void SetValue<TArray>(TArray[] arrays, string DeviceName, ReadDataModel readDataModel, ushort by)
//{
// if (arrays != null)
// {
// int index = Array.FindIndex(Json<CommunicationPar>.Data.CommunicationDevices.ToArray(), p => p.DeviceName == DeviceName);//获取设备所在集合位置
// if (index >= 0 && index < Json<CommunicationPar>.Data.CommunicationDevices.Count)
// {
// var tempArray = Json<CommunicationPar>.Data.CommunicationDevices.ElementAt(index).VarTableModels.ToArray();
// for (int i = 0; i < arrays.Length; i++)
// {
// int varIndex = Array.FindIndex(tempArray, p => p.RealAddress == (readDataModel.StartAddress + (i * by)).ToString());
// if (varIndex >= 0 && varIndex < tempArray.Length)
// {
// Json<CommunicationPar>.Data.CommunicationDevices.ElementAt(index).VarTableModels.ElementAt(varIndex).CurrentValue = arrays[i].ToString();
// }
// }
// var Devicename = Json<CommunicationPar>.Data.CommunicationDevices[index].DeviceName;
// List<ReeisDataModel> reeisDataModels = new List<ReeisDataModel>();
// Json<CommunicationPar>.Data.CommunicationDevices[index].VarTableModels.ToList().ForEach(tempVar =>
// {
// if (tempVar.VarName.Length > 0)
// {
// reeisDataModels.Add(new ReeisDataModel()
// {
// VarName = tempVar.VarName,
// VarVaule = tempVar.CurrentValue,
// DataType = (EDataType)Enum.Parse(typeof(EDataType), tempVar.DataType)
// });
// }
// });
// RedisHelper.GetInstance.SetValue($"{Devicename}", reeisDataModels);
// }
// }
//}

//private ushort GetBySize(EDataType eDataType)
//{
// switch (eDataType)
// {
// case EDataType.Bool:
// case EDataType.Byte:
// case EDataType.Int:
// case EDataType.Word:
// return 1;
// case EDataType.Dint:
// case EDataType.Dword:
// case EDataType.Float:
// return 2;
// case EDataType.Double:
// break;
// case EDataType.String:
// break;
// default:
// break;
// }
// return 1;
//}

private void SetValue(Array arrays, string DeviceName, ReadDataModel readDataModel, EDataType eDataType)
{
if (arrays != null)
@@ -307,72 +197,5 @@ namespace BPASmart.Server
}
}



//private Dictionary<EDataType, List<ReadDataModel>> GetReadDataModels(CommunicationModel communicationModel)
//{
// Dictionary<EDataType, List<ReadDataModel>> readDataModels = new Dictionary<EDataType, List<ReadDataModel>>();
// communicationModel.VarTableModels.GroupBy(p => p.DataType)?.ToList()?.ForEach(tempVar =>
// {
// if (tempVar.Key != null && tempVar.Key.Length > 0)
// {
// //int address = tempVar.Min(p => p.RealAddress);
// EDataType dataType = (EDataType)Enum.Parse(typeof(EDataType), tempVar.Key);
// switch (dataType)
// {
// case EDataType.Bool:
// case EDataType.Byte:
// case EDataType.Int:
// case EDataType.Word:
// if (!readDataModels.ContainsKey(dataType)) readDataModels.TryAdd(dataType, GetDataGroup(tempVar));
// break;
// case EDataType.Dint:
// case EDataType.Dword:
// case EDataType.Float:
// if (!readDataModels.ContainsKey(dataType)) readDataModels.TryAdd(dataType, GetDataGroup(tempVar, 2));
// break;
// default:
// break;
// }
// }
// });
// return readDataModels;
//}

//private List<ReadDataModel> GetDataGroup(IGrouping<string, VariableInfo> variableInfos, int by = 1)
//{
// List<ReadDataModel> ReturnValue = new List<ReadDataModel>();
// var res = variableInfos?.OrderBy(p => p.RealAddress).ToList();
// List<int> RealAddresss = new List<int>();
// variableInfos.ToList()?.ForEach(item => { if (int.TryParse(item.RealAddress, out int add)) RealAddresss.Add(add); });
// int count = 0;
// if (res != null)
// {
// //int address = variableInfos.Min(p => p.RealAddress);
// int address = RealAddresss.Min();
// int startAddress = address;
// for (int i = 0; i < res.Count; i++)
// {
// if (int.TryParse(res.ElementAt(i).RealAddress, out int TempAddress))
// {
// if (TempAddress == address)
// {
// count++;
// address += by;
// }
// else
// {
// ReturnValue.Add(new ReadDataModel() { StartAddress = (ushort)startAddress, Length = (ushort)count });
// count = 1;
// address = TempAddress + by;
// startAddress = TempAddress;
// }
// }

// }
// ReturnValue.Add(new ReadDataModel() { StartAddress = (ushort)startAddress, Length = (ushort)count });
// }
// return ReturnValue;
//}
}
}

+ 9
- 0
BPASmart.SmallBatchingSystem/BPASmart.SmallBatchingSystem.csproj Целия файл

@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>

+ 44
- 0
BPASmart.SmallBatchingSystem/DataModel.cs Целия файл

@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Concurrent;

namespace BPASmart.SmallBatchingSystem
{
public class DataModel
{
public ConcurrentDictionary<string, string> OutletInformation { get; set; } = new ConcurrentDictionary<string, string>();
}

/// <summary>
/// 料仓信息
/// </summary>
public class SiloInformation
{
/// <summary>
/// 料仓位置
/// </summary>
public string SiloLoc { get; set; } = string.Empty;

/// <summary>
/// 料仓名称
/// </summary>
public string SiloName { get; set; } = string.Empty;
}

/// <summary>
/// 出料口信息
/// </summary>

public class FeedMouth
{
public string FeedMouthLoc { get; set; } = string.Empty;

public string FeedMouthName { get; set; } = string.Empty;

public List<SiloInformation> SiloInformations { get; set; } = new List<SiloInformation>();
}

}

+ 14
- 0
BPASmart.SmallBatchingSystem/Main.cs Целия файл

@@ -0,0 +1,14 @@
namespace BPASmart.SmallBatchingSystem
{
public class Main
{
private volatile static Main _Instance;
public static Main GetInstance => _Instance ?? (_Instance = new Main());
private Main() { }

public void Start()
{

}
}
}

+ 104
- 77
BPASmartClient.CustomResource/Pages/View/NfcSetView.xaml Целия файл

@@ -2,11 +2,11 @@
x:Class="BPASmartClient.CustomResource.Pages.View.NfcSetView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:common="clr-namespace:BPASmartClient.CustomResource.Pages.Model"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
xmlns:common="clr-namespace:BPASmartClient.CustomResource.Pages.Model"
Title="NfcSetView"
Width="500"
Height="250"
@@ -139,8 +139,8 @@
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="#009DFF" />
<Setter Property="BorderThickness" Value="0,0,0,1" />
</Style>
<!--#endregion-->

@@ -148,9 +148,9 @@
<Style x:Key="UserTextBoxStyle" TargetType="TextBox">
<Setter Property="Background" Value="Transparent" />
<Setter Property="CaretBrush" Value="#009DFF" />
<Setter Property="BorderBrush" Value="#009DFF"/>
<Setter Property="BorderThickness" Value="0,0,0,1"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderBrush" Value="#009DFF" />
<Setter Property="BorderThickness" Value="0,0,0,1" />
<Setter Property="Foreground" Value="White" />
<Setter Property="FontSize" Value="14" />
</Style>
<!--#endregion-->
@@ -170,9 +170,9 @@
<Grid Background="Transparent">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock
Margin="0,0,0,10"
FontSize="16"
Foreground="#32B8FF"
Margin="0,0,0,10"
Text="用户权限列表:" />

<ItemsControl ItemsSource="{Binding permissions}">
@@ -222,50 +222,66 @@
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="92*"/>
<ColumnDefinition Width="135*"/>
<ColumnDefinition Width="67*"/>
<ColumnDefinition Width="92*" />
<ColumnDefinition Width="135*" />
<ColumnDefinition Width="67*" />
</Grid.ColumnDefinitions>
<TextBlock
HorizontalAlignment="Center"
FontSize="16"
VerticalAlignment="Center"
Foreground="#FF32B8FF"
Text="当前卡号:" Height="21" Width="80" />

<TextBlock Grid.Row="1"
HorizontalAlignment="Center"
FontSize="16"
VerticalAlignment="Center"
Foreground="#FF32B8FF"
Text="用户名:" Height="20" Width="64" />
<TextBlock Grid.Row="2"
HorizontalAlignment="Center"
FontSize="16"
VerticalAlignment="Center"
Foreground="#FF32B8FF"
Text="当前密码:" Height="20" Width="80" />
<TextBlock Grid.Row="3"
HorizontalAlignment="Center"
FontSize="16"
VerticalAlignment="Center"
Foreground="#FF32B8FF"
Text="确认密码:" Height="20" Width="80" />

<TextBlock Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="#FF32B8FF"
Text="{Binding CardNum}" />

<TextBox Grid.Row="1" Grid.Column="1"
Margin="11,4,10,4"
Text="{Binding UserName}"
Style="{DynamicResource UserTextBoxStyle}"/>

<PasswordBox Grid.Column="1" Grid.Row="2"
Width="80"
Height="21"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="#FF32B8FF"
Text="当前卡号:" />

<TextBlock
Grid.Row="1"
Width="64"
Height="20"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="#FF32B8FF"
Text="用户名:" />
<TextBlock
Grid.Row="2"
Width="80"
Height="20"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="#FF32B8FF"
Text="当前密码:" />
<TextBlock
Grid.Row="3"
Width="80"
Height="20"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="#FF32B8FF"
Text="确认密码:" />

<TextBlock
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="#FF32B8FF"
Text="{Binding CardNum}" />

<TextBox
Grid.Row="1"
Grid.Column="1"
Margin="11,4,10,4"
Style="{DynamicResource UserTextBoxStyle}"
Text="{Binding UserName}" />

<PasswordBox
Name="newpb1"
Grid.Row="2"
Grid.Column="1"
Margin="11,4,10,4"
common:PasswordHelper.Attach="True"
common:PasswordHelper.Password="{Binding CurrentPassword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
@@ -274,8 +290,10 @@
Foreground="#aadddddd"
Style="{DynamicResource PasswordBoxStyle}"
TabIndex="2" />
<PasswordBox Grid.Column="1" Grid.Row="3"
<PasswordBox
Name="newpb2"
Grid.Row="3"
Grid.Column="1"
Margin="11,4,10,4"
common:PasswordHelper.Attach="True"
common:PasswordHelper.Password="{Binding CheckPassword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
@@ -284,23 +302,30 @@
Foreground="#aadddddd"
Style="{DynamicResource PasswordBoxStyle}"
TabIndex="2" />
<TextBlock Grid.Row="2" Grid.Column="2"
HorizontalAlignment="Center"
FontSize="10"
VerticalAlignment="Center"
Foreground="#FF32B8FF"
Text="(默认888888)" Height="12" Width="62" />

<TextBlock Grid.Row="4" Grid.ColumnSpan="3" Grid.Column="0"

<TextBlock
Grid.Row="2"
Grid.Column="2"
Width="62"
Height="12"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="10"
Foreground="#FF32B8FF"
Text="(默认888888)" />

<TextBlock
Grid.Row="4"
Grid.Column="0"
Grid.ColumnSpan="3"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="#FFF53F62"
Text="{Binding Info}" />
</Grid>


<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
@@ -308,24 +333,26 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>

<Button VerticalAlignment="Center"
HorizontalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Content="用户添加"
FontSize="16"
Style="{DynamicResource ButtonStyle}"
Command="{Binding UserAddCommand}"/>
<Button Grid.Column="1"
VerticalAlignment="Center"
HorizontalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Content="用户注销"
FontSize="16"
Style="{DynamicResource ButtonStyle}"
Command="{Binding UserCancelCommand}"/>
<Button
HorizontalAlignment="Center"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Command="{Binding UserAddCommand}"
Content="用户添加"
FontSize="16"
Style="{DynamicResource ButtonStyle}" />

<Button
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Command="{Binding UserCancelCommand}"
Content="用户注销"
FontSize="16"
Style="{DynamicResource ButtonStyle}" />





+ 420
- 272
BPASmartClient.SCADAControl/Themes/Generic.xaml
Файловите разлики са ограничени, защото са твърде много
Целия файл


+ 7
- 8
BeDesignerSCADA/App.xaml Целия файл

@@ -1,9 +1,8 @@
<Application x:Class="BeDesignerSCADA.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:BeDesignerSCADA"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
<Application
x:Class="BeDesignerSCADA.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:BeDesignerSCADA"
StartupUri="MainWindow.xaml">
<Application.Resources />
</Application>

+ 36
- 19
BeDesignerSCADA/Controls/RunCanvas.xaml Целия файл

@@ -1,31 +1,48 @@
<UserControl x:Class="BeDesignerSCADA.Controls.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:BeDesignerSCADA.Controls"
xmlns:con="clr-namespace:BeDesignerSCADA.Converters"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl
x:Class="BeDesignerSCADA.Controls.RunCanvas"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:con="clr-namespace:BeDesignerSCADA.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BeDesignerSCADA.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<UserControl.Resources>
<con:ZoomConverter x:Key="ZoomX" IsHeight="False"/>
<con:ZoomConverter x:Key="ZoomY" IsHeight="True"/>
<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">
<Grid ClipToBounds="True">
<Canvas
x:Name="RootCanvas"
Background="Transparent"
ClipToBounds="True"
MouseLeftButtonDown="RootCanvas_MouseLeftButtoDown"
MouseLeftButtonUp="RootCanvas_MouseLeftButtonUp"
MouseMove="RootCanvas_MouseMove"
MouseWheel="RootCanvas_MouseWheel">
<Canvas.RenderTransform>
<TransformGroup>
<ScaleTransform x:Name="Scale"/>
<TranslateTransform x:Name="Translate"/>
<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
Margin="8,0"
HorizontalAlignment="Right"
Orientation="Horizontal">
<CheckBox
x:Name="DragEnable"
Margin="4"
Content="拖动" />
<CheckBox
x:Name="ZoomEnable"
Margin="4"
Content="缩放" />
</StackPanel>
</Grid>
</Grid>


+ 270
- 160
BeDesignerSCADA/Themes/Styles.xaml Целия файл

@@ -1,81 +1,119 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:icon="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:con="clr-namespace:BeDesignerSCADA.Converters"
xmlns:dxmvmm="clr-namespace:BeDesignerSCADA.Converters"
xmlns:input="clr-namespace:System.Windows.Input;assembly=PresentationCore"
xmlns:ctrl="clr-namespace:BeDesignerSCADA.CustomerControls">
<!--#region 主题笔刷 -->
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:con="clr-namespace:BeDesignerSCADA.Converters"
xmlns:ctrl="clr-namespace:BeDesignerSCADA.CustomerControls"
xmlns:dxmvmm="clr-namespace:BeDesignerSCADA.Converters"
xmlns:icon="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:input="clr-namespace:System.Windows.Input;assembly=PresentationCore">

<!--#region 主题笔刷-->
<LinearGradientBrush x:Key="NormalBackground" StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStopCollection>
<GradientStop Color="White" />
<GradientStop Color="#D0D0D0" Offset="0.5"/>
<GradientStop Color="#E3E3E3" Offset="1"/>
<GradientStop Offset="0.5" Color="#D0D0D0" />
<GradientStop Offset="1" Color="#E3E3E3" />
</GradientStopCollection>
</LinearGradientBrush>

<SolidColorBrush x:Key="AccentBrush" Color="#2B79E2"/>
<SolidColorBrush x:Key="ControlBorderBrush" Color="LightGray"/>
<SolidColorBrush x:Key="ControlBackground" Color="White"/>
<SolidColorBrush x:Key="ControlForeground" Color="Black"/>
<SolidColorBrush x:Key="AccentBrush" Color="#2B79E2" />
<SolidColorBrush x:Key="ControlBorderBrush" Color="LightGray" />
<SolidColorBrush x:Key="ControlBackground" Color="White" />
<SolidColorBrush x:Key="ControlForeground" Color="Black" />
<!--#endregion-->

<!--#region 转换器 -->
<con:HalfNumberConverter x:Key="HalfNumber"/>
<!--#region 转换器-->
<con:HalfNumberConverter x:Key="HalfNumber" />
<!--#endregion-->
<!--#region 编辑模板 -->
<!--#region 编辑模板-->
<DataTemplate x:Key="EventEditTemplate">
<DockPanel Height="24">
<Button DockPanel.Dock="Right" Command="{Binding DataContext.EditCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=Window}}"
Content="..." CommandParameter="{Binding .}" Margin="2"/>
<TextBlock Text="{Binding Value}" VerticalAlignment="Center" Margin="4 0 0 0"/>
<Button
Margin="2"
Command="{Binding DataContext.EditCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}"
CommandParameter="{Binding .}"
Content="..."
DockPanel.Dock="Right" />
<TextBlock
Margin="4,0,0,0"
VerticalAlignment="Center"
Text="{Binding Value}" />
</DockPanel>
</DataTemplate>

<DataTemplate x:Key="ListEditTemplate">
<DockPanel MaxHeight="100">
<DockPanel DockPanel.Dock="Top">
<Button DockPanel.Dock="Right" Command="{Binding Value.AddCommand}"
CommandParameter="{Binding ElementName=AddTxt, Path=Text}" Margin="2" Padding="2">
<icon:PackIconModern Kind="EditAdd"/>
<Button
Margin="2"
Padding="2"
Command="{Binding Value.AddCommand}"
CommandParameter="{Binding ElementName=AddTxt, Path=Text}"
DockPanel.Dock="Right">
<icon:PackIconModern Kind="EditAdd" />
</Button>
<Button DockPanel.Dock="Right" Command="{Binding Value.DeleteCommand}"
CommandParameter="{Binding ElementName=list, Path=SelectedItem}" Margin="2" Padding="2">
<Button
Margin="2"
Padding="2"
Command="{Binding Value.DeleteCommand}"
CommandParameter="{Binding ElementName=list, Path=SelectedItem}"
DockPanel.Dock="Right">
<icon:PackIconModern Kind="Delete" />
</Button>
<TextBox x:Name="AddTxt" Margin="2"/>
<TextBox x:Name="AddTxt" Margin="2" />
</DockPanel>

<ListBox x:Name="list" ItemsSource="{Binding Value}" Margin="2"/>
<ListBox
x:Name="list"
Margin="2"
ItemsSource="{Binding Value}" />
</DockPanel>
</DataTemplate>

<DataTemplate x:Key="ImagePathEditTemplate">
<DockPanel>
<Button DockPanel.Dock="Right" Content="..." Padding="0" Margin="2" Width="20" Height="20"
Command="{Binding DataContext.SelectPathCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=Window}}" CommandParameter="{Binding .}"/>
<TextBox DockPanel.Dock="Right" x:Name="AddTxt" Text="{Binding Value}" BorderThickness="0"/>
<Button
Width="20"
Height="20"
Margin="2"
Padding="0"
Command="{Binding DataContext.SelectPathCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}"
CommandParameter="{Binding .}"
Content="..."
DockPanel.Dock="Right" />
<TextBox
x:Name="AddTxt"
BorderThickness="0"
DockPanel.Dock="Right"
Text="{Binding Value}" />
</DockPanel>
</DataTemplate>
<!--#endregion-->

<!--#region 为某些获取焦点的控件设计设计时样式 -->
<Style TargetType="ComboBox" x:Key="DesignComboBox">
<!--#region 为某些获取焦点的控件设计设计时样式-->
<Style x:Key="DesignComboBox" TargetType="ComboBox">
<Setter Property="Focusable" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBox">
<Border BorderThickness="1" BorderBrush="{StaticResource ControlBorderBrush}">
<Border BorderBrush="{StaticResource ControlBorderBrush}" BorderThickness="1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<Border Background="{StaticResource ControlBackground}"/>
<Border Grid.Column="1" Background="{StaticResource ControlBackground}" BorderThickness="0" IsEnabled="False">
<Path Data="M0,0 8,0 4,4z" Fill="{StaticResource ControlForeground}" Margin="3" VerticalAlignment="Center"/>
<Border Background="{StaticResource ControlBackground}" />
<Border
Grid.Column="1"
Background="{StaticResource ControlBackground}"
BorderThickness="0"
IsEnabled="False">
<Path
Margin="3"
VerticalAlignment="Center"
Data="M0,0 8,0 4,4z"
Fill="{StaticResource ControlForeground}" />
</Border>
</Grid>
</Border>
@@ -89,7 +127,7 @@
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border BorderThickness="1" BorderBrush="{StaticResource ControlBorderBrush}" Background="{StaticResource ControlBackground}">
<TextBlock Text="{TemplateBinding Content}" FontSize="{TemplateBinding FontSize}"
<TextBlock Text="{TemplateBinding Content}" FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
@@ -97,39 +135,56 @@
</Setter>
</Style>-->

<Style TargetType="ToggleButton" x:Key="DesignToggleButton">
<Style x:Key="DesignToggleButton" TargetType="ToggleButton">
<Setter Property="Foreground" Value="{StaticResource ControlForeground}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border BorderThickness="1" Background="{StaticResource NormalBackground}" BorderBrush="{StaticResource ControlBorderBrush}" CornerRadius="2">
<TextBlock Text="{TemplateBinding Content}" FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<Border
Background="{StaticResource NormalBackground}"
BorderBrush="{StaticResource ControlBorderBrush}"
BorderThickness="1"
CornerRadius="2">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}"
Text="{TemplateBinding Content}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style TargetType="ToggleButton" x:Key="ExecuteToggleButton">
<Style x:Key="ExecuteToggleButton" TargetType="ToggleButton">
<Setter Property="Foreground" Value="{StaticResource ControlForeground}" />
<Setter Property="Foreground" Value="{StaticResource ControlForeground}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border x:Name="bd" BorderThickness="1" Background="{StaticResource NormalBackground}" BorderBrush="{StaticResource ControlBorderBrush}" CornerRadius="2">
<TextBlock Text="{TemplateBinding Content}" FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<Border
x:Name="bd"
Background="{StaticResource NormalBackground}"
BorderBrush="{StaticResource ControlBorderBrush}"
BorderThickness="1"
CornerRadius="2">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}"
Text="{TemplateBinding Content}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Background" TargetName="bd">
<Setter TargetName="bd" Property="Background">
<Setter.Value>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStopCollection>
<GradientStop Color="#6AD456" />
<GradientStop Color="#1DAE06" Offset="0.5"/>
<GradientStop Color="#8BDC7C" Offset="1"/>
<GradientStop Offset="0.5" Color="#1DAE06" />
<GradientStop Offset="1" Color="#8BDC7C" />
</GradientStopCollection>
</LinearGradientBrush>
</Setter.Value>
@@ -145,146 +200,156 @@
<DataTemplate x:Key="ToolBoxStyle">
<Grid Margin="2" Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"/>
<ColumnDefinition/>
<ColumnDefinition Width="30" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<icon:PackIconMaterial x:Name="icon" Kind="Ellipse" BorderThickness="1" VerticalAlignment="Stretch" Width="24" HorizontalAlignment="Stretch"/>
<TextBlock x:Name="txt" Grid.Column="1" Text="{Binding Name}" Margin="4"/>
<icon:PackIconMaterial
x:Name="icon"
Width="24"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
BorderThickness="1"
Kind="Ellipse" />
<TextBlock
x:Name="txt"
Grid.Column="1"
Margin="4"
Text="{Binding Name}" />
</Grid>

<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Name}" Value="TheButton">
<Setter Property="Kind" TargetName="icon" Value="GestureTapButton"/>
<Setter Property="Text" TargetName="txt" Value="按钮"/>
<Setter TargetName="icon" Property="Kind" Value="GestureTapButton" />
<Setter TargetName="txt" Property="Text" Value="按钮" />
</DataTrigger>
<DataTrigger Binding="{Binding Name}" Value="TheTimer">
<Setter Property="Kind" TargetName="icon" Value="Timer"/>
<Setter Property="Text" TargetName="txt" Value="计时器"/>
<Setter TargetName="icon" Property="Kind" Value="Timer" />
<Setter TargetName="txt" Property="Text" Value="计时器" />
</DataTrigger>
<DataTrigger Binding="{Binding Name}" Value="TheCheckBox">
<Setter Property="Kind" TargetName="icon" Value="CheckboxMarked"/>
<Setter Property="Text" TargetName="txt" Value="勾选框"/>
<Setter TargetName="icon" Property="Kind" Value="CheckboxMarked" />
<Setter TargetName="txt" Property="Text" Value="勾选框" />
</DataTrigger>
<DataTrigger Binding="{Binding Name}" Value="DigitalNumber">
<Setter Property="Kind" TargetName="icon" Value="LedStrip"/>
<Setter Property="Text" TargetName="txt" Value="液晶数字"/>
<Setter TargetName="icon" Property="Kind" Value="LedStrip" />
<Setter TargetName="txt" Property="Text" Value="液晶数字" />
</DataTrigger>
<DataTrigger Binding="{Binding Name}" Value="TheComboBox">
<Setter Property="Kind" TargetName="icon" Value="ViewList"/>
<Setter Property="Text" TargetName="txt" Value="下拉框"/>
<Setter TargetName="icon" Property="Kind" Value="ViewList" />
<Setter TargetName="txt" Property="Text" Value="下拉框" />
</DataTrigger>
<DataTrigger Binding="{Binding Name}" Value="TheImage">
<Setter Property="Kind" TargetName="icon" Value="Image"/>
<Setter Property="Text" TargetName="txt" Value="图片"/>
<Setter TargetName="icon" Property="Kind" Value="Image" />
<Setter TargetName="txt" Property="Text" Value="图片" />
</DataTrigger>
<DataTrigger Binding="{Binding Name}" Value="TheTextBlock">
<Setter Property="Kind" TargetName="icon" Value="TagText"/>
<Setter Property="Text" TargetName="txt" Value="文本块"/>
<Setter TargetName="icon" Property="Kind" Value="TagText" />
<Setter TargetName="txt" Property="Text" Value="文本块" />
</DataTrigger>
<DataTrigger Binding="{Binding Name}" Value="ArcGauge">
<Setter Property="Kind" TargetName="icon" Value="Gauge"/>
<Setter Property="Text" TargetName="txt" Value="仪表盘"/>
<Setter TargetName="icon" Property="Kind" Value="Gauge" />
<Setter TargetName="txt" Property="Text" Value="仪表盘" />
</DataTrigger>
<DataTrigger Binding="{Binding Name}" Value="StatusLight">
<Setter Property="Kind" TargetName="icon" Value="CeilingLight"/>
<Setter Property="Text" TargetName="txt" Value="状态灯"/>
<Setter TargetName="icon" Property="Kind" Value="CeilingLight" />
<Setter TargetName="txt" Property="Text" Value="状态灯" />
</DataTrigger>
<DataTrigger Binding="{Binding Name}" Value="TheToggleButton">
<Setter Property="Kind" TargetName="icon" Value="CheckOutline"/>
<Setter Property="Text" TargetName="txt" Value="开关按钮"/>
<Setter TargetName="icon" Property="Kind" Value="CheckOutline" />
<Setter TargetName="txt" Property="Text" Value="开关按钮" />
</DataTrigger>
<DataTrigger Binding="{Binding Name}" Value="TheGroupBox">
<Setter Property="Kind" TargetName="icon" Value="Group"/>
<Setter Property="Text" TargetName="txt" Value="分组"/>
<Setter TargetName="icon" Property="Kind" Value="Group" />
<Setter TargetName="txt" Property="Text" Value="分组" />
</DataTrigger>
<DataTrigger Binding="{Binding Name}" Value="TheTextBox">
<Setter Property="Kind" TargetName="icon" Value="TextBox"/>
<Setter Property="Text" TargetName="txt" Value="文本框"/>
<Setter TargetName="icon" Property="Kind" Value="TextBox" />
<Setter TargetName="txt" Property="Text" Value="文本框" />
</DataTrigger>
<DataTrigger Binding="{Binding Name}" Value="NumberBox">
<Setter Property="Kind" TargetName="icon" Value="Numeric8Box"/>
<Setter Property="Text" TargetName="txt" Value="数值框"/>
<Setter TargetName="icon" Property="Kind" Value="Numeric8Box" />
<Setter TargetName="txt" Property="Text" Value="数值框" />
</DataTrigger>
<DataTrigger Binding="{Binding Name}" Value="GraphArrow">
<Setter Property="Kind" TargetName="icon" Value="ArrowRightBold"/>
<Setter Property="Text" TargetName="txt" Value="箭头"/>
<Setter TargetName="icon" Property="Kind" Value="ArrowRightBold" />
<Setter TargetName="txt" Property="Text" Value="箭头" />
</DataTrigger>
<DataTrigger Binding="{Binding Name}" Value="GraphStar">
<Setter Property="Kind" TargetName="icon" Value="Star"/>
<Setter Property="Text" TargetName="txt" Value="五角星"/>
<Setter TargetName="icon" Property="Kind" Value="Star" />
<Setter TargetName="txt" Property="Text" Value="五角星" />
</DataTrigger>
<DataTrigger Binding="{Binding Name}" Value="TheSlider">
<Setter Property="Kind" TargetName="icon" Value="ArrowDownBold"/>
<Setter Property="Text" TargetName="txt" Value="滑块"/>
<Setter TargetName="icon" Property="Kind" Value="ArrowDownBold" />
<Setter TargetName="txt" Property="Text" Value="滑块" />
</DataTrigger>
<DataTrigger Binding="{Binding Name}" Value="TheRadioButton">
<Setter Property="Kind" TargetName="icon" Value="RadioboxMarked"/>
<Setter Property="Text" TargetName="txt" Value="单选按钮"/>
<Setter TargetName="icon" Property="Kind" Value="RadioboxMarked" />
<Setter TargetName="txt" Property="Text" Value="单选按钮" />
</DataTrigger>
<DataTrigger Binding="{Binding Name}" Value="SwitchButton">
<Setter Property="Kind" TargetName="icon" Value="ToggleSwitch"/>
<Setter Property="Text" TargetName="txt" Value="开关"/>
<Setter TargetName="icon" Property="Kind" Value="ToggleSwitch" />
<Setter TargetName="txt" Property="Text" Value="开关" />
</DataTrigger>
<DataTrigger Binding="{Binding Name}" Value="KnobButton">
<Setter Property="Kind" TargetName="icon" Value="Ellipse"/>
<Setter Property="Text" TargetName="txt" Value="旋钮"/>
<Setter TargetName="icon" Property="Kind" Value="Ellipse" />
<Setter TargetName="txt" Property="Text" Value="旋钮" />
</DataTrigger>
<DataTrigger Binding="{Binding Name}" Value="Silos">
<Setter Property="Kind" TargetName="icon" Value="StoreSettings"/>
<Setter Property="Text" TargetName="txt" Value="物料仓"/>
<Setter TargetName="icon" Property="Kind" Value="StoreSettings" />
<Setter TargetName="txt" Property="Text" Value="物料仓" />
</DataTrigger>
<DataTrigger Binding="{Binding Name}" Value="NewConveyorBelt">
<Setter Property="Kind" TargetName="icon" Value="ArrowLeftRightBoldOutline"/>
<Setter Property="Text" TargetName="txt" Value="滚动线"/>
<Setter TargetName="icon" Property="Kind" Value="ArrowLeftRightBoldOutline" />
<Setter TargetName="txt" Property="Text" Value="滚动线" />
</DataTrigger>
<DataTrigger Binding="{Binding Name}" Value="TheDataGrid">
<Setter Property="Kind" TargetName="icon" Value="LineScan"/>
<Setter Property="Text" TargetName="txt" Value="表格"/>
<Setter TargetName="icon" Property="Kind" Value="LineScan" />
<Setter TargetName="txt" Property="Text" Value="表格" />
</DataTrigger>
<DataTrigger Binding="{Binding Name}" Value="TheListBox">
<Setter Property="Kind" TargetName="icon" Value="LineScan"/>
<Setter Property="Text" TargetName="txt" Value="列表控件"/>
<Setter TargetName="icon" Property="Kind" Value="LineScan" />
<Setter TargetName="txt" Property="Text" Value="列表控件" />
</DataTrigger>

<DataTrigger Binding="{Binding Name}" Value="TheRedis">
<Setter Property="Kind" TargetName="icon" Value="AlphaDBoxOutline"/>
<Setter Property="Text" TargetName="txt" Value="Redis控件"/>
<Setter TargetName="icon" Property="Kind" Value="AlphaDBoxOutline" />
<Setter TargetName="txt" Property="Text" Value="Redis控件" />
</DataTrigger>

<DataTrigger Binding="{Binding Name}" Value="WaveProgressBar">
<Setter Property="Kind" TargetName="icon" Value="Wave"/>
<Setter Property="Text" TargetName="txt" Value="进度条波浪"/>
<Setter TargetName="icon" Property="Kind" Value="Wave" />
<Setter TargetName="txt" Property="Text" Value="进度条波浪" />
</DataTrigger>

<DataTrigger Binding="{Binding Name}" Value="TheProgressBar">
<Setter Property="Kind" TargetName="icon" Value="LineScan"/>
<Setter Property="Text" TargetName="txt" Value="进度条正常"/>
<Setter TargetName="icon" Property="Kind" Value="LineScan" />
<Setter TargetName="txt" Property="Text" Value="进度条正常" />
</DataTrigger>

<DataTrigger Binding="{Binding Name}" Value="TheRedProgressBar">
<Setter Property="Kind" TargetName="icon" Value="LineScan"/>
<Setter Property="Text" TargetName="txt" Value="进度条圆形红"/>
<Setter TargetName="icon" Property="Kind" Value="LineScan" />
<Setter TargetName="txt" Property="Text" Value="进度条圆形红" />
</DataTrigger>

<DataTrigger Binding="{Binding Name}" Value="TheBlueProgressBar">
<Setter Property="Kind" TargetName="icon" Value="LineScan"/>
<Setter Property="Text" TargetName="txt" Value="进度条圆形蓝"/>
<Setter TargetName="icon" Property="Kind" Value="LineScan" />
<Setter TargetName="txt" Property="Text" Value="进度条圆形蓝" />
</DataTrigger>

<DataTrigger Binding="{Binding Name}" Value="TheGreenProgressBar">
<Setter Property="Kind" TargetName="icon" Value="LineScan"/>
<Setter Property="Text" TargetName="txt" Value="进度条圆形绿"/>
<Setter TargetName="icon" Property="Kind" Value="LineScan" />
<Setter TargetName="txt" Property="Text" Value="进度条圆形绿" />
</DataTrigger>

<DataTrigger Binding="{Binding Name}" Value="TheAPI">
<Setter Property="Kind" TargetName="icon" Value="AlphaABoxOutline"/>
<Setter Property="Text" TargetName="txt" Value="API接口"/>
<Setter TargetName="icon" Property="Kind" Value="AlphaABoxOutline" />
<Setter TargetName="txt" Property="Text" Value="API接口" />
</DataTrigger>

<DataTrigger Binding="{Binding Name}" Value="TheMQTT">
<Setter Property="Kind" TargetName="icon" Value="AlphaMBoxOutline"/>
<Setter Property="Text" TargetName="txt" Value="MQTT"/>
<Setter TargetName="icon" Property="Kind" Value="AlphaMBoxOutline" />
<Setter TargetName="txt" Property="Text" Value="MQTT" />
</DataTrigger>

</DataTemplate.Triggers>
@@ -295,48 +360,78 @@
</FontFamily>

<!--#region 右键菜单-->
<ContextMenu x:Key="CanvasRightMenu" DataContext="{Binding PlacementTarget,RelativeSource={RelativeSource Self}}" FontFamily="Microsoft YaHei Ui">
<MenuItem Header="复制" Command="{Binding CopySelectItemsCommand}">
<ContextMenu
x:Key="CanvasRightMenu"
DataContext="{Binding PlacementTarget, RelativeSource={RelativeSource Self}}"
FontFamily="Microsoft YaHei Ui">
<MenuItem Command="{Binding CopySelectItemsCommand}" Header="复制">
<MenuItem.Icon>
<icon:PackIconModern Kind="PageCopy" HorizontalAlignment="Center" Width="10"/>
<icon:PackIconModern
Width="10"
HorizontalAlignment="Center"
Kind="PageCopy" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="粘贴" Command="{Binding PasteSelectItemsCommand}">
<MenuItem Command="{Binding PasteSelectItemsCommand}" Header="粘贴">
<MenuItem.Icon>
<icon:PackIconModern Kind="ClipboardPaste" HorizontalAlignment="Center" Width="10"/>
<icon:PackIconModern
Width="10"
HorizontalAlignment="Center"
Kind="ClipboardPaste" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="删除" Command="{Binding DeleteSelectItemsCommand}">
<MenuItem Command="{Binding DeleteSelectItemsCommand}" Header="删除">
<MenuItem.Icon>
<icon:PackIconModern Kind="Delete" HorizontalAlignment="Center" Width="10"/>
<icon:PackIconModern
Width="10"
HorizontalAlignment="Center"
Kind="Delete" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>

<ContextMenu x:Key="AdornerRightMenu" DataContext="{Binding PlacementTarget.Tag,RelativeSource={RelativeSource Mode=Self}}" FontFamily="Microsoft YaHei Ui">
<MenuItem Header="复制" Command="{Binding CopySelectItemsCommand}">
<ContextMenu
x:Key="AdornerRightMenu"
DataContext="{Binding PlacementTarget.Tag, RelativeSource={RelativeSource Mode=Self}}"
FontFamily="Microsoft YaHei Ui">
<MenuItem Command="{Binding CopySelectItemsCommand}" Header="复制">
<MenuItem.Icon>
<icon:PackIconModern Kind="PageCopy" HorizontalAlignment="Center" Width="10"/>
<icon:PackIconModern
Width="10"
HorizontalAlignment="Center"
Kind="PageCopy" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="粘贴" Command="{Binding PasteSelectItemsCommand}">
<MenuItem Command="{Binding PasteSelectItemsCommand}" Header="粘贴">
<MenuItem.Icon>
<icon:PackIconModern Kind="ClipboardPaste" HorizontalAlignment="Center" Width="10"/>
<icon:PackIconModern
Width="10"
HorizontalAlignment="Center"
Kind="ClipboardPaste" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="删除" Command="{Binding DeleteSelectItemsCommand}">
<MenuItem Command="{Binding DeleteSelectItemsCommand}" Header="删除">
<MenuItem.Icon>
<icon:PackIconModern Kind="Delete" HorizontalAlignment="Center" Width="10"/>
<icon:PackIconModern
Width="10"
HorizontalAlignment="Center"
Kind="Delete" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="置于顶层" Command="{Binding SetTopLayerCommand}">
<MenuItem Command="{Binding SetTopLayerCommand}" Header="置于顶层">
<MenuItem.Icon>
<icon:PackIconMaterial Kind="ArrangeSendToBack" HorizontalAlignment="Center" Width="10"/>
<icon:PackIconMaterial
Width="10"
HorizontalAlignment="Center"
Kind="ArrangeSendToBack" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="置于底层" Command="{Binding SetBottomLayerCommand}">
<MenuItem Command="{Binding SetBottomLayerCommand}" Header="置于底层">
<MenuItem.Icon>
<icon:PackIconMaterial Kind="ArrangeBringToFront" HorizontalAlignment="Center" Width="10"/>
<icon:PackIconMaterial
Width="10"
HorizontalAlignment="Center"
Kind="ArrangeBringToFront" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
@@ -353,16 +448,16 @@
<Setter.Value>
<ControlTemplate TargetType="ctrl:DigitalNumber">
<Grid Background="{TemplateBinding Background}">
<TextBlock x:Name="line" VerticalAlignment="Center" HorizontalAlignment="Center"
<TextBlock x:Name="line" VerticalAlignment="Center" HorizontalAlignment="Center"
FontFamily="{StaticResource Digital}" FontSize="{TemplateBinding FontSize}"
Text="{Binding NumberValue,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ctrl:DigitalNumber},Mode=TwoWay}"
Text="{Binding NumberValue,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ctrl:DigitalNumber},Mode=TwoWay}"
Foreground="{TemplateBinding Foreground}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type ctrl:TheTimer}">
<Setter Property="Template">
<Setter.Value>
@@ -540,7 +635,7 @@
<StackPanel>
<Border Background="{TemplateBinding Background}">
<Viewbox>
<Border x:Name="PART_Clip" BorderThickness="{TemplateBinding BorderThickness}" ClipToBounds="True"
<Border x:Name="PART_Clip" BorderThickness="{TemplateBinding BorderThickness}" ClipToBounds="True"
BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="100" Width="200" Height="200">
<Border.Clip>
<EllipseGeometry RadiusX="100" RadiusY="100" Center="100,100"/>
@@ -558,8 +653,8 @@
</PathGeometry>
</Path.Data>
</Path>
<TextBlock Visibility="{Binding ShowText,RelativeSource={RelativeSource TemplatedParent},Converter={x:Static dxmvmm:BoolToVisibilityConverter.Instance}}"
HorizontalAlignment="Center" VerticalAlignment="Center"
<TextBlock Visibility="{Binding ShowText,RelativeSource={RelativeSource TemplatedParent},Converter={x:Static dxmvmm:BoolToVisibilityConverter.Instance}}"
HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}"
Text="{Binding Value,RelativeSource={RelativeSource Mode=TemplatedParent},StringFormat={}{0:f2}%}"/>
</Grid>
@@ -589,10 +684,10 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ctrl:SwitchButton">
<Border CornerRadius="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=ActualHeight,Converter={StaticResource HalfNumber}}"
<Border CornerRadius="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=ActualHeight,Converter={StaticResource HalfNumber}}"
BorderThickness="1" Background="{StaticResource ControlBackground}" BorderBrush="{TemplateBinding BorderBrush}">
<Grid>
<Ellipse x:Name="ELLIPSE" HorizontalAlignment="Left" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5"
<Ellipse x:Name="ELLIPSE" HorizontalAlignment="Left" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5"
Fill="Gray" Stroke="{StaticResource ControlBorderBrush}" StrokeThickness="1">
<Ellipse.RenderTransform>
<TransformGroup>
@@ -630,7 +725,7 @@
<Ellipse Margin="12" Fill="{TemplateBinding Background}" Width="8" Height="8" VerticalAlignment="Bottom">
</Ellipse>
</Grid>
<TextBlock Text="{Binding Value,RelativeSource={RelativeSource Mode=TemplatedParent}, StringFormat={}{0:F2}}"
<TextBlock Text="{Binding Value,RelativeSource={RelativeSource Mode=TemplatedParent}, StringFormat={}{0:F2}}"
VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}"/>
</Grid>
</ControlTemplate>
@@ -638,32 +733,44 @@
</Setter>
</Style>-->
<!--#endregion-->
<!--#region 控制集合-->
<Style TargetType="{x:Type ToggleButton}" >
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontFamily" Value="Microsoft YaHei"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="FontWeight" Value="Bold"/>
<Style TargetType="{x:Type ToggleButton}">
<Setter Property="Foreground" Value="White" />
<Setter Property="FontFamily" Value="Microsoft YaHei" />
<Setter Property="FontSize" Value="12" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="0" CornerRadius="2">
<Border
BorderBrush="{TemplateBinding Control.BorderBrush}"
BorderThickness="0"
CornerRadius="2">
<Border.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FF71E0C6" Offset="0.0" />
<GradientStop Color="#FF43A88D" Offset="0.2" />
<GradientStop Color="#FF5BB07D" Offset="0.0" />
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Offset="0.0" Color="#FF71E0C6" />
<GradientStop Offset="0.2" Color="#FF43A88D" />
<GradientStop Offset="0.0" Color="#FF5BB07D" />
</LinearGradientBrush>
</Border.Background>
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" ></ContentPresenter>
<ContentPresenter
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding ContentControl.Content}" />
</Border>
<ControlTemplate.Triggers>

<Trigger Property="ButtonBase.IsPressed" Value="True">
<Setter Property="UIElement.Effect">
<Setter.Value>
<DropShadowEffect BlurRadius="10" Color="#276AB0" Direction="0" Opacity="0.9" RenderingBias="Performance" ShadowDepth="0" />
<DropShadowEffect
BlurRadius="10"
Direction="0"
Opacity="0.9"
RenderingBias="Performance"
ShadowDepth="0"
Color="#276AB0" />
</Setter.Value>
</Setter>
<Setter Property="RenderTransform">
@@ -680,7 +787,10 @@
</Setter>
</Style>
<DataTemplate x:Key="Category">
<TextBlock Text="{Binding}" FontSize="20" Foreground="#4EB9E4" />
<TextBlock
FontSize="20"
Foreground="#4EB9E4"
Text="{Binding}" />
</DataTemplate>
<!--#endregion-->
</ResourceDictionary>

+ 46
- 0
SmartClient.sln Целия файл

@@ -178,6 +178,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BeDesignerSCADA", "BeDesign
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmart.RecipeManagement", "BPASmart.RecipeManagement\BPASmart.RecipeManagement.csproj", "{28EBFC11-184A-4B88-A7B3-84F3FD768520}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmart.SmallBatchingSystem", "BPASmart.SmallBatchingSystem\BPASmart.SmallBatchingSystem.csproj", "{DB6DC970-859C-4C63-AE9B-BA415D56CECD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmart.ConfigurationSoftware", "BPASmart.ConfigurationSoftware\BPASmart.ConfigurationSoftware.csproj", "{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -1612,6 +1616,46 @@ Global
{28EBFC11-184A-4B88-A7B3-84F3FD768520}.Release|x64.Build.0 = Release|Any CPU
{28EBFC11-184A-4B88-A7B3-84F3FD768520}.Release|x86.ActiveCfg = Release|Any CPU
{28EBFC11-184A-4B88-A7B3-84F3FD768520}.Release|x86.Build.0 = Release|Any CPU
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|ARM.ActiveCfg = Debug|Any CPU
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|ARM.Build.0 = Debug|Any CPU
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|ARM64.Build.0 = Debug|Any CPU
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|x64.ActiveCfg = Debug|Any CPU
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|x64.Build.0 = Debug|Any CPU
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|x86.ActiveCfg = Debug|Any CPU
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|x86.Build.0 = Debug|Any CPU
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|Any CPU.Build.0 = Release|Any CPU
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|ARM.ActiveCfg = Release|Any CPU
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|ARM.Build.0 = Release|Any CPU
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|ARM64.ActiveCfg = Release|Any CPU
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|ARM64.Build.0 = Release|Any CPU
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|x64.ActiveCfg = Release|Any CPU
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|x64.Build.0 = Release|Any CPU
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|x86.ActiveCfg = Release|Any CPU
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|x86.Build.0 = Release|Any CPU
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}.Debug|ARM.ActiveCfg = Debug|Any CPU
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}.Debug|ARM.Build.0 = Debug|Any CPU
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}.Debug|ARM64.Build.0 = Debug|Any CPU
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}.Debug|x64.ActiveCfg = Debug|Any CPU
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}.Debug|x64.Build.0 = Debug|Any CPU
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}.Debug|x86.ActiveCfg = Debug|Any CPU
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}.Debug|x86.Build.0 = Debug|Any CPU
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}.Release|Any CPU.Build.0 = Release|Any CPU
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}.Release|ARM.ActiveCfg = Release|Any CPU
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}.Release|ARM.Build.0 = Release|Any CPU
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}.Release|ARM64.ActiveCfg = Release|Any CPU
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}.Release|ARM64.Build.0 = Release|Any CPU
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}.Release|x64.ActiveCfg = Release|Any CPU
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}.Release|x64.Build.0 = Release|Any CPU
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}.Release|x86.ActiveCfg = Release|Any CPU
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1694,6 +1738,8 @@ Global
{06F0B369-0483-46DD-82D2-70431FB505C1} = {7B0175AD-BB74-4A98-B9A7-1E289032485E}
{DF8B4C38-39DE-4220-AB60-885CAE6D1E47} = {06F0B369-0483-46DD-82D2-70431FB505C1}
{28EBFC11-184A-4B88-A7B3-84F3FD768520} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086}
{DB6DC970-859C-4C63-AE9B-BA415D56CECD} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086}
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC}


Зареждане…
Отказ
Запис