pengliangyang 2 anni fa
parent
commit
0a6932d2cf
37 ha cambiato i file con 1137 aggiunte e 28 eliminazioni
  1. +1
    -0
      BPASmart.MenuLoad/BPASmart.MenuLoad.csproj
  2. +16
    -0
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  3. +28
    -0
      BPASmartClient.CustomResource/Converters/BoolToVisibilityConvert.cs
  4. BIN
     
  5. BIN
     
  6. BIN
     
  7. BIN
     
  8. BIN
     
  9. BIN
     
  10. BIN
     
  11. BIN
     
  12. +16
    -0
      BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj
  13. BIN
     
  14. BIN
     
  15. BIN
     
  16. BIN
     
  17. +58
    -0
      BPASmartClient.SCADAControl/Themes/Generic.xaml
  18. +8
    -0
      BeDesignerSCADA/BeDesignerSCADA.csproj
  19. +5
    -0
      BeDesignerSCADA/Controls/CanvasPanelNew.xaml
  20. +254
    -0
      BeDesignerSCADA/Controls/CodeCanvasPanel.xaml
  21. +266
    -0
      BeDesignerSCADA/Controls/CodeCanvasPanel.xaml.cs
  22. +60
    -0
      BeDesignerSCADA/Helper/IniFile.cs
  23. BIN
     
  24. BIN
     
  25. BIN
     
  26. BIN
     
  27. +18
    -0
      BeDesignerSCADA/MainWindow.xaml
  28. +2
    -0
      BeDesignerSCADA/MainWindow.xaml.cs
  29. +3
    -0
      BeDesignerSCADA/Themes/Styles.xaml
  30. +51
    -0
      BeDesignerSCADA/View/MyMessageBox.xaml
  31. +126
    -0
      BeDesignerSCADA/View/MyMessageBox.xaml.cs
  32. +71
    -12
      BeDesignerSCADA/ViewModel/MainViewModelNew.cs
  33. +1
    -0
      DosingSystem/App.xaml
  34. +5
    -2
      DosingSystem/Model/DeviceCurrentStatus.cs
  35. +89
    -7
      DosingSystem/View/HardwareStatusView.xaml
  36. +34
    -6
      DosingSystem/View/RecipeSettingsView.xaml
  37. +25
    -1
      DosingSystem/View/StockControlView.xaml

+ 1
- 0
BPASmart.MenuLoad/BPASmart.MenuLoad.csproj Vedi File

@@ -19,6 +19,7 @@

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

<ItemGroup>


+ 16
- 0
BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj Vedi File

@@ -213,6 +213,14 @@
<None Remove="Image\背景矢量\左下.png" />
<None Remove="Image\背景矢量\矢量智能对象.png" />
<None Remove="Image\背景边框4.png" />
<None Remove="Image\荧光\29.png" />
<None Remove="Image\荧光\发光.png" />
<None Remove="Image\荧光\向下箭头.png" />
<None Remove="Image\荧光\底座.png" />
<None Remove="Image\荧光\矩形发光.png" />
<None Remove="Image\荧光\立体三角.png" />
<None Remove="Image\荧光\蓝色提示框.png" />
<None Remove="Image\荧光\返回.png" />
<None Remove="Image\营销额.png" />
<None Remove="Image\蓝色背景.png" />
<None Remove="Image\蓝边框.png" />
@@ -356,6 +364,14 @@
<Resource Include="Image\背景3.jpg" />
<Resource Include="Image\背景框.png" />
<Resource Include="Image\背景边框4.png" />
<Resource Include="Image\荧光\29.png" />
<Resource Include="Image\荧光\发光.png" />
<Resource Include="Image\荧光\向下箭头.png" />
<Resource Include="Image\荧光\底座.png" />
<Resource Include="Image\荧光\矩形发光.png" />
<Resource Include="Image\荧光\立体三角.png" />
<Resource Include="Image\荧光\蓝色提示框.png" />
<Resource Include="Image\荧光\返回.png" />
<Resource Include="Image\蓝色背景.png" />
<Resource Include="Image\蓝边框.png" />
<Resource Include="Image\调味品.jpeg" />


+ 28
- 0
BPASmartClient.CustomResource/Converters/BoolToVisibilityConvert.cs Vedi File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;

namespace BPASmartClient.CustomResource.Converters
{
public class BoolToVisibilityConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null && value is bool tempBool)
{
return tempBool ? Visibility.Visible : Visibility.Hidden;
}
return default;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


+ 16
- 0
BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj Vedi File

@@ -47,6 +47,8 @@
<None Remove="Images\State2.png" />
<None Remove="Images\Tab4_No.png" />
<None Remove="Images\Tab4_Select.png" />
<None Remove="Images\Tab_NoWZBJ.png" />
<None Remove="Images\Tab_SelectWZBJ.png" />
<None Remove="Images\timericon.png" />
<None Remove="Images\上箭头.png" />
<None Remove="Images\借出.png" />
@@ -70,6 +72,8 @@
<None Remove="Images\矩形边框.png" />
<None Remove="Images\矩形边框1.png" />
<None Remove="Images\系统名称.png" />
<None Remove="Images\组 7.png" />
<None Remove="Images\组 8.png" />
<None Remove="Images\背景2.png" />
<None Remove="Images\返回按钮1.png" />
<None Remove="Images\返回按钮2.png" />
@@ -211,6 +215,12 @@
<Resource Include="Images\Tab4_Select.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\Tab_NoWZBJ.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\Tab_SelectWZBJ.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\timericon.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
@@ -289,6 +299,12 @@
<Resource Include="Images\系统名称.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\组 7.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\组 8.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\背景2.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


+ 58
- 0
BPASmartClient.SCADAControl/Themes/Generic.xaml Vedi File

@@ -2047,6 +2047,64 @@
</Setter>
</Style>

<Style x:Key="TitleTabItem" TargetType="{x:Type TabItem}">
<Setter Property="FocusVisualStyle" Value="{StaticResource TabItemFocusVisual}" />
<Setter Property="Padding" Value="10,2,10,2" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabItem}">
<Border
x:Name="Bd"
Height="30"
Margin="5"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="0">
<ContentPresenter
x:Name="Content"
HorizontalAlignment="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"
VerticalAlignment="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"
ContentSource="Header"
Cursor="Hand"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="true">
<Setter Property="Foreground" Value="#FFD4DEE0" />
<Setter TargetName="Bd" Property="Background">
<Setter.Value>
<ImageBrush ImageSource="../Images/Tab_SelectWZBJ.png" />
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsSelected" Value="False">
<Setter Property="Foreground" Value="#FF18A9C9" />
<Setter TargetName="Bd" Property="Background">
<Setter.Value>
<ImageBrush ImageSource="../Images/Tab_NoWZBJ.png" />
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="#FFD4DEE0" />
<Setter TargetName="Bd" Property="Background">
<Setter.Value>
<ImageBrush ImageSource="../Images/Tab_SelectWZBJ.png" />
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<!--#region ScrollBar-->
<Style x:Key="UpScrollBarButton" TargetType="{x:Type RepeatButton}">
<Setter Property="OverridesDefaultStyle" Value="true" />


+ 8
- 0
BeDesignerSCADA/BeDesignerSCADA.csproj Vedi File

@@ -60,11 +60,14 @@
<ItemGroup>
<None Remove="Fonts\ds-digib.ttf" />
<None Remove="Images\bj.png" />
<None Remove="Images\error.png" />
<None Remove="Images\Exp.png" />
<None Remove="Images\fyf.ico" />
<None Remove="Images\gaugeMask.png" />
<None Remove="Images\hbl.ico" />
<None Remove="Images\ico.ico" />
<None Remove="Images\info.png" />
<None Remove="Images\question.png" />
<None Remove="Images\redis.png" />
<None Remove="Images\State0.png" />
<None Remove="Images\State1.png" />
@@ -75,6 +78,7 @@
<None Remove="Images\wx.jpg" />
<None Remove="Images\zfb.jpg" />
<None Remove="Images\光柱.png" />
<None Remove="Images\报错.png" />
<None Remove="Images\配置.ico" />
</ItemGroup>

@@ -94,11 +98,14 @@
<ItemGroup>
<Resource Include="Fonts\ds-digib.ttf" />
<Resource Include="Images\bj.png" />
<Resource Include="Images\error.png" />
<Resource Include="Images\Exp.png" />
<Resource Include="Images\fyf.ico" />
<Resource Include="Images\gaugeMask.png" />
<Resource Include="Images\hbl.ico" />
<Resource Include="Images\ico.ico" />
<Resource Include="Images\info.png" />
<Resource Include="Images\question.png" />
<Resource Include="Images\redis.png" />
<Resource Include="Images\State0.png" />
<Resource Include="Images\State1.png" />
@@ -111,6 +118,7 @@
<Resource Include="Images\光柱.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\报错.png" />
<Resource Include="Images\配置.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>


+ 5
- 0
BeDesignerSCADA/Controls/CanvasPanelNew.xaml Vedi File

@@ -69,6 +69,11 @@
<icon:PackIconModern Width="10" HorizontalAlignment="Center" Kind="Delete" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="清空该页" Command="{Binding ClearPageCommand}" CommandParameter="{Binding MenuModel.SelectPageModels}">
<MenuItem.Icon>
<icon:PackIconModern Width="10" HorizontalAlignment="Center" Kind="Clean" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="(加载)页面" Command="{Binding LoadAllPageCommand}">
<MenuItem.Icon>
<icon:PackIconModern Width="10" HorizontalAlignment="Center" Kind="DiskDownload" />


+ 254
- 0
BeDesignerSCADA/Controls/CodeCanvasPanel.xaml Vedi File

@@ -0,0 +1,254 @@
<UserControl x:Class="BeDesignerSCADA.Controls.CodeCanvasPanel"
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:icon="http://metro.mahapps.com/winfx/xaml/iconpacks"
mc:Ignorable="d"
d:DesignHeight="900" d:DesignWidth="1400">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/可视化配置工具;component/Themes/Styles.xaml"></ResourceDictionary>
<ResourceDictionary Source="/BPASmartClient.SCADAControl;component/Themes/Generic.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="245"/>
<ColumnDefinition/>
<ColumnDefinition Width="320"/>
</Grid.ColumnDefinitions>

<!--左侧选择区域-->
<TabControl x:Name="LeftSelectTab" SelectedIndex="0">
<TabItem Header="页面编辑">
<Border BorderThickness="1" BorderBrush="#FFA9A9A9" Background="Transparent" >
<Grid >
</Grid>
</Border>
</TabItem>

<TabItem Header="组件列表">
<Border BorderThickness="1" BorderBrush="#FFA9A9A9" Background="Transparent">
</Border>
</TabItem>

<TabItem Header="菜单布局">
<Border BorderThickness="1" BorderBrush="#FFA9A9A9" Background="Transparent">

</Border>
</TabItem>
</TabControl>

<!--中间控制区域-->
<DockPanel Grid.Column="1">
<!--按钮控制-->
<DockPanel LastChildFill="False" DockPanel.Dock="Top" Height="24" Margin="4 4 4 0">
<Button Margin="5" Grid.Column="2" Click="OnNew" Name="ButtonNew" ToolTip="创建新工程" Focusable="True" Width="24">
<Button.Template>
<ControlTemplate>
<icon:PackIconModern x:Name="Icon" Kind="PageCode"/>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Icon" Property="Foreground" Value="Green"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<Button Margin="5" Grid.Column="2" Click="OnOpen" Name="ButtonOpen" IsEnabled="True" ToolTip="" Width="24">
<Button.Template>
<ControlTemplate>
<icon:PackIconModern x:Name="Icon" Kind="FolderOpen"/>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Icon" Property="Foreground" Value="Green"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<Button Margin="5" Grid.Column="2" Click="OnSave" Name="ButtonSave" IsEnabled="False" ToolTip="" Width="24">
<Button.Template>
<ControlTemplate>
<icon:PackIconModern x:Name="Icon" Kind="Save"/>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Icon" Property="Foreground" Value="Green"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<Button Margin="5" Grid.Column="2" Name="ButtonSaveAs" IsEnabled="False" ToolTip="" Width="24" Click="OnSaveAs">
<Button.Template>
<ControlTemplate>
<icon:PackIconModern x:Name="Icon" Kind="Archive"/>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Icon" Property="Foreground" Value="Green"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<Button Margin="5" Grid.Column="2" Name="ButtonPrint" IsEnabled="False" ToolTip="" Width="24" Visibility="Collapsed" Click="OnPrint">
<Button.Template>
<ControlTemplate>
<icon:PackIconModern x:Name="Icon" Kind="Printer"/>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Icon" Property="Foreground" Value="Green"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}"/>
<Button Margin="5" Grid.Column="2" Name="ButtonCopy" IsEnabled="{Binding ElementName=Editor, Path=IsCopyEnabled}" ToolTip="" Width="24" Click="OnCopy">
<Button.Template>
<ControlTemplate>
<icon:PackIconModern x:Name="Icon" Kind="PageCopy"/>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Icon" Property="Foreground" Value="Green"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<Button Margin="5" Grid.Column="2" Name="ButtonPaste" IsEnabled="{Binding ElementName=Editor, Path=IsPasteEnabled}" ToolTip="" Width="24" Click="OnPaste">
<Button.Template>
<ControlTemplate>
<icon:PackIconModern x:Name="Icon" Kind="ClipboardPaste"/>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Icon" Property="Foreground" Value="Green"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}"/>
<Button Margin="5" Grid.Column="2" Click="OnStartRun" Name="ButtonStart" IsEnabled="False" ToolTip="" Width="24">
<Button.Template>
<ControlTemplate>
<icon:PackIconModern x:Name="Icon" Kind="ControlPlay"/>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Icon" Property="Foreground" Value="DarkBlue"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<Button Margin="5" Grid.Column="3" Click="OnStopRun" Name="ButtonStop" IsEnabled="False" Visibility="Visible" ToolTip="">
<Button.Template>
<ControlTemplate TargetType="Button">
<icon:PackIconModern x:Name="Icon" Kind="ControlStop"/>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Icon" Property="Foreground" Value="DarkBlue"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<Button Margin="5" Grid.Column="3" Click="OnClearError" IsEnabled="False" Name="ButtonClearError" Visibility="Visible" ToolTip="" Width="24">
<Button.Template>
<ControlTemplate TargetType="Button">
<icon:PackIconModern x:Name="Icon" Kind="StarRemove"/>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
<Setter TargetName="Icon" Property="Spin" Value="False"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<ToggleButton Name="ButtonHighligh" ToolTip="" IsChecked="False" Width="24"
Click="OnHighlightClicked">
<ToggleButton.Template>
<ControlTemplate TargetType="ToggleButton">
<icon:PackIconModern x:Name="Icon" Kind="Flag"/>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="Icon" Property="Foreground" Value="Green"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</ToggleButton.Template>
</ToggleButton>
<Slider ToolTip="运行速度" Minimum="0" Maximum="100" Margin="15, 0" Value="20" Name="SliderSpeeder"
Width="150" VerticalAlignment="Center" ValueChanged="OnSpeedValueChanged"/>
</DockPanel>

<!--中间画布-->
<Border BorderThickness="1" BorderBrush="{StaticResource AccentBrush}" Margin="4">
<Border.Background>
<ImageBrush ImageSource="../Images/bj.png" Stretch="UniformToFill"/>
</Border.Background>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>

<ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible">
<Grid>
<!--画布区域-->
</Grid>
</ScrollViewer>


<TextBlock HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,20,20" FontSize="16" Foreground="Red">分辨率:1920×1080</TextBlock>
</Grid>
</Border>
</DockPanel>
<!--右侧属性栏-->
<Grid Grid.Column="2">
<TabControl x:Name="ReditSeleceTab" SelectedIndex="0">
<TabItem Header="属性栏">

</TabItem>
</TabControl>
</Grid>


</Grid>
</UserControl>

+ 266
- 0
BeDesignerSCADA/Controls/CodeCanvasPanel.xaml.cs Vedi File

@@ -0,0 +1,266 @@
using BeDesignerSCADA.Helper;
using Microsoft.Win32;
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 BeDesignerSCADA.Controls
{
/// <summary>
/// CodeCanvasPanel.xaml 的交互逻辑
/// </summary>
public partial class CodeCanvasPanel : UserControl
{
public CodeCanvasPanel()
{
InitializeComponent();
}

#region 变量
string _currentFile;
public string File
{
get
{
if (string.IsNullOrEmpty(_currentFile))
_currentFile = IniFile.ReadValue("Editor", "LastOpen");
return _currentFile;
}
set
{
_currentFile = value;
IniFile.WriteValue("Editor", "LastOpen", value);
}
}
string _lastFolder = null;
public string LastFolder
{
get
{
if (string.IsNullOrEmpty(_lastFolder))
{
_lastFolder = IniFile.ReadValue("Editor", "LastFolder");
}
if (string.IsNullOrEmpty(_lastFolder))
{
_lastFolder = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "VisualCodeEditor");

}
return _lastFolder;
}
set
{
_lastFolder = value;
IniFile.WriteValue("Editor", "LastFolder", value);
}
}
#endregion

#region 操作按钮
private void OnNew(object sender, RoutedEventArgs e)
{
e.Handled = true;
File = null;
//Title = "Visual Code Editor";
//using (var stream = GetType().Assembly.GetManifestResourceStream("ScratchNet.scripts.main.vsc"))
//{
// //Script script = Serialization.Load(stream) as Script;
// //SetupScriptToolbar(script);
// //Editor.Script = script;
// stream.Close();
//}
//Editor.IsEnabled = true;
ButtonOpen.IsEnabled = true;
ButtonSave.IsEnabled = true;
ButtonStart.IsEnabled = true;
ButtonSaveAs.IsEnabled = true;
ButtonPrint.IsEnabled = true;
//Editor.IsModified = true;
}
private void OnOpen(object sender, RoutedEventArgs e)
{
e.Handled = true;
OpenFileDialog dlg = new OpenFileDialog();
dlg.DefaultExt = ".vsc";
dlg.Filter = "Visual Script Files (*.vsc)|*.vsc|All Files (*.*)|*.*";
dlg.Multiselect = false;
dlg.InitialDirectory = LastFolder;
Nullable<bool> result = dlg.ShowDialog();
if (result == true)
{
//Editor.Script = null;
//Editor.IsEnabled = false;
//File = dlg.FileName;
//LastFolder = new FileInfo(dlg.FileName).DirectoryName;
//try
//{
// Script script = Serialization.Load(File) as Script;
// SetupScriptToolbar(script);
// Editor.Script = script;
// if (script == null)
// return;
// this.Title = Properties.Resources.VisualCodeEditor + " - " + File;
// Editor.IsModified = false;
// ShowMessage(toast.ShowSuccess, string.Format(Properties.Resources.SuccessLodFile, File));
//}
//catch (Exception ex)
//{
// MessageBox.Show(string.Format(Properties.Resources.ExceptionLoadFile, File));
// return;
//}
//Editor.IsEnabled = true;
ButtonOpen.IsEnabled = true;
ButtonSave.IsEnabled = true;
ButtonStart.IsEnabled = true;
ButtonSaveAs.IsEnabled = true;
ButtonPrint.IsEnabled = true;
ButtonStart.IsEnabled = true;
}
}
private void OnSave(object sender, RoutedEventArgs e)
{
//if (string.IsNullOrEmpty(File))
//{
// SaveFileDialog dlg = new SaveFileDialog();
// dlg.DefaultExt = ".vsc";
// dlg.Filter = "Visual Script Files (*.vsc)|*.vsc|All Files (*.*)|*.*";
// //dlg.Multiselect = false;
// if (!string.IsNullOrEmpty(LastFolder))
// dlg.InitialDirectory = LastFolder;

// Nullable<bool> result = dlg.ShowDialog();
// if (result != true)
// {
// return;
// }
// File = dlg.FileName;
// Title = Properties.Resources.VisualCodeEditor + " - " + File;
// LastFolder = new FileInfo(dlg.FileName).DirectoryName;
//}
//Serialization.Save((Script)Editor.Script, File);
//ShowMessage(toast.ShowSuccess, string.Format(Properties.Resources.SuccessLodFile, File));
//Editor.IsModified = false;
//ButtonOpen.IsEnabled = true;
//ButtonSave.IsEnabled = true;
//ButtonStart.IsEnabled = true;
//ButtonSaveAs.IsEnabled = true;
//ButtonPrint.IsEnabled = true;
}
private void OnSaveAs(object sender, RoutedEventArgs e)
{
//e.Handled = true;
//SaveFileDialog dlg = new SaveFileDialog();
//dlg.DefaultExt = ".vsc";
//dlg.Filter = "Visual Script Files (*.vsc)|*.vsc|All Files (*.*)|*.*";
////dlg.Multiselect = false;
//dlg.InitialDirectory = LastFolder;

//Nullable<bool> result = dlg.ShowDialog();
//if (result != true)
//{
// return;
//}
//File = dlg.FileName;
//LastFolder = new FileInfo(dlg.FileName).DirectoryName;
//Serialization.Save((Script)Editor.Script, File);
//Title = Properties.Resources.VisualCodeEditor + " - " + File;
//ShowMessage(toast.ShowSuccess, string.Format(Properties.Resources.SuccessLodFile, File));
//Editor.IsModified = false;
//ButtonOpen.IsEnabled = true;
//ButtonSave.IsEnabled = true;
//ButtonStart.IsEnabled = true;
//ButtonSaveAs.IsEnabled = true;
//ButtonPrint.IsEnabled = true;
}
private void OnPrint(object sender, RoutedEventArgs e)
{
//e.Handled = true;
//Editor.Print();
}
private void OnCopy(object sender, RoutedEventArgs e)
{
//Editor.Copy();
}
private void OnPaste(object sender, RoutedEventArgs e)
{
//Editor.Paste(new Point());
}
private void OnStartRun(object sender, RoutedEventArgs e)
{
//Editor.ClearHighlight();
//stackTrace.Clear();
////check main function
//bool hasMain = false;
//foreach (var f in Editor.Script.Functions)
//{
// if (f.Name.Equals("main", StringComparison.OrdinalIgnoreCase))
// {
// hasMain = true;
// break;
// }
//}
//if (!hasMain)
//{
// MessageBox.Show(Properties.Resources.MainNotFound, Properties.Resources.NoMain, MessageBoxButton.OK, MessageBoxImage.Warning);
// return;
//}
//ButtonClearError.IsEnabled = false;
//IsHighlightStep = ButtonHighligh.IsChecked.Value;
//stackTrace.Clear();
//engine = new ExecutionEnvironment();
//engine.EnterNode += Engine_EnterNode;
//engine.LeaveNode += Engine_LeaveNode;
//ButtonStart.IsEnabled = false;
//ButtonStop.IsEnabled = true;
////Editor.IsEnabled = false;
//engine.ExecutionCompleted += Engine_ExecutionCompleted;
//engine.ExecutionAborted += Engine_ExecutionAborted;
//engine.ExecuteAsync(Editor.Script);
//Console.WriteLine("Start run");
return;
}
private void OnStopRun(object sender, RoutedEventArgs e)
{

//if (engine != null)
//{
// engine.EnterNode -= Engine_EnterNode;
// engine.LeaveNode -= Engine_LeaveNode;
// //Editor.IsEnabled = false;
// engine.ExecutionCompleted -= Engine_ExecutionCompleted;
// engine.ExecutionAborted -= Engine_ExecutionAborted;
// engine.Stop();
// PrintLnStatement.Stop();
// engine = null;
// ButtonStart.IsEnabled = true;
// ButtonStop.IsEnabled = false;
//}

}
private void OnClearError(object sender, RoutedEventArgs e)
{
//ButtonClearError.IsEnabled = false;
//Editor.ClearHighlight();
}
private void OnHighlightClicked(object sender, RoutedEventArgs e)
{
// IsHighlightStep = ButtonHighligh.IsChecked.Value;
}
private void OnSpeedValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{

}
#endregion
}
}

+ 60
- 0
BeDesignerSCADA/Helper/IniFile.cs Vedi File

@@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace BeDesignerSCADA.Helper
{
/// <summary>
/// 文件帮助类
/// </summary>
public class IniFile
{
#region ini
[DllImport("kernel32")]
internal static extern long WritePrivateProfileString(string section,
string key, string val, string filePath);
[DllImport("kernel32")]
internal static extern int GetPrivateProfileString(string section,
string key, string def, StringBuilder retVal,
int size, string filePath);
[DllImport("kernel32.dll")]
private static extern int GetPrivateProfileSection(string lpAppName, byte[] lpszReturnBuffer, int nSize, string lpFileName);

static string configFile = null;
public static string ConfigFileName
{
get
{
if (string.IsNullOrEmpty(configFile))
{
string configFolder = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "VisualCodeEditor");
if (!Directory.Exists(configFolder))
Directory.CreateDirectory(configFolder);
configFile = System.IO.Path.Combine(configFolder, ".config");
}
return configFile;
}
}
public static void WriteValue(string Section, string Key, string Value)
{
WritePrivateProfileString(Section, Key, Value, ConfigFileName);
}

public static string ReadValue(string Section, string Key)
{
StringBuilder temp = new StringBuilder(255);
int i = GetPrivateProfileString(Section, Key, "", temp,
255, ConfigFileName);
if (i <= 0)
return null;
String Value = temp.ToString();
return Value;

}
#endregion ini
}
}

BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


BIN
Vedi File


+ 18
- 0
BeDesignerSCADA/MainWindow.xaml Vedi File

@@ -12,6 +12,24 @@
mc:Ignorable="d"
WindowStartupLocation="CenterScreen" Height="900" Width="1400"
Title="黑菠萝科技-[组态软件1.0]" Icon="/Images/ico.ico" >
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/可视化配置工具;component/Themes/Styles.xaml"></ResourceDictionary>
<ResourceDictionary Source="/BPASmartClient.SCADAControl;component/Themes/Generic.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<!--<TabControl x:Name="ReditSeleceTab" SelectedIndex="0">
<TabItem Header="可视化界面编辑器" >
<Border x:Name="grid">
</Border>
</TabItem>
<TabItem Header="图形化服务编辑器" >
<Border x:Name="gridCode">
</Border>
</TabItem>
</TabControl>-->
<Border x:Name="grid">
</Border>
</Window>

+ 2
- 0
BeDesignerSCADA/MainWindow.xaml.cs Vedi File

@@ -9,10 +9,12 @@ namespace BeDesignerSCADA
public partial class MainWindow : Window
{
CanvasPanelNew mainCanvas = new CanvasPanelNew($"{System.AppDomain.CurrentDomain.BaseDirectory}Layouts\\可视化界面菜单布局.yf");
CodeCanvasPanel codeCanvasPanel = new CodeCanvasPanel();
public MainWindow()
{
InitializeComponent();
grid.Child = mainCanvas;
//gridCode.Child = codeCanvasPanel;
}
}
}

+ 3
- 0
BeDesignerSCADA/Themes/Styles.xaml Vedi File

@@ -239,6 +239,9 @@
<Button Width="24" Cursor="Hand" BorderBrush="Transparent" Background="Transparent" CommandParameter="{Binding .}" Command="{Binding DataContext.DeletePageCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}" VerticalAlignment="Center" Padding="0" ToolTip="删除页">
<icon:PackIconModern ToolTip="删除页" Width="10" HorizontalAlignment="Center" Foreground="White" Kind="Delete" />
</Button>
<Button Width="24" Cursor="Hand" BorderBrush="Transparent" Background="Transparent" CommandParameter="{Binding .}" Command="{Binding DataContext.ClearPageCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}" VerticalAlignment="Center" Padding="0" ToolTip="清空页">
<icon:PackIconModern ToolTip="清空页" Width="10" HorizontalAlignment="Center" Foreground="White" Kind="Clean" />
</Button>
</StackPanel>
</Grid>
<ControlTemplate.Triggers>


+ 51
- 0
BeDesignerSCADA/View/MyMessageBox.xaml Vedi File

@@ -0,0 +1,51 @@
<Window x:Class="BeDesignerSCADA.View.MyMessageBox"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BeDesignerSCADA.View"
x:Name="frmMessageBox"
WindowState="Normal"
WindowStyle="None"
WindowStartupLocation="CenterScreen"
Title="提示" Height="150" Width="393">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="19"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid Grid.Row="0" Grid.ColumnSpan="2">
<TextBlock Margin="10,0,0,0" FontSize="18" FontFamily="宋体" VerticalAlignment="Center" HorizontalAlignment="Left">提示</TextBlock>
<Image Margin="0,0,10,0" VerticalAlignment="Center" HorizontalAlignment="Right" Source="../Images/报错.png" Cursor="Hand" MouseLeftButtonDown="Image_MouseLeftButtonDown"></Image>
</Grid>

<Image Grid.Row="1" x:Name="picICO" Width="70" Height="70" HorizontalAlignment="Center" VerticalAlignment="Center" Source="../Images/bj.png" Stretch="Fill"></Image>
<Grid Grid.Column="1" Grid.Row="1" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="224*"/>
<ColumnDefinition Width="69*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<Border Padding="10" Grid.ColumnSpan="2">
<TextBlock x:Name="labInfo" Grid.Row="0" Text="确定要删除数据吗?" FontSize="18" FontFamily="宋体" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock>
</Border>
<Grid Grid.Row="1" Grid.ColumnSpan="2">
<StackPanel x:Name="panel2" Orientation="Horizontal">
<Button x:Name="btnYes" Cursor="Hand" Width="110" Height="31" Content="是(Y)" HorizontalAlignment="Left" VerticalAlignment="Top" ></Button>
<Button x:Name="btnNo" Cursor="Hand" Width="110" Margin="30,0,0,0" Height="31" Content="否(N)" HorizontalAlignment="Left" VerticalAlignment="Top"></Button>
</StackPanel>
<StackPanel x:Name="panel1" Orientation="Horizontal" Visibility="Collapsed">
<Button x:Name="btnOk" Cursor="Hand" Width="250" Height="31" Content="确定(O)" HorizontalAlignment="Left" VerticalAlignment="Top" ></Button>
</StackPanel>
</Grid>
</Grid>
</Grid>
</Window>


+ 126
- 0
BeDesignerSCADA/View/MyMessageBox.xaml.cs Vedi File

@@ -0,0 +1,126 @@
using System;
using System.Collections.Generic;
using System.Drawing;
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.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace BeDesignerSCADA.View
{
/// <summary>
/// MyMessageBox.xaml 的交互逻辑
/// </summary>
public partial class MyMessageBox : Window
{
public MyMessageBox(MessageBoxStyle messageBoxStyle, string msg)
{
InitializeComponent();
this.Width = 393;
btnYes.Click += BtnYes_Click;
btnNo.Click += BtnNo_Click;
btnOk.Click += BtnOk_Click;
this.KeyDown += MyMessageBox_KeyDown;
if (messageBoxStyle == MessageBoxStyle.info)
{
picICO.Source = new BitmapImage(new Uri("../Images/info.png", UriKind.Relative));
//picICO.Image = global::myAlarmSystem.Properties.Resources.info;
this.Title = "提示";
panel1.Visibility = Visibility.Visible;
panel2.Visibility = Visibility.Collapsed;
}
else if (messageBoxStyle == MessageBoxStyle.question)
{
picICO.Source = new BitmapImage(new Uri("../Images/question.png", UriKind.Relative));
//picICO.Image = global::myAlarmSystem.Properties.Resources.question;
this.Title = "询问";
panel1.Visibility = Visibility.Collapsed;
panel2.Visibility = Visibility.Visible;
}
else if (messageBoxStyle == MessageBoxStyle.error)
{
picICO.Source = new BitmapImage(new Uri("../Images/error.png", UriKind.Relative));
//picICO.Image = global::myAlarmSystem.Properties.Resources.error;
this.Title = "错误";
panel1.Visibility = Visibility.Visible;
panel2.Visibility = Visibility.Collapsed;
}

this.labInfo.Text = msg;

SizeF size = TextRenderer.MeasureText(msg, new Font("宋体", 15, System.Drawing.FontStyle.Regular));

int TempWidth = (int)size.Width;
if (TempWidth <= 289) { return; }

this.Height = 150 + ((int)size.Width / 289) * 20;
//this.panel1.Width = TempWidth - 20;
//this.panel2.Width = TempWidth - 20;
//btnYes.Width = TempWidth / 2 - 20;
//btnNo.Width = TempWidth / 2 - 20;
}

private void MyMessageBox_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{
if (e.KeyStates == Keyboard.GetKeyStates(Key.N))
{
BtnNo_Click(null, null);
}
else if (e.KeyStates == Keyboard.GetKeyStates(Key.Y))
{
BtnYes_Click(null, null);
}
else if (e.KeyStates == Keyboard.GetKeyStates(Key.O))
{
BtnOk_Click(null, null);
}
}

private void BtnOk_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = true;
}

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

private void BtnYes_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = true;
}

private void Image_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
this.Close();
}
}

/// <summary>
/// 消息样式类型
/// </summary>
public enum MessageBoxStyle
{
/// <summary>
/// 通知
/// </summary>
info = 0,
/// <summary>
/// 选择
/// </summary>
question = 1,
/// <summary>
/// 错误
/// </summary>
error = 2
};
}

+ 71
- 12
BeDesignerSCADA/ViewModel/MainViewModelNew.cs Vedi File

@@ -11,6 +11,7 @@ using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Windows;
@@ -425,6 +426,10 @@ namespace BeDesignerSCADA.ViewModel
/// </summary>
public RelayCommand<object> DeletePageCommand { get; set; }
/// <summary>
/// 清除当前页子集
/// </summary>
public RelayCommand<object> ClearPageCommand { get; set; }
/// <summary>
/// 选中该页
/// </summary>
public RelayCommand<object> SelectPageCommand { get; set; }
@@ -454,6 +459,7 @@ namespace BeDesignerSCADA.ViewModel
SetBottomPageCommand = new RelayCommand(new Action(SetBottomPageHeader));
AddPageCommand = new RelayCommand<object>(new Action<object?>(AddPageHeader));
DeletePageCommand = new RelayCommand<object>(new Action<object?>(DeletePageHeader));
ClearPageCommand = new RelayCommand<object>(new Action<object?>(ClearPageHeader));
SelectPageCommand = new RelayCommand<object>(new Action<object?>(SelectPageHeader));
SaveAllPageCommand = new RelayCommand(new Action(SaveAllPageHeader));
LWSaveAllPageCommand=new RelayCommand(new Action(LWSaveAllPageHeader));
@@ -554,7 +560,6 @@ namespace BeDesignerSCADA.ViewModel
{
try
{

if (obj != null && obj is PageModel mode)
{
if (mode.Sort >= 0 && mode.Sort + 1 < MenuModel.pageModels.Count)
@@ -578,13 +583,57 @@ namespace BeDesignerSCADA.ViewModel
/// 删除该页
/// </summary>
public void DeletePageHeader(object obj)
{
try
{
if (obj != null && obj is PageModel page && MenuModel.pageModels.Count > 1)
{
if (new MyMessageBox(MessageBoxStyle.question, $"当前选中页面名称:{page.Name},确认是否删除!").ShowDialog() == true)
{
if (MenuModel.SelectPageModels == page)
{
MenuModel.pageModels.Remove(page);
GxSortTarget();
SelectPageHeader(MenuModel.pageModels[0]);
}
else
{
MenuModel.pageModels.Remove(page);
GxSortTarget();
}
}
}
else if (obj != null)//最后一页
{
if (new MyMessageBox(MessageBoxStyle.question, "至少保留一页,是否清空该页!").ShowDialog() == true)
{
(obj as PageModel).visual.Children.Clear();
(obj as PageModel).ChildrenStr.Clear();
SelectPageHeader(MenuModel.pageModels[0]);
}
}
}
catch (Exception ex)
{

}
}
/// <summary>
/// 清空该页
/// </summary>
/// <param name="obj"></param>
public void ClearPageHeader(object obj)
{
try
{
if (obj != null && obj is PageModel page)
{
MenuModel.pageModels.Remove(page);
GxSortTarget();
if (new MyMessageBox(MessageBoxStyle.question, $"页面名称:{page.Name},是否清空该页!").ShowDialog() == true)
{
(obj as PageModel).visual.Children.Clear();
(obj as PageModel).ChildrenStr.Clear();
if (MenuModel.SelectPageModels == page) SelectPageHeader(obj);
}
}
}
catch (Exception ex)
@@ -664,7 +713,6 @@ namespace BeDesignerSCADA.ViewModel

}
}
/// <summary>
/// 根据路径保存菜单布局
/// </summary>
@@ -674,11 +722,11 @@ namespace BeDesignerSCADA.ViewModel
try
{
BinaryFile.SaveBinary(MenuModel, path);
MessageBox.Show("保存成功!");
new MyMessageBox(MessageBoxStyle.info, $"保存成功!").ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show("保存失败!原因:" +ex.Message);
new MyMessageBox(MessageBoxStyle.error, "保存失败!原因:" + ex.Message).ShowDialog();
}
}
/// <summary>
@@ -733,14 +781,25 @@ namespace BeDesignerSCADA.ViewModel
/// </summary>
public void LoadValuesHeader()
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "变量管理器文件|*.json";
if (ofd.ShowDialog() == true)
try
{
string path= AppDomain.CurrentDomain.BaseDirectory + "BPASmart.VariableManager.exe";
if (File.Exists(path))
{
Process.Start(path);
}
}
catch (Exception ex)
{
VariablePath = ofd.FileName;
bool isSucess = DataBusModel.GetInstance().RefreshVariableManager(ofd.FileName);
System.Windows.MessageBox.Show(isSucess ? "加载成功!" : "加载失败!");
}
//OpenFileDialog ofd = new OpenFileDialog();
//ofd.Filter = "变量管理器文件|*.json";
//if (ofd.ShowDialog() == true)
//{
// VariablePath = ofd.FileName;
// bool isSucess = DataBusModel.GetInstance().RefreshVariableManager(ofd.FileName);
// System.Windows.MessageBox.Show(isSucess ? "加载成功!" : "加载失败!");
//}
}
#endregion
}


+ 1
- 0
DosingSystem/App.xaml Vedi File

@@ -25,6 +25,7 @@
<con:VisibleTypeConverter x:Key="VisibleTypeConverter" />
<con:StatusConverter x:Key="StatusConverter" />
<con:StringToIconConverter x:Key="StringToIconConverter" />
<con:BoolToVisibilityConvert x:Key="BoolToVisibilityConvert" />
</ResourceDictionary>

<ResourceDictionary>


+ 5
- 2
DosingSystem/Model/DeviceCurrentStatus.cs Vedi File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Microsoft.Toolkit.Mvvm.ComponentModel;

namespace BPASmartClient.DosingSystem
@@ -42,8 +43,8 @@ namespace BPASmartClient.DosingSystem
/// <summary>
/// 仓盖是否被打开
/// </summary>
public string IsOpen { get { return _mIsOpen; } set { _mIsOpen = value; OnPropertyChanged(); } }
private string _mIsOpen;
public bool IsOpen { get { return _mIsOpen; } set { _mIsOpen = value; OnPropertyChanged(); } }
private bool _mIsOpen;

/// <summary>
/// 料仓时候有报警
@@ -51,5 +52,7 @@ namespace BPASmartClient.DosingSystem
public bool IsFault { get { return _mIsFault; } set { _mIsFault = value; OnPropertyChanged(); } }
private bool _mIsFault;



}
}

+ 89
- 7
DosingSystem/View/HardwareStatusView.xaml Vedi File

@@ -18,9 +18,9 @@

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.5*" />
<RowDefinition Height="0.6*" />
<RowDefinition />
<RowDefinition Height="0.5*" />
<RowDefinition Height="0.6*" />
</Grid.RowDefinitions>

<!--#region 顶部料仓-->
@@ -50,19 +50,20 @@
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition Height="0.6*" />
</Grid.RowDefinitions>

<TextBlock
<!--<TextBlock
Margin="0,0,0,35"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
FontSize="25"
Foreground="#ffccd61f"
Text="{Binding DeviceName}" />
Text="{Binding DeviceName}" />-->

<StackPanel
Grid.Row="1"
Margin="0,25,0,0"
Margin="0,2,0,0"
HorizontalAlignment="Center"
Orientation="Horizontal">
<TextBlock
@@ -76,10 +77,9 @@
Text=" kg" />
</StackPanel>


<StackPanel
Grid.Row="1"
Margin="0,70,0,0"
Margin="0,28,0,0"
HorizontalAlignment="Center"
Orientation="Horizontal">
<TextBlock
@@ -93,6 +93,88 @@
Text=" 号仓" />
</StackPanel>

<TextBlock
Grid.Row="1"
Margin="0,50,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="20"
Foreground="#FF0084FF"
Text="{Binding DeviceName}" />

<StackPanel Grid.Row="2" Orientation="Horizontal">
<StackPanel>
<ToggleButton
Width="80"
Height="30"
Margin="5,0,5,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="Transparent"
FontSize="20"
IsChecked="{Binding IsOpen}"
Style="{StaticResource SwitchToggleButtonStyle}" />
<TextBlock
Margin="0,5,0,0"
HorizontalAlignment="Center"
Foreground="#00c2f4"
Text="仓盖控制" />
</StackPanel>


<StackPanel>
<ToggleButton
Width="80"
Height="30"
Margin="5,0,5,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="Transparent"
FontSize="20"
IsChecked="{Binding IsLayOff}"
Style="{StaticResource SwitchToggleButtonStyle}" />
<TextBlock
Margin="0,5,0,0"
HorizontalAlignment="Center"
Foreground="#00c2f4"
Text="出料控制" />
</StackPanel>

</StackPanel>

<Image
Margin="20,30,20,0"
Source="/BPASmartClient.CustomResource;component/Image/荧光/矩形发光.png"
Stretch="Fill"
Visibility="{Binding IsOpen, Converter={StaticResource BoolToVisibilityConvert}}" />

<Grid Height="45" Margin="20,-30,20,0">
<Grid.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/荧光/蓝色提示框.png" />
</Grid.Background>
<!--<TextBox
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="20"
Foreground="#00c2f4"
Text="{Binding DeviceName}" />-->

<TextBox
Name="outName"
Width="160"
Height="45"
Margin="-3,-2,0,0"
FontSize="20"
Style="{StaticResource TextBoxStyle}"
Text="{Binding RecipeName}" />

</Grid>
<!--<Image Height="45" Stretch="Fill" Margin="20 -30 20 0" Source="/BPASmartClient.CustomResource;component/Image/荧光/蓝色提示框.png" />-->



<Image Source="/BPASmartClient.CustomResource;component/Image/荧光/29.png" Visibility="{Binding IsLayOff, Converter={StaticResource BoolToVisibilityConvert}}" />

<Image
Grid.RowSpan="2"
Source="/BPASmartClient.CustomResource;component/Image/光柱.png"


+ 34
- 6
DosingSystem/View/RecipeSettingsView.xaml Vedi File

@@ -53,7 +53,7 @@

<!--#region 操作按钮-->
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<pry:IcoButton
<!--<pry:IcoButton
Grid.Column="3"
Width="140"
Margin="10"
@@ -63,8 +63,36 @@
FontSize="16"
Foreground="Aqua"
IcoText="&#xe626;"
Style="{StaticResource IcoButtonStyle}" />
<pry:IcoButton
Style="{StaticResource IcoButtonStyle}" />-->

<Button
Width="140"
Height="30"
Margin="10 0"
Command="{Binding NewMaterital}"
Content="新建原料"
FontSize="16"
Style="{StaticResource ImageButtonStyle}" />

<Button
Width="140"
Height="30"
Margin="10 0"
Command="{Binding NewRecipe}"
Content="新建配方"
FontSize="16"
Style="{StaticResource ImageButtonStyle}" />

<Button
Width="140"
Height="30"
Margin="10 0"
Command="{Binding SaveRecipe}"
Content="保存配方"
FontSize="16"
Style="{StaticResource ImageButtonStyle}" />

<!--<pry:IcoButton
Grid.Column="3"
Width="140"
Margin="10"
@@ -74,9 +102,9 @@
FontSize="16"
Foreground="Aqua"
IcoText="&#xe626;"
Style="{StaticResource IcoButtonStyle}" />
Style="{StaticResource IcoButtonStyle}" />-->

<pry:IcoButton
<!--<pry:IcoButton
Grid.Column="3"
Width="140"
Margin="10"
@@ -87,7 +115,7 @@
Foreground="Aqua"
IcoText="&#xe635;"
IsEnabled="True"
Style="{StaticResource IcoButtonStyle}" />
Style="{StaticResource IcoButtonStyle}" />-->
</StackPanel>
<!--#endregion-->



+ 25
- 1
DosingSystem/View/StockControlView.xaml Vedi File

@@ -47,6 +47,10 @@
</Setter.Value>
</Setter>
</Style>

<Style x:Key="textBoxStyle" TargetType="TextBox">
<Setter Property="Background" Value="Transparent" />
</Style>
</UserControl.Resources>

<UserControl.DataContext>
@@ -85,17 +89,37 @@
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.8*" />
<RowDefinition Height="0.1*" />
<RowDefinition Height="0.2*" />
</Grid.RowDefinitions>

<define:MaterialStock
Grid.Row="0"
Margin="35,0,35,0"
IsFaultState="{Binding IsFault}"
IsLayOffState="{Binding IsLayOff}"
IsOpenState="{Binding IsOpen}"
IsRunning="{Binding RunStatus}" />

<Grid Grid.Row="1" VerticalAlignment="Bottom">
<StackPanel
Grid.Row="1"
Margin="0,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBlock Foreground="#00c2f4" Text="配料重量:" />
<TextBox
Grid.Row="0"
Width="80"
Padding="2"
Background="Transparent"
BorderBrush="#00c2f4"
CaretBrush="#00c2f4"
Foreground="#00c2f4"
Text="{Binding Weight}" />
</StackPanel>

<Grid Grid.Row="2" VerticalAlignment="Bottom">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />


Caricamento…
Annulla
Salva