pry 2 years ago
parent
commit
ed1e4aa8f9
69 changed files with 2804 additions and 52 deletions
  1. +1
    -0
      BPASmart.Model/PublishModel.cs
  2. +14
    -0
      BPASmart.Model/配方/LocalMaterails.cs
  3. +13
    -0
      BPASmart.Model/配方/LocalRecipes.cs
  4. +48
    -0
      BPASmart.Model/配方/RecipeMaterials.cs
  5. +14
    -0
      BPASmart.Model/配方/Recipes.cs
  6. +9
    -0
      BPASmart.RecipeManagement/App.xaml
  7. +17
    -0
      BPASmart.RecipeManagement/App.xaml.cs
  8. +10
    -0
      BPASmart.RecipeManagement/AssemblyInfo.cs
  9. +23
    -0
      BPASmart.RecipeManagement/BPASmart.RecipeManagement.csproj
  10. +14
    -0
      BPASmart.RecipeManagement/Globle/GlobleData.cs
  11. +105
    -0
      BPASmart.RecipeManagement/MainWindow.xaml
  12. +61
    -0
      BPASmart.RecipeManagement/MainWindow.xaml.cs
  13. +212
    -0
      BPASmart.RecipeManagement/View/MaterialConfigure.xaml
  14. +39
    -0
      BPASmart.RecipeManagement/View/MaterialConfigure.xaml.cs
  15. +198
    -0
      BPASmart.RecipeManagement/View/MaterialManager.xaml
  16. +33
    -0
      BPASmart.RecipeManagement/View/MaterialManager.xaml.cs
  17. +21
    -0
      BPASmart.RecipeManagement/ViewModel/MainWindowViewModel.cs
  18. +106
    -0
      BPASmart.RecipeManagement/ViewModel/MaterialConfigureViewModel.cs
  19. +67
    -0
      BPASmart.RecipeManagement/ViewModel/MaterialManagerViewModel.cs
  20. +1
    -0
      BPASmartClient.Compiler/BPASmartClient.Compiler.csproj
  21. +11
    -3
      BPASmartClient.Compiler/FRedisClient.cs
  22. +142
    -0
      BPASmartClient.Compiler/MQTT.cs
  23. +11
    -0
      BPASmartClient.ControlCenterService/BPASmartClient.ControlCenterService.csproj
  24. +7
    -0
      BPASmartClient.ControlCenterService/Program.cs
  25. +30
    -0
      BPASmartClient.ControlCenterService/Serviceinitialization.cs
  26. +111
    -0
      BPASmartClient.ControlCenterService/炒锅/PanMakeHelper.cs
  27. +11
    -1
      BPASmartClient.DATABUS/Class_DataBus.cs
  28. +10
    -0
      BPASmartClient.MilkWithTea/BPASmartClient.MilkWithTea.csproj
  29. BIN
     
  30. +9
    -0
      BPASmartClient.MinimalistUI/App.xaml
  31. +17
    -0
      BPASmartClient.MinimalistUI/App.xaml.cs
  32. +10
    -0
      BPASmartClient.MinimalistUI/AssemblyInfo.cs
  33. +45
    -0
      BPASmartClient.MinimalistUI/BPASmartClient.MinimalistUI.csproj
  34. +32
    -0
      BPASmartClient.MinimalistUI/Converters/ZoomConverter.cs
  35. +144
    -0
      BPASmartClient.MinimalistUI/FControl/HBLControl.xaml
  36. +37
    -0
      BPASmartClient.MinimalistUI/FControl/HBLControl.xaml.cs
  37. +32
    -0
      BPASmartClient.MinimalistUI/FControl/RunCanvas.xaml
  38. +135
    -0
      BPASmartClient.MinimalistUI/FControl/RunCanvas.xaml.cs
  39. BIN
     
  40. BIN
     
  41. BIN
     
  42. BIN
     
  43. BIN
     
  44. BIN
     
  45. +20
    -0
      BPASmartClient.MinimalistUI/MainWindow.xaml
  46. +64
    -0
      BPASmartClient.MinimalistUI/MainWindow.xaml.cs
  47. BIN
     
  48. +9
    -0
      BPASmartClient.Models/BPASmartClient.Models.csproj
  49. +27
    -0
      BPASmartClient.Models/重庆胖子鱼/FryingPanDevicesModel.cs
  50. +26
    -0
      BPASmartClient.Models/重庆胖子鱼/MaterialsModel.cs
  51. +28
    -0
      BPASmartClient.Models/重庆胖子鱼/OrdersModel.cs
  52. +37
    -0
      BPASmartClient.Models/重庆胖子鱼/RecipesModel.cs
  53. +12
    -0
      BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj
  54. +2
    -2
      BPASmartClient.SCADAControl/CustomerControls/Silos.xaml.cs
  55. +131
    -3
      BPASmartClient.SCADAControl/CustomerControls/SwitchButton.cs
  56. +0
    -1
      BPASmartClient.SCADAControl/CustomerControls/TheButton.xaml
  57. +2
    -3
      BPASmartClient.SCADAControl/CustomerControls/TheButton.xaml.cs
  58. +15
    -0
      BPASmartClient.SCADAControl/CustomerControls/TheMQTT.xaml
  59. +342
    -0
      BPASmartClient.SCADAControl/CustomerControls/TheMQTT.xaml.cs
  60. +33
    -16
      BPASmartClient.SCADAControl/CustomerControls/TheRedis.xaml.cs
  61. +2
    -2
      BPASmartClient.SCADAControl/CustomerControls/TheTextBlock.cs
  62. +47
    -12
      BPASmartClient.SCADAControl/CustomerControls/TheTextBox.cs
  63. +134
    -7
      BPASmartClient.SCADAControl/CustomerControls/TheToggleButton.xaml.cs
  64. BIN
     
  65. BIN
     
  66. BIN
     
  67. +47
    -0
      BPASmartClient.SCADAControl/Themes/Generic.xaml
  68. +3
    -2
      SCADA.Test/MainWindow.xaml.cs
  69. +23
    -0
      SmartClient.sln

+ 1
- 0
BPASmart.Model/PublishModel.cs View File

@@ -10,6 +10,7 @@ namespace BPASmart.Model
{
public string DeviceName { get; set; }
public string RealAddress { get; set; }
public string VarName { get; set; }
public string Value { get; set; }
public EDataType DataType { get; set; }
public int Sleep { get; set; }


+ 14
- 0
BPASmart.Model/配方/LocalMaterails.cs View File

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

namespace BPASmart.Model.配方
{
public class LocalMaterails
{
public ObservableCollection<RecipeMaterials> locaMaterails { get; set; } = new ObservableCollection<RecipeMaterials>();
}
}

+ 13
- 0
BPASmart.Model/配方/LocalRecipes.cs View File

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

namespace BPASmart.Model.配方
{
public class LocalRecipes
{
}
}

+ 48
- 0
BPASmart.Model/配方/RecipeMaterials.cs View File

@@ -0,0 +1,48 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmart.Model.配方
{
public class RecipeMaterials:ObservableObject
{
/// <summary>
/// 原料ID
/// </summary>
public string ID { get { return _id; } set { _id = value; OnPropertyChanged(); } }
private string _id;
/// <summary>
/// 物料名称
/// </summary>
public string Name { get { return _name; } set { _name = value;OnPropertyChanged(); } }
private string _name;
/// <summary>
/// 物料种类
/// </summary>
public MaterialType MaterialType { get { return _materialType; } set { _materialType = value; OnPropertyChanged(); } }
private MaterialType _materialType;
/// <summary>
/// 物料重量
/// </summary>
public int MaterialWeight { get { return _materialWeight; } set { _materialWeight = value; OnPropertyChanged(); } }
private int _materialWeight;
/// <summary>
/// 原料位置
/// </summary>
public string MaterialPosion { get { return _materialPosion; } set { _materialPosion = value;OnPropertyChanged(); } }
private string _materialPosion;
}

public enum MaterialType
{
无 = 0,
干料 = 1,
湿料 = 2,
粉体 = 3,
膏体 = 4
}

}

+ 14
- 0
BPASmart.Model/配方/Recipes.cs View File

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

namespace BPASmart.Model.配方
{
public class Recipes
{
public ObservableCollection<RecipeMaterials> Materials { get; set; }
}
}

+ 9
- 0
BPASmart.RecipeManagement/App.xaml View File

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

+ 17
- 0
BPASmart.RecipeManagement/App.xaml.cs View File

@@ -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.RecipeManagement
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

+ 10
- 0
BPASmart.RecipeManagement/AssemblyInfo.cs View File

@@ -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)
)]

+ 23
- 0
BPASmart.RecipeManagement/BPASmart.RecipeManagement.csproj View File

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

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

<ItemGroup>
<Compile Remove="新文件夹1\**" />
<EmbeddedResource Remove="新文件夹1\**" />
<None Remove="新文件夹1\**" />
<Page Remove="新文件夹1\**" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmart.Model\BPASmart.Model.csproj" />
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" />
</ItemGroup>

</Project>

+ 14
- 0
BPASmart.RecipeManagement/Globle/GlobleData.cs View File

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

namespace BPASmart.RecipeManagement.Globle
{
public class GlobleData
{
public static RecipeMaterials ChangeMaterail;
}
}

+ 105
- 0
BPASmart.RecipeManagement/MainWindow.xaml View File

@@ -0,0 +1,105 @@
<Window x:Class="BPASmart.RecipeManagement.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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BPASmart.RecipeManagement"
xmlns:view="clr-namespace:BPASmart.RecipeManagement.View"
xmlns:vm="clr-namespace:BPASmart.RecipeManagement.ViewModel"
mc:Ignorable="d"
Title="MainWindow" Height="900" Width="1600" WindowStyle="None" WindowStartupLocation="CenterScreen">
<Window.DataContext>
<vm:MainWindowViewModel/>
</Window.DataContext>
<Window.Resources>
<Style x:Key="RadioNavigation" TargetType="RadioButton">
<Setter Property="Margin" Value="-4,10"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="GroupName" Value="Navigation"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
<Grid Background="{TemplateBinding Background}" Margin="{TemplateBinding Margin}">
<Border x:Name="_borderOver" Background="Transparent" Width="200" BorderBrush="Transparent" BorderThickness="0,1">
<TextBlock Foreground="White" Text="{TemplateBinding Content}" FontSize="24" Background="Transparent"
VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="_borderOver" Value="#1971B6"/>
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter Property="BorderBrush" TargetName="_borderOver" Value="White"/>
<Setter Property="BorderThickness" TargetName="_borderOver" Value="0,1"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ButtonNavigation" TargetType="Button">
<Setter Property="Height" Value="40"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid Background="{TemplateBinding Background}" Margin="{TemplateBinding Margin}">
<Border x:Name="_borderOver" Background="Transparent" Width="200" BorderBrush="Transparent" BorderThickness="0,1">
<TextBlock Foreground="White" Text="{TemplateBinding Content}" FontSize="24" Background="Transparent"
VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="_borderOver" Value="#1971B6"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Border Background="Transparent">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="2"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="10"/>
<RowDefinition Height="*"/>
<RowDefinition Height="60"/>
</Grid.RowDefinitions>
<StackPanel x:Name="mylistview" Background="#2196F3" Grid.RowSpan="2"
ScrollViewer.VerticalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
MouseDown="mylistview_MouseDown" >
<RadioButton Content="配方管理" Style="{DynamicResource RadioNavigation}" IsChecked="True"
Click="NavButton_Click" Tag=""/>
<RadioButton Content="原料管理" Style="{DynamicResource RadioNavigation}"
Click="NavButton_Click" Tag=""/>
<RadioButton Content="工艺参数" Style="{DynamicResource RadioNavigation}"
Click="NavButton_Click" Tag=""/>
<RadioButton Content="权限分配" Style="{DynamicResource RadioNavigation}"
Click="NavButton_Click" Tag=""/>
</StackPanel>
<Border Background="#2196F3" Grid.Row="2">
<Button Content="退出"
Style="{DynamicResource ButtonNavigation}"
Click="Button_Click">
</Button>
</Border>
<ContentControl x:Name="contentRegion" Grid.Column="1" Grid.Row="1" >
<view:MaterialManager/>
</ContentControl>
</Grid>
</Border>
</Window>

+ 61
- 0
BPASmart.RecipeManagement/MainWindow.xaml.cs View File

@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
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.RecipeManagement
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}

private void mylistview_MouseDown(object sender, MouseButtonEventArgs e)
{
this.DragMove();
}

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


private void NavButton_Click(object sender, RoutedEventArgs e)
{

try
{
if (sender is Button bt)
{
Type type = Type.GetType($"BPASmartClient.MilkWithTea.View.{bt.Tag?.ToString()}");
ConstructorInfo cti = type.GetConstructor(System.Type.EmptyTypes);
contentRegion.Content = (FrameworkElement)cti.Invoke(null);
}
}
catch (Exception ex)
{
}
}
}
}

+ 212
- 0
BPASmart.RecipeManagement/View/MaterialConfigure.xaml View File

@@ -0,0 +1,212 @@
<Window x:Class="BPASmart.RecipeManagement.View.MaterialConfigure"
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:BPASmart.RecipeManagement.View"
xmlns:vm="clr-namespace:BPASmart.RecipeManagement.ViewModel"
mc:Ignorable="d"
Title="MaterialConfigure" Height="300" Width="500" WindowStartupLocation="CenterScreen" WindowStyle="None" Background="White" MouseLeftButtonDown="Window_MouseLeftButtonDown">
<Window.DataContext>
<vm:MaterialConfigureViewModel/>
</Window.DataContext>
<Window.Resources>
<Style TargetType="{x:Type ComboBox}">
<Setter Property="Background" Value="White"/>
<Setter Property="ItemContainerStyle">
<Setter.Value>
<!--ComBoxItem-->
<Style TargetType="ComboBoxItem">
<Setter Property="MinHeight" Value="22"></Setter>
<Setter Property="MinWidth" Value="60"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBoxItem">
<Border Name="Back" Background="Transparent" BorderThickness="0,0,0,0" BorderBrush="#81D779" >
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0,0,0"></ContentPresenter>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Back" Property="Background" Value="LightGray"></Setter>
</Trigger>
<Trigger Property="IsHighlighted" Value="True">
<Setter TargetName="Back" Property="Background" Value="LightGray"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ComboBox}">
<Border BorderThickness="1" BorderBrush="#CDC9C9 " CornerRadius="3" Width="{TemplateBinding Width}" Height="40" Background="{TemplateBinding Background}" >
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" x:Name="grid">
<ToggleButton
Width="{Binding ElementName=grid,Path=ActualWidth}"
Height="{Binding ElementName=grid, Path=ActualHeight}"
Content="{TemplateBinding Text}" VerticalAlignment="Center"
HorizontalAlignment="Left" Margin="5,0,0,0"
BorderThickness="0"
Foreground="{TemplateBinding Foreground}"
Background="{TemplateBinding Background}"
IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press"
>
<ToggleButton.Style >
<Style TargetType="ToggleButton">
<Setter Property="Background" Value="White"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border Background="{TemplateBinding Background}" BorderThickness="0" >
<TextBlock Foreground="{TemplateBinding Foreground}" Text="{TemplateBinding Content}" Margin="4 0 0 0" HorizontalAlignment="Left" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="White"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
<Setter Property="Background" Value="White"/>
</Trigger>
</Style.Triggers>
</Style>
</ToggleButton.Style>
</ToggleButton>
</Grid>

<Grid Grid.Column="1" >
<ToggleButton IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Foreground="{TemplateBinding Foreground}"
ClickMode="Press">
<ToggleButton.Style>
<Style TargetType="ToggleButton">
<Setter Property="Background" Value="White"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
<Image Source="pack://application:,,,/image/down,png" Stretch="Fill" HorizontalAlignment="Center" VerticalAlignment="Center">
<Image.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</Image.RenderTransform>
</Image>
</Grid>
</Border>
<!--<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">

</Trigger>
<EventTrigger RoutedEvent="Checked">
<BeginStoryboard>
<Storyboard >
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="arrow_tb" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.2000000" Value="180"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>

<EventTrigger RoutedEvent="Unchecked">
<BeginStoryboard>
<Storyboard >
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="arrow_tb" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="180"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</ControlTemplate.Triggers>-->
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ToggleButton.Style>
</ToggleButton>
</Grid>
<Popup IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" x:Name="Popup" Focusable="False" AllowsTransparency="True" PopupAnimation="Slide">
<Border CornerRadius="1" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{TemplateBinding ActualWidth}" x:Name="DropDown" SnapsToDevicePixels="True">
<Border.Effect>
<DropShadowEffect Color="Black" BlurRadius="2" ShadowDepth="0" Opacity="0.5"/>
</Border.Effect>
<ScrollViewer Margin="4,6,4,6" MaxHeight="{TemplateBinding MaxDropDownHeight}" SnapsToDevicePixels="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
<!-- StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True -->
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" Background="White"/>
</ScrollViewer>
</Border>
</Popup>
</Grid>


<Border.Effect>
<DropShadowEffect ShadowDepth="-1" Opacity="0.3" Color="#FF969696" BlurRadius="5"/>
</Border.Effect>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>


</Style>
</Window.Resources>
<Border CornerRadius="20" Background="#FFFAFA">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="17*"/>
<ColumnDefinition Width="33*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition />
<RowDefinition />
<RowDefinition Height="40"/>
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Text="原料名称:" FontSize="22"
HorizontalAlignment="Center" VerticalAlignment="Center" Height="28" Width="92"/>
<TextBlock Text="原料种类:" FontSize="22" Grid.Row="1"
HorizontalAlignment="Center" VerticalAlignment="Center" Height="28" Width="92"/>
<TextBlock Text="原料位置:" FontSize="22" Grid.Row="2"
HorizontalAlignment="Center" VerticalAlignment="Center" Height="28" Width="92"/>
<TextBox Text="{Binding MaterialName}" FontSize="22" Grid.Column="1" Width="200" Height="40"
VerticalAlignment="Center" HorizontalAlignment="Center"
VerticalContentAlignment="Center"/>
<ComboBox ItemsSource="{Binding MaterialTypes}"
FontSize="18"
Grid.Column="1" Grid.Row="1" Width="200" Height="40"
SelectedItem="{Binding MaterialType}"/>
<TextBox Text="{Binding MaterialPosion}" FontSize="22" Grid.Column="1" Grid.Row="2"
Width="100" Height="40"
VerticalAlignment="Center" HorizontalAlignment="Center"
VerticalContentAlignment="Center"/>
<TextBlock Text="{Binding ErrorMessage}" Grid.Row="3" Grid.ColumnSpan=" 2"
Foreground="Red" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<StackPanel Grid.Row="4" Grid.ColumnSpan="2" Orientation="Horizontal"
HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Content="保存" Foreground="White" FontSize="22" Width="120" Height="40" Margin="10" Background="#58B0ED"
Command="{Binding SaveCommand}"/>
<Button Content="取消" Foreground="White" FontSize="22" Width="120" Height="40" Margin="10" Background="#58B0ED"
Click="Button_Click"/>
</StackPanel>

</Grid>
</Border>
</Window>

+ 39
- 0
BPASmart.RecipeManagement/View/MaterialConfigure.xaml.cs View File

@@ -0,0 +1,39 @@
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.RecipeManagement.View
{
/// <summary>
/// MaterialConfigure.xaml 的交互逻辑
/// </summary>
public partial class MaterialConfigure : Window
{
public MaterialConfigure()
{
InitializeComponent();
}

private void Button_Click(object sender, RoutedEventArgs e)
{
this.Close();

}

private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
this.DragMove();
}
}
}

+ 198
- 0
BPASmart.RecipeManagement/View/MaterialManager.xaml View File

@@ -0,0 +1,198 @@
<UserControl x:Class="BPASmart.RecipeManagement.View.MaterialManager"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmart.RecipeManagement.View"
xmlns:vm="clr-namespace:BPASmart.RecipeManagement.ViewModel"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" >
<UserControl.DataContext>
<vm:MaterialManagerViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<Style TargetType="ListViewItem" >
<Setter Property="Margin" Value="60,20"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListViewItem">
<Border x:Name="mborder" BorderBrush="#009AC0" BorderThickness="1,5" CornerRadius="10">
<Grid Width="100" >
<Grid.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
<GradientStop Color="#4F94CD" Offset="0"/>
<GradientStop Color="Transparent" Offset="0.3"/>
<GradientStop Color="Transparent" Offset="0.7"/>
<GradientStop Color="#4F94CD" Offset="1" />
</LinearGradientBrush>
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition Height="25"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding MaterialPosion}" Height="20" Width="20" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,0"/>
<TextBlock Text="{Binding Name}" Grid.ColumnSpan="2"
FontSize="24"
HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
<TextBlock Grid.Row="1" Text="种类:" FontSize="16" VerticalAlignment="Center" HorizontalAlignment="Right"/>
<TextBlock Grid.Row="1" Grid.Column="1" FontSize="16"
VerticalAlignment="Center" HorizontalAlignment="Left"
Text="{Binding MaterialType}" TextAlignment="Center"></TextBlock>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" Value="#D2B48C" TargetName="mborder"/>
</Trigger>
<Trigger Property="IsFocused" Value="True">
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style TargetType="{x:Type ContextMenu}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ContextMenu}">
<Border x:Name="Border" CornerRadius="4" Background="#009ACD" BorderThickness="1" Margin="0">
<Border.BorderBrush>
<SolidColorBrush Color="#104E8B" />
</Border.BorderBrush>
<ItemsPresenter/>
</Border>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True"/>
</MultiTrigger.Conditions>
<MultiTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(FrameworkElement.Width)">
<SplineDoubleKeyFrame KeyTime="00:00:00.0020000" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.20000" Value="110"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(FrameworkElement.Height)">
<SplineDoubleKeyFrame KeyTime="00:00:00.0020000" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.20000" Value="100"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</MultiTrigger.EnterActions>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type MenuItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type MenuItem}">
<Border Margin="0,5" MinWidth="80" CornerRadius="5">
<Border.Background>
<SolidColorBrush x:Name="MyAnimatedBrushBackground" Color="Transparent" />
</Border.Background>
<StackPanel Orientation="Horizontal">
<TextBlock Text=" "/>
<ContentPresenter ContentSource="Icon" HorizontalAlignment="Center" VerticalAlignment="Center" />
<TextBlock Text=" "/>
<ContentPresenter ContentSource="Header" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True"/>
</MultiTrigger.Conditions>
<MultiTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MyAnimatedBrushBackground" Storyboard.TargetProperty="Color">
<LinearColorKeyFrame Value="Transparent" KeyTime="00:00:00.0020000" />
<LinearColorKeyFrame Value="#B0E2FF" KeyTime="00:00:00.0320000" />
</ColorAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</MultiTrigger.EnterActions>
<MultiTrigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MyAnimatedBrushBackground" Storyboard.TargetProperty="Color">
<LinearColorKeyFrame Value="#7E9C9C9C" KeyTime="00:00:00.0020000" />
<LinearColorKeyFrame Value="Transparent" KeyTime="00:00:00.0320000" />
</ColorAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</MultiTrigger.ExitActions>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid Background="White">
<Grid.ColumnDefinitions>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Grid.RowSpan="2">
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Text="原料清单" FontSize="28" Foreground="DarkSlateGray" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<ListView x:Name="mylistview" Grid.Row="1"
ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding MaterialList}" Margin=" 10" Background="#FFFAFA" >
<ListView.ContextMenu>
<ContextMenu FontSize="16" Foreground="White">
<MenuItem Header="新建原料" Name="MenuAdd" Command="{Binding CreateMaterailCommand}"></MenuItem>
<MenuItem Header="编辑原料" Name="MenuEdit"
Command="{Binding EditMaterailCommand }"
CommandParameter="{Binding PlacementTarget.SelectedIndex,RelativeSource={RelativeSource AncestorType=ContextMenu}}"></MenuItem>
<MenuItem Header="删除原料" Name="MenuDelete"
Command="{Binding DeleteMaterailCommand}"
CommandParameter="{Binding PlacementTarget.SelectedIndex,RelativeSource={RelativeSource AncestorType=ContextMenu}}"></MenuItem>
</ContextMenu>
</ListView.ContextMenu>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Margin="10"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<!--<ContextMenu>
<ContextMenu FontSize="16" Foreground="White">
<MenuItem Header="新建原料" Name="MenuCreate"
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.CreateMaterailCommand}"></MenuItem>
<MenuItem Header="编辑原料" Name="MenuEdit"
Command="{Binding RelativeSource={RelativeSource Mode= FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.EditMaterailCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListView}},Path=SelectedItem}"></MenuItem>
<MenuItem Header="删除原料" Name="MenuDelete"
Command="{Binding RelativeSource={RelativeSource Mode= FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.DeleteMaterailCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListView}},Path=SelectedItem}"></MenuItem>
</ContextMenu>
</ContextMenu>-->
</ListView>
</Grid>
</Grid>
</UserControl>

+ 33
- 0
BPASmart.RecipeManagement/View/MaterialManager.xaml.cs View File

@@ -0,0 +1,33 @@
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.RecipeManagement.View
{
/// <summary>
/// MaterialManager.xaml 的交互逻辑
/// </summary>
public partial class MaterialManager : UserControl
{
public MaterialManager()
{
InitializeComponent();
}



}
}

+ 21
- 0
BPASmart.RecipeManagement/ViewModel/MainWindowViewModel.cs View File

@@ -0,0 +1,21 @@
using BPASmart.Model.配方;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmart.RecipeManagement.ViewModel
{
public class MainWindowViewModel: ObservableObject
{

public MainWindowViewModel()
{
Json<LocalMaterails>.Read();
}

}
}

+ 106
- 0
BPASmart.RecipeManagement/ViewModel/MaterialConfigureViewModel.cs View File

@@ -0,0 +1,106 @@
using BPASmart.Model.配方;
using BPASmart.RecipeManagement.Globle;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmart.RecipeManagement.ViewModel
{
public class MaterialConfigureViewModel:ObservableObject
{

public string MaterialName { get { return _materialName; } set { _materialName = value; OnPropertyChanged(); } }
private string _materialName;

public ObservableCollection<MaterialType> MaterialTypes { get; set; } = new ObservableCollection<MaterialType>();

public MaterialType MaterialType { get{ return _materialType; } set { _materialType = value; OnPropertyChanged(); } }
private MaterialType _materialType = 0;

public string MaterialPosion { get { return _materialPosion; } set { _materialPosion = value; OnPropertyChanged(); } }
private string _materialPosion;

public string ErrorMessage { get { return _errorMessage; } set { _errorMessage = value; OnPropertyChanged(); } }
private string _errorMessage;

public RelayCommand SaveCommand { get; set; }

public MaterialConfigureViewModel()
{
if(GlobleData.ChangeMaterail != null)
{
MaterialName = GlobleData.ChangeMaterail.Name;
MaterialType = GlobleData.ChangeMaterail.MaterialType;
MaterialPosion = GlobleData.ChangeMaterail.MaterialPosion;
}

foreach(MaterialType item in Enum.GetValues(typeof(MaterialType)))
{
MaterialTypes.Add(item);
}


SaveCommand = new RelayCommand(() =>
{
if(MaterialName == null)
{
ErrorMessage = "原料名称不能为空";
return;
}
if(GlobleData.ChangeMaterail!=null)//编辑原料
{
var res = Json<LocalMaterails>.Data.locaMaterails.FirstOrDefault(p=>p.ID == GlobleData.ChangeMaterail.ID);
if (res != null)
{
res.Name = MaterialName;
res.MaterialType = MaterialType;
res.MaterialPosion = MaterialPosion;
Json<LocalMaterails>.Save();
ErrorMessage = "保存成功";
}
}
else //添加新原料
{
if(Json<LocalMaterails>.Data.locaMaterails != null)
{
var res = Json<LocalMaterails>.Data.locaMaterails.FirstOrDefault(p => p.Name == MaterialName);
if (res != null)
{
ErrorMessage = "原料名称已存在";
return;
}
Json<LocalMaterails>.Data.locaMaterails.Add(new RecipeMaterials
{
ID = Guid.NewGuid().ToString(),
Name = MaterialName,
MaterialType = MaterialType,
MaterialPosion = MaterialPosion
});
Json<LocalMaterails>.Save();
ErrorMessage = "保存成功";
}
else
{
Json<LocalMaterails>.Data.locaMaterails.Add(new RecipeMaterials
{
ID = Guid.NewGuid().ToString(),
Name = MaterialName,
MaterialType = MaterialType,
MaterialPosion = MaterialPosion
});
Json<LocalMaterails>.Save();
ErrorMessage = "保存成功";
}
}
});
}
}
}

+ 67
- 0
BPASmart.RecipeManagement/ViewModel/MaterialManagerViewModel.cs View File

@@ -0,0 +1,67 @@
using System;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using BPASmart.Model.配方;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmart.RecipeManagement.View;
using System.Windows.Controls;
using BPASmart.RecipeManagement.Globle;
using BPASmartClient.Helper;

namespace BPASmart.RecipeManagement.ViewModel
{
public class MaterialManagerViewModel:ObservableObject
{
/// <summary>
/// 原料集合
/// </summary>
public ObservableCollection<RecipeMaterials> MaterialList { get; set; } = Json<LocalMaterails>.Data.locaMaterails;

public RelayCommand CreateMaterailCommand { get; set; }
public RelayCommand<object> EditMaterailCommand { get; set; }
public RelayCommand<object> DeleteMaterailCommand { get; set; }

private void EditMaterail(object o)
{
if(o == null) return;
if(o is int item)
{
GlobleData.ChangeMaterail = new RecipeMaterials();
GlobleData.ChangeMaterail = MaterialList[item];
MaterialConfigure materialConfigure = new MaterialConfigure();
materialConfigure.ShowDialog();
}
}

private void DeleteMaterail(object o)
{
if (o == null) return;
if (o is int item)
{
MaterialList.RemoveAt(item);
Json<LocalMaterails>.Save();
}
}

public MaterialManagerViewModel()
{

CreateMaterailCommand = new RelayCommand(() =>
{
GlobleData.ChangeMaterail = null;
MaterialConfigure materialConfigure = new MaterialConfigure();
materialConfigure.ShowDialog();
});

EditMaterailCommand = new RelayCommand<object>(EditMaterail);

DeleteMaterailCommand = new RelayCommand<object>(DeleteMaterail);
}
}
}

+ 1
- 0
BPASmartClient.Compiler/BPASmartClient.Compiler.csproj View File

@@ -9,6 +9,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.3.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.3.0" />
<PackageReference Include="MQTTnet" Version="3.1.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="ServiceStack.Redis" Version="6.3.0" />
<PackageReference Include="StackExchange.Redis" Version="2.6.66" />


+ 11
- 3
BPASmartClient.Compiler/FRedisClient.cs View File

@@ -51,6 +51,7 @@ namespace BPASmartClient.Compiler
_database = _connection.GetDatabase(0);//默认使用db0
subscibe = _connection.GetSubscriber();
}
int dbi = 0;
public void Connect(string connection)
{
_connection = ConnectionMultiplexer.Connect(ConfigurationOptions.Parse(connection));
@@ -58,7 +59,7 @@ namespace BPASmartClient.Compiler
{
string[] str=connection.Split(',');
string stro = str.ToList().Find(s => s.Contains("defaultDatabase="));
int dbi = 0;
try
{
dbi=int.Parse(stro.Replace("defaultDatabase=",""));
@@ -72,7 +73,7 @@ namespace BPASmartClient.Compiler
}
else
{
_database = _connection.GetDatabase();//默认使用db0
_database = _connection.GetDatabase(dbi);//默认使用db0
}
subscibe = _connection.GetSubscriber();
}
@@ -89,7 +90,14 @@ namespace BPASmartClient.Compiler
//获取指定服务器
var server = _connection.GetServer(endPoint);
//在指定服务器上使用 keys 或者 scan 命令来遍历key
foreach (var key in server.Keys(0,"设备列表:*"))
//foreach (var key in server.Keys(0,"设备列表:*"))
//{
// //获取key对于的值
// var val = _database.StringGet(key);
// Console.WriteLine($"key: {key}, value: {val}");
// keys[key] = val;
//}
foreach (var key in server.Keys(dbi,"*"))
{
//获取key对于的值
var val = _database.StringGet(key);


+ 142
- 0
BPASmartClient.Compiler/MQTT.cs View File

@@ -0,0 +1,142 @@
using MQTTnet;
using MQTTnet.Client;
using MQTTnet.Client.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Compiler
{
public class MQTT
{

//private volatile static MQTT _Instance;
//public static MQTT GetInstance => _Instance ?? (_Instance = new MQTT());
//private MQTT() { }


public IMqttClient client;
IMqttClientOptions options;

/// <summary>
/// MQTT 接收消息
/// </summary>
public Action<MqttApplicationMessageReceivedEventArgs> MqttReceive { get; set; }

/// <summary>
/// MQTT 连接成功
/// </summary>
public Action ConnectOk { get; set; }

/// <summary>
/// 重连成功
/// </summary>
public Action Reconnection { get; set; }


public async void MqttInitAsync(string UserName,string pass,string IP,int port,string clientID)
{
p1:
options = new MqttClientOptionsBuilder().WithTcpServer(IP,port).WithClientId(clientID).WithCredentials(UserName,pass).Build();
client = new MqttFactory().CreateMqttClient();
client.UseDisconnectedHandler(async c =>
{
Thread.Sleep(2000);
//while (!Device.DataBus.内存数据缓存.DataBus.GetInstance().NetworkConnectState)
//{
// Thread.Sleep(2000);
//}
//Device.DataBus.内存数据缓存.DataBus.GetInstance().MQTTConnectState = false;
//logHelper.GetLogConfigInstance().WriteLog(LogLevel.INFO,$"断开连接");

try
{
//logHelper.GetLogConfigInstance().WriteLog(LogLevel.INFO,$"重连中");
await client.ConnectAsync(options);
}
catch (Exception ex)
{
//logHelper.GetLogConfigInstance().WriteLog(LogLevel.ERROR,ex.Message);
}
if (client.IsConnected)
{
//logHelper.GetLogConfigInstance().WriteLog(LogLevel.INFO,$"MQTT重连成功");
if (Reconnection != null) Reconnection();
}

}).UseApplicationMessageReceivedHandler(c =>
{
MqttReceive(c);
}).UseConnectedHandler((e) =>
{
//logHelper.GetLogConfigInstance().WriteLog(LogLevel.INFO,$"连接成功");
});


try
{
await client.ConnectAsync(options);
}
catch (Exception ex)
{
//logHelper.GetLogConfigInstance().WriteLog(LogLevel.ERROR,ex.Message);
}
if (!client.IsConnected)
{
Thread.Sleep(2000);
//logHelper.GetLogConfigInstance().WriteLog(LogLevel.INFO,$"mqtt连接失败!重连执行中");
goto p1;
}
Thread.Sleep(2000);
//logHelper.GetLogConfigInstance().WriteLog(LogLevel.INFO,$"MQTT连接成功!");
if (ConnectOk != null) ConnectOk();
}

/// <summary>
/// Mqtt 订阅
/// </summary>
/// <param name="topic">需要订阅的主题</param>
public async void MqttSubscriptionAsync(string topic)
{
if (client != null)
{
if (client.IsConnected)
{
try
{
var result = await client.SubscribeAsync(new MqttTopicFilterBuilder().WithTopic(topic).WithExactlyOnceQoS().Build());
}
catch { }
}
}
}

/// <summary>
/// Mqtt 发布
/// </summary>
/// <param name="topic">需要发布的主题</param>
/// <param name="content">需要发布的内容</param>
public async void MqttPublishAsync(string topic,string content)
{
if (client != null)
{
if (client.IsConnected)
{

var msg = new MqttApplicationMessageBuilder().WithTopic(topic).WithPayload(content).WithExactlyOnceQoS().Build();
try
{
var result = await client.PublishAsync(msg);
}
catch { }
}
}
}

private static readonly object sendMessageLock = new object();


}
}

+ 11
- 0
BPASmartClient.ControlCenterService/BPASmartClient.ControlCenterService.csproj View File

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

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>

</Project>

+ 7
- 0
BPASmartClient.ControlCenterService/Program.cs View File

@@ -0,0 +1,7 @@
// See https://aka.ms/new-console-template for more information
using BPASmartClient.ControlCenterService;
using System;

Console.WriteLine("------------------ 控制中心服务启动 ------------------");

Serviceinitialization serviceinitialization = new Serviceinitialization();

+ 30
- 0
BPASmartClient.ControlCenterService/Serviceinitialization.cs View File

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

namespace BPASmartClient.ControlCenterService
{
public class Serviceinitialization
{
public Serviceinitialization()
{
//初始化加载
init();
}


private void init()
{
//订单接收模块

//AGV通讯模块

}
}

}

+ 111
- 0
BPASmartClient.ControlCenterService/炒锅/PanMakeHelper.cs View File

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

namespace BPASmartClient.ControlCenterService.炒锅
{
public class PanMakeHelper
{
public int PanMakerID { get; set; }

public string PanMakerName { get; set; }

/// <summary>
/// 允许加料
/// </summary>
public bool IsAllowAddMaterial { get; set; }
/// <summary>
/// 火力等级
/// </summary>
public int FireGrade { get; set; }

/// <summary>
/// 当前炒锅温度值
/// </summary>
public int CurrentFryPanTemperature { get; set; }
/// <summary>
/// 当前炒锅基础重量
/// </summary>
public int CurrentFryPanWeight { get; set; }

/// <summary>
/// 当前油锅温度值
/// </summary>
public int CurrentOilPanTemperature { get; set; }
/// <summary>
/// 当前油锅基础重量
/// </summary>
public int CurrentOilPanWeight { get; set; }

/// <summary>
/// 定量罐运行中标志位
/// </summary>
public bool PotIsRuning { get; set; }

/// <summary>
/// 定量罐加油完成标志位
/// </summary>
public bool PotAddOilCompelete { get; set; }

/// <summary>
/// 定量罐液位满标志位
/// </summary>
public bool PotLiquidFull { get; set; }

/// <summary>
/// 洗锅
/// </summary>
public void CleanPan()
{

}

/// <summary>
/// 搅拌
/// </summary>
/// <param name="time">搅拌时间</param>
/// <param name="speed">搅拌速度</param>
public void StirPan(int time,int speed)
{

}

/// <summary>
/// 加热油锅到设定温度
/// </summary>
/// <param name="SettingTemperature"></param>
public void HeatingOilPan(int SettingTemperature)
{

}

/// <summary>
/// 加热炒锅
/// </summary>
/// <param name="SettingSettingTemperature">设定温度</param>
/// <param name=""></param>
public void HeatingFryPan(int SettingTemperature)
{

}

/// <summary>
/// 关火
/// </summary>
public void StopFire()
{

}

/// <summary>
/// 出料控制
/// </summary>
public void OutMaterial()
{

}
}
}

+ 11
- 1
BPASmartClient.DATABUS/Class_DataBus.cs View File

@@ -28,11 +28,21 @@ namespace BPASmartClient.DATABUS
/// <summary>
/// 设备数据
/// </summary>
public ConcurrentDictionary<string, Dictionary<string,object>> Dic_DeviceData = new ConcurrentDictionary<string,Dictionary<string,object>>();
public ConcurrentDictionary<string, Dictionary<string,DeviceDataModel>> Dic_DeviceData = new ConcurrentDictionary<string,Dictionary<string,DeviceDataModel>>();
/// <summary>
/// API数据
/// </summary>
public ConcurrentDictionary<string,string> Dic_APIData = new ConcurrentDictionary<string,string>();
#endregion
}


public class DeviceDataModel
{
public string VarName { get; set; }
public string VarVaule { get; set; }
public string DataType { get; set; }

}

}

+ 10
- 0
BPASmartClient.MilkWithTea/BPASmartClient.MilkWithTea.csproj View File

@@ -9,10 +9,20 @@
<ApplicationIcon>hbl.ico</ApplicationIcon>
</PropertyGroup>

<ItemGroup>
<None Remove="image\down.png" />
</ItemGroup>

<ItemGroup>
<Content Include="hbl.ico" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="image\down.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.Business\BPASmartClient.Business.csproj" />
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" />


BIN
View File


+ 9
- 0
BPASmartClient.MinimalistUI/App.xaml View File

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

+ 17
- 0
BPASmartClient.MinimalistUI/App.xaml.cs View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace BPASmartClient.MinimalistUI
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App :Application
{
}
}

+ 10
- 0
BPASmartClient.MinimalistUI/AssemblyInfo.cs View File

@@ -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)
)]

+ 45
- 0
BPASmartClient.MinimalistUI/BPASmartClient.MinimalistUI.csproj View File

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

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<ApplicationIcon>Images\fyf.ico</ApplicationIcon>
</PropertyGroup>

<ItemGroup>
<None Remove="Images\bj.png" />
<None Remove="Images\fyf.ico" />
<None Remove="Images\logo-pic.png" />
<None Remove="Images\logo-Text.png" />
<None Remove="Images\top_h.png" />
<None Remove="Images\椭圆 22 副本 2.png" />
</ItemGroup>

<ItemGroup>
<Content Include="Images\fyf.ico" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmart.Model\BPASmart.Model.csproj" />
<ProjectReference Include="..\BPASmartClient.Compiler\BPASmartClient.Compiler.csproj" />
<ProjectReference Include="..\BPASmartClient.MessageCommunication\BPASmartClient.MessageCommunication.csproj" />
<ProjectReference Include="..\BPASmartClient.MessageName\BPASmartClient.MessageName.csproj" />
<ProjectReference Include="..\BPASmartClient.SCADAControl\BPASmartClient.SCADAControl.csproj" />
</ItemGroup>

<ItemGroup>
<Resource Include="Images\bj.png" />
<Resource Include="Images\fyf.ico" />
<Resource Include="Images\logo-pic.png" />
<Resource Include="Images\logo-Text.png" />
<Resource Include="Images\top_h.png" />
<Resource Include="Images\椭圆 22 副本 2.png" />
</ItemGroup>

</Project>

+ 32
- 0
BPASmartClient.MinimalistUI/Converters/ZoomConverter.cs View File

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


namespace BPASmartClient.MinimalistUI.Converters
{
public class ZoomConverter :IValueConverter
{
public bool IsHeight { get; set; }
public object Convert(object value,Type targetType,object parameter,CultureInfo culture)
{
if (double.TryParse(value.ToString(),out double zoom))
{
return IsHeight ? zoom * 1080 : zoom * 1920;
}
else
{
return IsHeight ? 1080 : 1920;
}
}

public object ConvertBack(object value,Type targetType,object parameter,CultureInfo culture)
{
return value;
}
}
}

+ 144
- 0
BPASmartClient.MinimalistUI/FControl/HBLControl.xaml View File

@@ -0,0 +1,144 @@
<UserControl x:Class="BPASmartClient.MinimalistUI.FControl.HBLControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MinimalistUI.FControl"
mc:Ignorable="d"
d:DesignHeight="140" d:DesignWidth="140">
<UserControl.Resources>
<ResourceDictionary>
<LinearGradientBrush x:Key="yanjing" EndPoint="0,1">
<GradientStop Color="#CC00EAFF" Offset="0.08"></GradientStop>
<GradientStop Color="Transparent" Offset="0.08"></GradientStop>
<GradientStop Color="Transparent" Offset="0.16"></GradientStop>
<GradientStop Color="#CC00EAFF" Offset="0.16"></GradientStop>
<GradientStop Color="#CC00EAFF" Offset="0.24"></GradientStop>
<GradientStop Color="Transparent" Offset="0.24"></GradientStop>
<GradientStop Color="Transparent" Offset="0.32"></GradientStop>
<GradientStop Color="#CC00EAFF" Offset="0.32"></GradientStop>
<GradientStop Color="#CC00EAFF" Offset="0.40"></GradientStop>
<GradientStop Color="Transparent" Offset="0.40"></GradientStop>
<GradientStop Color="Transparent" Offset="0.48"></GradientStop>
<GradientStop Color="#CC00EAFF" Offset="0.48"></GradientStop>
<GradientStop Color="#CC00EAFF" Offset="0.56"></GradientStop>
<GradientStop Color="Transparent" Offset="0.56"></GradientStop>
<GradientStop Color="Transparent" Offset="0.64"></GradientStop>
<GradientStop Color="#CC00EAFF" Offset="0.64"></GradientStop>
<GradientStop Color="#CC00EAFF" Offset="0.72"></GradientStop>
<GradientStop Color="Transparent" Offset="0.72"></GradientStop>
<GradientStop Color="Transparent" Offset="0.80"></GradientStop>
<GradientStop Color="#CC00EAFF" Offset="0.80"></GradientStop>
<GradientStop Color="#CC00EAFF" Offset="0.88"></GradientStop>
<GradientStop Color="Transparent" Offset="0.88"></GradientStop>
<GradientStop Color="Transparent" Offset="0.96"></GradientStop>
<GradientStop Color="#CC00EAFF" Offset="0.96"></GradientStop>
</LinearGradientBrush>
<Storyboard x:Key="Storyboard1" RepeatBehavior="Forever">
<PointAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.StartPoint)"
Storyboard.TargetName="rectangle">
<EasingPointKeyFrame KeyTime="0:0:0.5" Value="0.855,0.148"/>
<EasingPointKeyFrame KeyTime="0:0:1" Value="0.852,0.855"/>
<EasingPointKeyFrame KeyTime="0:0:1.5" Value="0.148,0.855"/>
<EasingPointKeyFrame KeyTime="0:0:2" Value="0.144,0.149"/>
<EasingPointKeyFrame KeyTime="0:0:2.5" Value="0,0"/>

<EasingPointKeyFrame KeyTime="0:0:3" Value="0.855,0.148"/>
<EasingPointKeyFrame KeyTime="0:0:3.5" Value="0.852,0.855"/>
<EasingPointKeyFrame KeyTime="0:0:4" Value="0.148,0.855"/>
<EasingPointKeyFrame KeyTime="0:0:4.5" Value="0.144,0.149"/>
<EasingPointKeyFrame KeyTime="0:0:5" Value="0,0"/>

</PointAnimationUsingKeyFrames>
<PointAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.EndPoint)"
Storyboard.TargetName="rectangle">
<EasingPointKeyFrame KeyTime="0:0:0.5" Value="0.145,0.852"/>
<EasingPointKeyFrame KeyTime="0:0:1" Value="0.148,0.145"/>
<EasingPointKeyFrame KeyTime="0:0:1.5" Value="0.852,0.145"/>
<EasingPointKeyFrame KeyTime="0:0:2" Value="0.856,0.851"/>
<EasingPointKeyFrame KeyTime="0:0:2.5" Value="0,1"/>

<EasingPointKeyFrame KeyTime="0:0:3" Value="0.145,0.852"/>
<EasingPointKeyFrame KeyTime="0:0:3.5" Value="0.148,0.145"/>
<EasingPointKeyFrame KeyTime="0:0:4" Value="0.852,0.145"/>
<EasingPointKeyFrame KeyTime="0:0:4.5" Value="0.856,0.851"/>
<EasingPointKeyFrame KeyTime="0:0:5" Value="0,1"/>
</PointAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames Storyboard.TargetName="rectangle" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
<EasingColorKeyFrame KeyTime="00:00:02" Value="Lime"/>
<EasingColorKeyFrame KeyTime="00:00:02.5000000" Value="#FF075AFF"/>

<EasingColorKeyFrame KeyTime="00:00:4.5" Value="Lime"/>
<EasingColorKeyFrame KeyTime="00:00:5" Value="#FF075AFF"/>
</ColorAnimationUsingKeyFrames>

<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="ico_map">
<EasingDoubleKeyFrame KeyTime="0:0:2.5" Value="-180"/>
<EasingDoubleKeyFrame KeyTime="0:0:5" Value="-360"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="StoryboardZY" RepeatBehavior="Forever">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="border">
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="12"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="6"/>
<EasingDoubleKeyFrame KeyTime="0:0:1.4" Value="12"/>
<EasingDoubleKeyFrame KeyTime="0:0:3" Value="12"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="border1">
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="12"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="6"/>
<EasingDoubleKeyFrame KeyTime="0:0:1.4" Value="12"/>
<EasingDoubleKeyFrame KeyTime="0:0:3" Value="12"/>

</DoubleAnimationUsingKeyFrames>
</Storyboard>
</ResourceDictionary>
</UserControl.Resources>
<UserControl.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
<BeginStoryboard Storyboard="{StaticResource StoryboardZY}"/>
</EventTrigger>
</UserControl.Triggers>
<Grid Width="100" Height="100" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="20">
<Image x:Name="ico_map" Width="85" Height="85" UseLayoutRounding="True" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="HighQuality" Source="/Images/椭圆 22 副本 2.png" RenderTransformOrigin="0.5,0.5" >
<Image.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</Image.RenderTransform>
</Image>
<Image HorizontalAlignment="Center" Margin="0,90,0,0" UseLayoutRounding="True" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="HighQuality" VerticalAlignment="Top" Width="100" Height="20" Source="/Images/top_h.png" />
<Grid x:Name="grid_xiaoboluo" Width="100" Height="100" MouseEnter="grid_MouseEnter" MouseLeave="grid_MouseLeave">
<Grid>
<Ellipse x:Name="rectangle" Width="70" Height="70" StrokeThickness="4" Fill="#FF022E50">
<Ellipse.Stroke>
<LinearGradientBrush Opacity="1">
<GradientStop Color="Transparent" Offset="0"/>
<GradientStop Color="#FF075AFF" Offset="1"/>
</LinearGradientBrush>
</Ellipse.Stroke>
</Ellipse>
<Image x:Name="ico" UseLayoutRounding="True" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="HighQuality" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="-20,25,0,0" Width="25" Height="30" Source="/Images/logo-pic.png" />
<Image Width="31.6" UseLayoutRounding="True" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="HighQuality" Height="7.9" Margin="20,0,0,25" Source="/Images/logo-Text.png" />
<TextBlock Margin="0,24,0,0" UseLayoutRounding="True" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="HighQuality" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14" Foreground="#FF00EAFF" FontFamily="黑体" FontWeight="Bold">智能卓越</TextBlock>
</Grid>
<Grid x:Name="grid_celine" Visibility="Collapsed">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Ellipse Grid.ColumnSpan="2" Width="70" Height="70" Fill="#2571ac" ></Ellipse>
<Grid x:Name="yanjing_move" Grid.ColumnSpan="2" Width="35" Height="35">
<Grid >
<Border x:Name="border1" HorizontalAlignment="Left" Grid.Column="0" Background="{DynamicResource yanjing}" CornerRadius="2" Width="8" Height="12"/>
<Border x:Name="border" HorizontalAlignment="Right" Grid.Column="1" Background="{DynamicResource yanjing}" CornerRadius="2" Width="8" Height="12"/>
</Grid>
</Grid>
</Grid>
</Grid>
</Grid>
</UserControl>

+ 37
- 0
BPASmartClient.MinimalistUI/FControl/HBLControl.xaml.cs View File

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.MinimalistUI.FControl
{
/// <summary>
/// HBLControl.xaml 的交互逻辑
/// </summary>
public partial class HBLControl :UserControl
{
public HBLControl()
{
InitializeComponent();
}
private void grid_MouseEnter(object sender,MouseEventArgs e)
{
grid_celine.Visibility = Visibility.Visible;
}

private void grid_MouseLeave(object sender,MouseEventArgs e)
{
grid_celine.Visibility = Visibility.Collapsed;
}
}
}

+ 32
- 0
BPASmartClient.MinimalistUI/FControl/RunCanvas.xaml View File

@@ -0,0 +1,32 @@
<UserControl x:Class="BPASmartClient.MinimalistUI.FControl.RunCanvas"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MinimalistUI.FControl"
xmlns:con="clr-namespace:BPASmartClient.MinimalistUI.Converters"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<con:ZoomConverter x:Key="ZoomX" IsHeight="False"/>
<con:ZoomConverter x:Key="ZoomY" IsHeight="True"/>
</UserControl.Resources>
<Grid ClipToBounds="True">
<Canvas x:Name="RootCanvas" ClipToBounds="True" Background="Transparent" MouseLeftButtonUp="RootCanvas_MouseLeftButtonUp"
MouseMove="RootCanvas_MouseMove" MouseLeftButtonDown="RootCanvas_MouseLeftButtoDown" MouseWheel="RootCanvas_MouseWheel">
<Canvas.RenderTransform>
<TransformGroup>
<ScaleTransform x:Name="Scale"/>
<TranslateTransform x:Name="Translate"/>
</TransformGroup>
</Canvas.RenderTransform>
</Canvas>

<Grid VerticalAlignment="Bottom" Background="#4B959595">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="8 0">
<CheckBox x:Name="DragEnable" Content="拖动" Margin="4"/>
<CheckBox x:Name="ZoomEnable" Content="缩放" Margin="4"/>
</StackPanel>
</Grid>
</Grid>
</UserControl>

+ 135
- 0
BPASmartClient.MinimalistUI/FControl/RunCanvas.xaml.cs View File

@@ -0,0 +1,135 @@
using BPASmartClient.Compiler;
using BPASmartClient.MessageName.接收消息Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.MinimalistUI.FControl
{
/// <summary>
/// RunCanvas.xaml 的交互逻辑
/// </summary>
public partial class RunCanvas :UserControl
{
public RunCanvas()
{
InitializeComponent();
Unloaded += (s,e) => Destory();
}

/// <summary>
/// Dispose子集
/// </summary>
public void Destory()
{
foreach (var item in RootCanvas.Children)
{
if (item is IDisposable disposable)
{
disposable.Dispose();
}
}
}

public List<EventReceiveMessage> Run(List<FrameworkElement> canvas)
{
List<EventReceiveMessage> messages = new List<EventReceiveMessage>();
RootCanvas.Children.Clear();
foreach (FrameworkElement element in canvas)
{
if (element is IExecutable executable)
{
executable.IsExecuteState = true;
//if (executable.EventNameList != null && executable.EventNameList.Count > 0)
//{
// messages.AddRange(executable.EventNameList);
//}
}
RootCanvas.Children.Add(element);
RegisterJsName(element);
}
return messages;
}

// 注册名称到Js
static void RegisterJsName(FrameworkElement element)
{
Config.GetInstance().SetVariable(element.Name,element);
if (element is Panel panel)
{
foreach (var item in panel.Children)
{
RegisterJsName(item as FrameworkElement);
}
}
}

#region 拖动与缩放
private void RootCanvas_MouseMove(object sender,MouseEventArgs e)
{
if (DragEnable.IsChecked == false)
{
return;
}

if (e.LeftButton == MouseButtonState.Pressed && isPressed)
{
Point point = e.GetPosition(this);
var movex = (point.X - last.X);
var movey = (point.Y - last.Y);

Translate.X += movex;
Translate.Y += movey;
last = point;

}
}

bool isPressed = false;
Point last;//记录上次鼠标坐标位置
private void RootCanvas_MouseLeftButtoDown(object sender,MouseButtonEventArgs e)
{
last = e.GetPosition(this);
isPressed = true;
}

private void RootCanvas_MouseLeftButtonUp(object sender,MouseButtonEventArgs e)
{
isPressed = false;
}

// 缩放
private void RootCanvas_MouseWheel(object sender,MouseWheelEventArgs e)
{
if (ZoomEnable.IsChecked == false)
{
return;
}
var zoomS = (e.Delta / 960d);
var zoom = zoomS + Scale.ScaleX;
if (zoom > 3 || zoom < 0.8)
{
return;
}
Scale.ScaleX = Scale.ScaleY = zoom;

Point mouse = e.GetPosition(RootCanvas);
Point newMouse = new Point(mouse.X * zoomS,mouse.Y * zoomS);

Translate.X -= newMouse.X;
Translate.Y -= newMouse.Y;
}
#endregion
}
}

BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


+ 20
- 0
BPASmartClient.MinimalistUI/MainWindow.xaml View File

@@ -0,0 +1,20 @@
<Window x:Class="BPASmartClient.MinimalistUI.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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BPASmartClient.MinimalistUI"
xmlns:hc="clr-namespace:BPASmartClient.SCADAControl.Converters;assembly=BPASmartClient.SCADAControl"
xmlns:ctrl="clr-namespace:BPASmartClient.MinimalistUI.FControl"
mc:Ignorable="d"
WindowState="Maximized"
Title="黑菠萝可视化软件" Height="450" Width="800" >
<Grid>
<Grid.Background>
<ImageBrush ImageSource="/Images/bj.png"/>
</Grid.Background>
<ctrl:RunCanvas x:Name="runCanvas"/>

<ctrl:HBLControl></ctrl:HBLControl>
</Grid>
</Window>

+ 64
- 0
BPASmartClient.MinimalistUI/MainWindow.xaml.cs View File

@@ -0,0 +1,64 @@
using BPASmartClient.Compiler;
using BPASmartClient.MessageCommunication;
using BPASmartClient.MessageCommunication.MsgControl;
using BPASmartClient.MessageName;
using BPASmartClient.MessageName.EnumHelp;
using BPASmartClient.MessageName.发送消息Model;
using BPASmartClient.MessageName.接收消息Model;
using BPASmartClient.MessageName.接收消息Model.物料仓;
using Microsoft.Win32;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.MinimalistUI
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow :Window
{
public MainWindow()
{
InitializeComponent();
LoadingData(System.AppDomain.CurrentDomain.BaseDirectory + "LayoutFile\\物料仓管理.lay");
}
/// <summary>
/// 加载数据
/// </summary>
public void LoadingData(string path)
{
//加载控件
List<FrameworkElement> Children = new List<FrameworkElement>();
FileStream fs = new FileStream(path,FileMode.Open,FileAccess.Read,FileShare.ReadWrite);
using (StreamReader sr = new StreamReader(fs,System.Text.Encoding.Unicode))
{
while (sr.Peek() > -1)
{
string str = sr.ReadLine();
var ele = XamlReader.Parse(str) as FrameworkElement;
Children.Add(ele);
}
}
if (Children.Count > 0)
{
runCanvas.Run(Children);
}

}
}
}

BIN
View File


+ 9
- 0
BPASmartClient.Models/BPASmartClient.Models.csproj View File

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

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

</Project>

+ 27
- 0
BPASmartClient.Models/重庆胖子鱼/FryingPanDevicesModel.cs View File

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

namespace BPASmartClient.Models.重庆胖子鱼
{
/// <summary>
/// 炒锅model
/// </summary>
public class FryingPanDevicesModel
{
/// <summary>
/// 炒锅ID
/// </summary>
public int FryingPanId { get; set; }
/// <summary>
/// 炒锅名称
/// </summary>
public string FryingPanName { get; set; }
/// <summary>
/// 炒锅IP地址
/// </summary>
public int FryingPanAddress { get; set; }
}
}

+ 26
- 0
BPASmartClient.Models/重庆胖子鱼/MaterialsModel.cs View File

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

namespace BPASmartClient.Models.重庆胖子鱼
{
public class MaterialsModel
{
/// <summary>
/// 原料ID
/// </summary>
public int MaterialId { get; set; }
/// <summary>
/// 原料名称
/// </summary>
public string MaterialName { get; set; }
/// <summary>
/// 原料重量
/// </summary>
public int MaterialWeight { get; set; }


}
}

+ 28
- 0
BPASmartClient.Models/重庆胖子鱼/OrdersModel.cs View File

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

namespace BPASmartClient.Models.重庆胖子鱼
{
public class OrdersModel
{
/// <summary>
/// 订单ID
/// </summary>
public int Id { get; set; }
/// <summary>
/// 订单名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 订单数量
/// </summary>
public int Count { get; set; }

public List<OrdersModel> Orders { get; set; }

public bool Order
}
}

+ 37
- 0
BPASmartClient.Models/重庆胖子鱼/RecipesModel.cs View File

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

namespace BPASmartClient.Models.重庆胖子鱼
{
public class RecipesModel
{
/// <summary>
/// 配方ID
/// </summary>
public int RecipeId { get; set; }
/// <summary>
/// 配方名称
/// </summary>
public string RecipeName { get; set; }
/// <summary>
/// 配方可用的炒锅设备集合
/// </summary>
public List<FryingPanDevicesModel> Devices { get; set; }
/// <summary>
/// 原料集合
/// </summary>
public List<MaterialsModel> Materials { get; set; }
/// <summary>
/// 配方总重
/// </summary>
public int RecipeWeight { get; set; }
/// <summary>
/// 配方状态
/// 0:等待制作 1;正在制作 2;已完成
/// </summary>
public int RecipeState { get; set; }
}
}

+ 12
- 0
BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj View File

@@ -19,6 +19,9 @@
<None Remove="Images\Cb_Checked.png" />
<None Remove="Images\Cb_HalfChecked.png" />
<None Remove="Images\databj.png" />
<None Remove="Images\mqtt.png" />
<None Remove="Images\mqttrun.png" />
<None Remove="Images\mqttstop.png" />
<None Remove="Images\nbbj.png" />
<None Remove="Images\redis.png" />
<None Remove="Images\redisrun.png" />
@@ -79,6 +82,15 @@
<Resource Include="Images\databj.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\mqtt.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\mqttrun.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\mqttstop.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\nbbj.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>


+ 2
- 2
BPASmartClient.SCADAControl/CustomerControls/Silos.xaml.cs View File

@@ -570,10 +570,10 @@ namespace BPASmartClient.SCADAControl.CustomerControls
{
if (Class_DataBus.GetInstance().Dic_DeviceData.ContainsKey(str[0]))
{
Dictionary<string,object> b= Class_DataBus.GetInstance().Dic_DeviceData[str[0]];
Dictionary<string,DeviceDataModel> b= Class_DataBus.GetInstance().Dic_DeviceData[str[0]];
if (b!=null && b.ContainsKey(str[1]))
{
object _value = b[str[1]];
object _value = b[str[1]].VarVaule;
this.GetType().GetProperty(item.Key).SetValue(this,_value);
}
}


+ 131
- 3
BPASmartClient.SCADAControl/CustomerControls/SwitchButton.cs View File

@@ -1,8 +1,12 @@
using BPASmartClient.Compiler;
using BPASmart.Model;
using BPASmartClient.Compiler;
using BPASmartClient.DATABUS;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
@@ -16,6 +20,7 @@ using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;

namespace BPASmartClient.SCADAControl.CustomerControls
{
@@ -40,6 +45,22 @@ namespace BPASmartClient.SCADAControl.CustomerControls
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(SwitchButton), new FrameworkPropertyMetadata(typeof(SwitchButton)));
}
[Category("事件")]
public string Value
{
get { return (string)GetValue(ValueProperty); }
set { SetValue(ValueProperty,value); }
}
public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value",typeof(string),typeof(SwitchButton),new PropertyMetadata(string.Empty));
[Category("事件")]
public string Text
{
get { return (string)GetValue(TextProperty); }
set { SetValue(TextProperty,value); }
}
public static readonly DependencyProperty TextProperty =
DependencyProperty.Register("Text",typeof(string),typeof(SwitchButton),new PropertyMetadata(string.Empty));

/// <summary>
/// 不勾选时执行代码
@@ -64,7 +85,14 @@ namespace BPASmartClient.SCADAControl.CustomerControls
}
public static readonly DependencyProperty CheckedExecProperty =
DependencyProperty.Register("CheckedExec", typeof(string), typeof(SwitchButton), new PropertyMetadata(string.Empty));

[Category("数据绑定-数据来源")]
public int TimeCount
{
get { return (int)GetValue(TimeCountProperty); }
set { SetValue(TimeCountProperty,value); }
}
public static readonly DependencyProperty TimeCountProperty =
DependencyProperty.Register("TimeCount",typeof(int),typeof(SwitchButton),new PropertyMetadata(5));
protected override void OnRender(DrawingContext drawingContext)
{
base.OnRender(drawingContext);
@@ -128,19 +156,119 @@ namespace BPASmartClient.SCADAControl.CustomerControls
}
}
}

/// <summary>
/// 属性刷新器
/// </summary>
DispatcherTimer timer = new DispatcherTimer();
/// <summary>
/// 属性绑定变量集合
/// </summary>
Dictionary<string,string> propertyBing = new Dictionary<string,string>();
public void Register()
{
PropertyInfo[] propertyInfos = this.GetType().GetProperties();
foreach (PropertyInfo propertyInfo in propertyInfos)
{
var propName = propertyInfo?.GetValue(this,null);
if (propName is string && propName != null && propName.ToString().Contains("Binding ") && propName.ToString().Contains("."))
{
propertyBing[propertyInfo.Name] = propName.ToString();
}
}
timer.Interval = TimeSpan.FromMilliseconds(TimeCount);
timer.Tick += Timer_Tick; ;
timer.Start();
Checked += TheCheckBox_Checked;
Unchecked += TheCheckBox_Unchecked;
}
/// <summary>
/// 属性刷新事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Timer_Tick(object? sender,EventArgs e)
{
try
{
foreach (var item in propertyBing)
{
//{Binding 测试设备.VAR_A_2}
string[] str = item.Value.Replace("{Binding ","").Replace("}","").Split(".");
if (str.Length > 1)
{
if (Class_DataBus.GetInstance().Dic_DeviceData.ContainsKey(str[0]))
{
Dictionary<string,DeviceDataModel> b = Class_DataBus.GetInstance().Dic_DeviceData[str[0]];
if (b != null && b.ContainsKey(str[1]))
{
object _value = b[str[1]].VarVaule;
bool _checked = false;
try
{
_checked = bool.Parse(_value.ToString());
}
catch (Exception ex)
{
_checked = false;
}
EDataType eDataType = (EDataType)Enum.Parse(typeof(EDataType),b[str[1]].DataType);
Text = JsonConvert.SerializeObject(new PublishModel { DeviceName = str[0],VarName = str[1],Value = _checked.ToString(),DataType = eDataType });
this.GetType().GetProperty("IsChecked").SetValue(this,_checked);
timer.Stop();
}
}
}
}
}
catch (Exception ex)
{

}
}

private void TheCheckBox_Unchecked(object sender, RoutedEventArgs e)
{
foreach (var item in propertyBing)
{
//{Binding 测试设备.VAR_A_2}
string[] str = item.Value.Replace("{Binding ","").Replace("}","").Split(".");
if (str.Length > 1)
{
if (Class_DataBus.GetInstance().Dic_DeviceData.ContainsKey(str[0]))
{
Dictionary<string,DeviceDataModel> b = Class_DataBus.GetInstance().Dic_DeviceData[str[0]];
if (b != null && b.ContainsKey(str[1]))
{
object _value = b[str[1]].VarVaule;
EDataType eDataType = (EDataType)Enum.Parse(typeof(EDataType),b[str[1]].DataType);
Text = JsonConvert.SerializeObject(new PublishModel { DeviceName = str[0],VarName = str[1],Value = "Flase",DataType = eDataType });
}
}
}
}
Config.GetInstance().RunJsScipt(UnCheckedExec);
}

private void TheCheckBox_Checked(object sender, RoutedEventArgs e)
{
foreach (var item in propertyBing)
{
//{Binding 测试设备.VAR_A_2}
string[] str = item.Value.Replace("{Binding ","").Replace("}","").Split(".");
if (str.Length > 1)
{
if (Class_DataBus.GetInstance().Dic_DeviceData.ContainsKey(str[0]))
{
Dictionary<string,DeviceDataModel> b = Class_DataBus.GetInstance().Dic_DeviceData[str[0]];
if (b != null && b.ContainsKey(str[1]))
{
object _value = b[str[1]].VarVaule;
EDataType eDataType = (EDataType)Enum.Parse(typeof(EDataType),b[str[1]].DataType);
Text = JsonConvert.SerializeObject(new PublishModel { DeviceName = str[0],VarName = str[1],Value = "True",DataType = eDataType });
}
}
}
}
Config.GetInstance().RunJsScipt(CheckedExec);
}
public string ControlType => "控件";


+ 0
- 1
BPASmartClient.SCADAControl/CustomerControls/TheButton.xaml View File

@@ -3,7 +3,6 @@
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:BPASmartClient.SCADAControl"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
</Button>

+ 2
- 3
BPASmartClient.SCADAControl/CustomerControls/TheButton.xaml.cs View File

@@ -48,7 +48,6 @@ namespace BPASmartClient.SCADAControl.CustomerControls
isExecuteState = value;
if (IsExecuteState)
{
Style = null;
Register();
}
}
@@ -124,10 +123,10 @@ namespace BPASmartClient.SCADAControl.CustomerControls
{
if (Class_DataBus.GetInstance().Dic_DeviceData.ContainsKey(str[0]))
{
Dictionary<string,object> b = Class_DataBus.GetInstance().Dic_DeviceData[str[0]];
Dictionary<string,DeviceDataModel> b = Class_DataBus.GetInstance().Dic_DeviceData[str[0]];
if (b != null && b.ContainsKey(str[1]))
{
object _value = b[str[1]];
object _value = b[str[1]].VarVaule;
this.GetType().GetProperty(item.Key).SetValue(this,_value);
}
}


+ 15
- 0
BPASmartClient.SCADAControl/CustomerControls/TheMQTT.xaml View File

@@ -0,0 +1,15 @@
<UserControl x:Class="BPASmartClient.SCADAControl.CustomerControls.TheMQTT"
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:BPASmartClient.SCADAControl.CustomerControls"
mc:Ignorable="d"
d:DesignHeight="40" d:DesignWidth="40" >
<Grid>
<Image Source="../Images/mqtt.png" Tag="正常" Visibility="Visible"/>
<Image Source="../Images/mqttrun.png" Tag="运行" Visibility="Collapsed"/>
<Image Source="../Images/mqttstop.png" Tag="故障" Visibility="Collapsed"/>
<TextBlock HorizontalAlignment="Center" Tag="显示文字" VerticalAlignment="Bottom" Foreground="#FF02F9FF" Margin="0,0,0,-8">未运行</TextBlock>
</Grid>
</UserControl>

+ 342
- 0
BPASmartClient.SCADAControl/CustomerControls/TheMQTT.xaml.cs View File

@@ -0,0 +1,342 @@
using BPASmart.Model;
using BPASmartClient.Compiler;
using BPASmartClient.DATABUS;
using BPASmartClient.MessageName.EnumHelp;
using BPASmartClient.SCADAControl;
using Newtonsoft.Json;
using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.ComponentModel;
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;
using System.Windows.Threading;

namespace BPASmartClient.SCADAControl.CustomerControls
{
/// <summary>
/// TheMQTT.xaml 的交互逻辑
/// </summary>
public partial class TheMQTT :UserControl, IExecutable, IDisposable
{
Image imageZC = null;
Image imageYC = null;
Image imageGZ = null;
TextBlock textBlock = null;
public TheMQTT()
{
InitializeComponent();
Width = 40;
Height = 40;
this.SizeChanged += TheRedis_SizeChanged;
}

private void TheRedis_SizeChanged(object sender,SizeChangedEventArgs e)
{
if (textBlock == null)
{
foreach (Image tb in FindVisualChildren<Image>(this))
{
if (tb.Tag != null)
{
if (tb.Tag.ToString() == "正常")
{
imageZC = tb;
}

if (tb.Tag.ToString() == "运行")
{
imageYC = tb;
}

if (tb.Tag.ToString() == "故障")
{
imageGZ = tb;
}
}
}

foreach (TextBlock tb in FindVisualChildren<TextBlock>(this))
{
if (tb.Tag != null)
{
if (tb.Tag.ToString() == "显示文字")
{
textBlock = tb;
}
}
}
}
}
public static IEnumerable<T> FindVisualChildren<T>(DependencyObject depObj) where T : DependencyObject
{
if (depObj != null)
{
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++)
{
DependencyObject child = VisualTreeHelper.GetChild(depObj,i);
if (child != null && child is T)
{
yield return (T)child;
}

foreach (T childOfChild in FindVisualChildren<T>(child))
{
yield return childOfChild;
}
}
}
}
public string ControlType => "控件";
private bool isExecuteState;
public bool IsExecuteState
{
get { return isExecuteState; }
set
{
isExecuteState = value;
if (IsExecuteState)
{
Register();
Style = null;
}
}
}
MQTT mQTT = new MQTT();
DispatcherTimer timer = new DispatcherTimer();
public void Register()
{
if (Direction == 0)
{
try
{
if (!string.IsNullOrEmpty(DataSouceInformation))
{
if (DataSouceInformation.Contains(","))
{
string[] lj=DataSouceInformation.Split(',');
if (lj.Length >= 4)
{
int port = 8087;
port= int.Parse(lj[3]);
mQTT.MqttInitAsync(lj[0],lj[1],lj[2],port,$"分布式上位机:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
}
}

}
catch (Exception ex)
{
Direction = 2;
}
}
timer.Interval = TimeSpan.FromSeconds(TimeCount);
timer.Tick += Timer_Tick;
timer.Start();

}
Task<bool> isSuccess;
private async void Timer_Tick(object sender,EventArgs e)
{
Config.GetInstance().RunJsScipt(TikcExecute);
if (mQTT.client != null && mQTT.client.IsConnected)
{
Direction = 1;
}
else
{
Direction = 0;
try
{
if (!string.IsNullOrEmpty(DataSouceInformation))
mQTT.MqttInitAsync("admin","fengyoufu067101!@#","124.222.238.75",61613,$"分布式上位机:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
catch (Exception ex)
{
Direction = 2;
}
}
if (Direction == 1) //定时读取数据
{
try
{
//定时读取数据
}
catch (Exception ex)
{

}
}
}

public void Start() => timer.Start();
public void Stop() => timer.Stop();

public void Dispose()
{
timer.Stop();
}

#region 属性
[Category("事件")]
public string Value
{
get { return (string)GetValue(ValueProperty); }
set { SetValue(ValueProperty,value); }
}
public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value",typeof(string),typeof(TheMQTT),new PropertyMetadata(string.Empty,new PropertyChangedCallback(OnValuePropertyChanged)));
private static void OnValuePropertyChanged(DependencyObject d,DependencyPropertyChangedEventArgs e)
{
(d as TheMQTT)?.RefreshMQTT();
}
public void RefreshMQTT()
{
PublishInfo publishInfo = new PublishInfo();
if (!string.IsNullOrEmpty(Value))
{
publishInfo.PublishModels.Add(JsonConvert.DeserializeObject<PublishModel>(Value));
if (mQTT.client != null && mQTT.client.IsConnected)
mQTT.MqttPublishAsync("DistributedHostComputer/Control",JsonConvert.SerializeObject(publishInfo));
}
}
[Category("值设定")]
public int Direction
{
get { return (int)GetValue(DirectionProperty); }
set { SetValue(DirectionProperty,value); }
}
public static readonly DependencyProperty DirectionProperty =
DependencyProperty.Register("Direction",typeof(int),typeof(TheMQTT),
new PropertyMetadata(0,new PropertyChangedCallback(OnPropertyChanged)));
private static void OnPropertyChanged(DependencyObject d,DependencyPropertyChangedEventArgs e)
{
(d as TheMQTT)?.Refresh();
}
public void Refresh()
{
if (textBlock != null)
{
if (Direction == 1)
{
imageZC.Visibility = Visibility.Collapsed;
imageYC.Visibility = Visibility.Visible;
imageGZ.Visibility = Visibility.Collapsed;
textBlock.Visibility = Visibility.Visible;
textBlock.Text = "运行中";
textBlock.Foreground = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#FF2077EC"));
}
else if (Direction == 2)
{
imageZC.Visibility = Visibility.Collapsed;
imageYC.Visibility = Visibility.Collapsed;
imageGZ.Visibility = Visibility.Visible;
textBlock.Visibility = Visibility.Visible;
textBlock.Text = "故障";
textBlock.Foreground = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#FFFF0202"));
}
else
{
imageZC.Visibility = Visibility.Visible;
imageYC.Visibility = Visibility.Collapsed;
imageGZ.Visibility = Visibility.Collapsed;
textBlock.Visibility = Visibility.Visible;
textBlock.Text = "未运行";
textBlock.Foreground = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#FF02F9FF"));
}
}
}
/// <summary>
/// 执行内容
/// </summary>
[Category("事件")]
public string TikcExecute
{
get { return (string)GetValue(TikcExecuteProperty); }
set { SetValue(TikcExecuteProperty,value); }
}
public static readonly DependencyProperty TikcExecuteProperty =
DependencyProperty.Register("TikcExecute",typeof(string),typeof(TheMQTT),new PropertyMetadata(string.Empty));
#endregion

#region 数据绑定模块
public event EventHandler PropertyChange; //声明一个事件
[Category("数据绑定-数据来源")]
public int TimeCount
{
get { return (int)GetValue(TimeCountProperty); }
set { SetValue(TimeCountProperty,value); }
}
public static readonly DependencyProperty TimeCountProperty =
DependencyProperty.Register("TimeCount",typeof(int),typeof(TheMQTT),new PropertyMetadata(5));
[Category("数据绑定-数据来源")]
public string DataSouceInformation
{
get { return (string)GetValue(DataSouceInformationProperty); }
set { SetValue(DataSouceInformationProperty,value); }
}
public static readonly DependencyProperty DataSouceInformationProperty =
DependencyProperty.Register("DataSouceInformation",typeof(string),typeof(TheMQTT),new PropertyMetadata("admin,fengyoufu067101!@#,124.222.238.75,61613"));
[Category("数据绑定-数据来源")]
public string DeviceName
{
get { return (string)GetValue(DeviceNameProperty); }
set { SetValue(DeviceNameProperty,value); }
}
public static readonly DependencyProperty DeviceNameProperty =
DependencyProperty.Register("DeviceName",typeof(string),typeof(TheMQTT),new PropertyMetadata(string.Empty));
[Category("数据绑定")]
public string FDataSouce
{
get { return (string)GetValue(FDataSouceProperty); }
set { SetValue(FDataSouceProperty,value); }
}
public static readonly DependencyProperty FDataSouceProperty =
DependencyProperty.Register("FDataSouce",typeof(string),typeof(TheMQTT),new PropertyMetadata(string.Empty,new PropertyChangedCallback(onFDataSouceChanged)));
private static void onFDataSouceChanged(DependencyObject d,DependencyPropertyChangedEventArgs e) => (d as TheMQTT)?.DataSouceRefresh();
public void DataSouceRefresh()
{
try
{
if (!string.IsNullOrEmpty(FDataSouce))
{
GenerateData = (string)CSharpConfig.GetInstance().RunCSharp(Code,new object[] { FDataSouce });

}
}
catch (Exception ex)
{

}
}
public static string _code = "public string main(string message) \n{ \n //请在此填写你的代码\n\n return message; \n}\n";
[Category("数据绑定")]
public string Code
{
get { return (string)GetValue(CodeProperty); }
set { SetValue(CodeProperty,value); }
}
public static readonly DependencyProperty CodeProperty =
DependencyProperty.Register("Code",typeof(string),typeof(TheMQTT),new PropertyMetadata(_code));
[Category("数据绑定")]
public string GenerateData
{
get { return (string)GetValue(GenerateDataProperty); }
set { SetValue(GenerateDataProperty,value); }
}
public static readonly DependencyProperty GenerateDataProperty =
DependencyProperty.Register("GenerateData",typeof(string),typeof(TheMQTT),new PropertyMetadata(string.Empty));
#endregion

}
}

+ 33
- 16
BPASmartClient.SCADAControl/CustomerControls/TheRedis.xaml.cs View File

@@ -47,7 +47,6 @@ namespace BPASmartClient.SCADAControl.CustomerControls
{
foreach (Image tb in FindVisualChildren<Image>(this))
{
// do something with tb here
if (tb.Tag != null)
{
if (tb.Tag.ToString() == "正常")
@@ -69,7 +68,6 @@ namespace BPASmartClient.SCADAControl.CustomerControls

foreach (TextBlock tb in FindVisualChildren<TextBlock>(this))
{
// do something with tb here
if (tb.Tag != null)
{
if (tb.Tag.ToString() == "显示文字")
@@ -123,8 +121,9 @@ namespace BPASmartClient.SCADAControl.CustomerControls
try
{
if (!string.IsNullOrEmpty(DataSouceInformation))
{
fRedisClient.Connect(DataSouceInformation);
}
}
catch (Exception ex)
{
@@ -159,17 +158,38 @@ namespace BPASmartClient.SCADAControl.CustomerControls
}
if (Direction == 1) //定时读取数据
{
if (!string.IsNullOrEmpty(DeviceName))
try
{
RedisValue obj = fRedisClient.RedisGet(DeviceName);
FDataSouce = obj.ToString();
List<ReeisDataModel> str = JsonConvert.DeserializeObject<List<ReeisDataModel>>(FDataSouce);
Dictionary<string,object> keys=new Dictionary<string, object>();
str?.ForEach(par =>
if (!string.IsNullOrEmpty(DeviceName))
{
keys[par.VarName] = par.VarVaule;
});
Class_DataBus.GetInstance().Dic_DeviceData[DeviceName] = keys;
RedisValue obj = fRedisClient.RedisGet(DeviceName);
List<DeviceDataModel> str = JsonConvert.DeserializeObject<List<DeviceDataModel>>(obj.ToString());
Dictionary<string,DeviceDataModel> keys = new Dictionary<string,DeviceDataModel>();
str?.ForEach(par =>
{
keys[par.VarName] = par;
});
Class_DataBus.GetInstance().Dic_DeviceData[DeviceName] = keys;
if (PropertyChange != null) PropertyChange(this,null);
}
else
{
fRedisClient.GetKeys()?.ToList().ForEach(par => {

List<DeviceDataModel> str = JsonConvert.DeserializeObject<List<DeviceDataModel>>(par.Value);
Dictionary<string,DeviceDataModel> keys = new Dictionary<string,DeviceDataModel>();
str?.ForEach(par =>
{
keys[par.VarName] = par;
});
Class_DataBus.GetInstance().Dic_DeviceData[par.Key] = keys;
});
if (PropertyChange != null) PropertyChange(this,null);
}
}
catch (Exception ex)
{

}
}
}
@@ -284,10 +304,7 @@ namespace BPASmartClient.SCADAControl.CustomerControls
if (!string.IsNullOrEmpty(FDataSouce))
{
GenerateData = (string)CSharpConfig.GetInstance().RunCSharp(Code,new object[] { FDataSouce });
if (PropertyChange != null)
{
PropertyChange(this,null);
}
}
}
catch (Exception ex)


+ 2
- 2
BPASmartClient.SCADAControl/CustomerControls/TheTextBlock.cs View File

@@ -108,10 +108,10 @@ namespace BPASmartClient.SCADAControl.CustomerControls
{
if (Class_DataBus.GetInstance().Dic_DeviceData.ContainsKey(str[0]))
{
Dictionary<string,object> b = Class_DataBus.GetInstance().Dic_DeviceData[str[0]];
Dictionary<string,DeviceDataModel> b = Class_DataBus.GetInstance().Dic_DeviceData[str[0]];
if (b != null && b.ContainsKey(str[1]))
{
object _value = b[str[1]];
object _value = b[str[1]].VarVaule;
this.GetType().GetProperty(item.Key).SetValue(this,_value);
}
}


+ 47
- 12
BPASmartClient.SCADAControl/CustomerControls/TheTextBox.cs View File

@@ -1,6 +1,8 @@
using BPASmartClient.Compiler;
using BPASmart.Model;
using BPASmartClient.Compiler;
using BPASmartClient.DATABUS;
using BPASmartClient.SCADAControl;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -35,18 +37,36 @@ namespace BPASmartClient.SCADAControl.CustomerControls
ResourceDictionary languageResDic = new ResourceDictionary();
languageResDic.Source = new Uri(@"/BPASmartClient.SCADAControl;component/Themes/Generic.xaml",UriKind.RelativeOrAbsolute);
this.Resources.MergedDictionaries.Add(languageResDic);
Text = "0.01";
//VerticalContentAlignment = VerticalAlignment.Center;
//Style = Application.Current.Resources["DesignTheTextBox"] as Style;//FindResource("DesignTheTextBox") as Style;
//Focusable = false;
Height = 30;
Width = 80;
FontSize = 16;
//HorizontalAlignment = HorizontalAlignment.Left;
//VerticalAlignment = VerticalAlignment.Center;
//Foreground = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#a2c2e8"));
//BorderThickness=new Thickness(1);
this.TextChanged += TheTextBox_TextChanged;
}

private void TheTextBox_TextChanged(object sender,TextChangedEventArgs e)
{
foreach (var item in propertyBing)
{
//{Binding 测试设备.VAR_A_2}
string[] str = item.Value.Replace("{Binding ","").Replace("}","").Split(".");
if (str.Length > 1)
{
if (Class_DataBus.GetInstance().Dic_DeviceData.ContainsKey(str[0]))
{
Dictionary<string,DeviceDataModel> b = Class_DataBus.GetInstance().Dic_DeviceData[str[0]];
if (b != null && b.ContainsKey(str[1]))
{
object _value = b[str[1]].VarVaule;
EDataType eDataType = (EDataType)Enum.Parse(typeof(EDataType),b[str[1]].DataType);
ChangedText = JsonConvert.SerializeObject(new PublishModel { DeviceName = str[0],VarName = str[1],Value = Text,DataType = eDataType });
}
}
}
}
Config.GetInstance().RunJsScipt(ValueChangedExecute);
}

public string ControlType => "控件";

private bool isExecuteState;
@@ -69,6 +89,21 @@ namespace BPASmartClient.SCADAControl.CustomerControls


#region 数据绑定模块
public string ValueChangedExecute
{
get { return (string)GetValue(ValueChangedExecuteProperty); }
set { SetValue(ValueChangedExecuteProperty,value); }
}
public static readonly DependencyProperty ValueChangedExecuteProperty =
DependencyProperty.Register("ValueChangedExecute",typeof(string),typeof(TheTextBox),new PropertyMetadata(string.Empty));
[Category("事件")]
public string ChangedText
{
get { return (string)GetValue(ChaTextProperty); }
set { SetValue(ChaTextProperty,value); }
}
public static readonly DependencyProperty ChaTextProperty =
DependencyProperty.Register("ChangedText",typeof(string),typeof(TheTextBox),new PropertyMetadata(string.Empty));
[Category("数据绑定-数据来源")]
public int TimeCount
{
@@ -100,7 +135,6 @@ namespace BPASmartClient.SCADAControl.CustomerControls
propertyBing[propertyInfo.Name] = propName.ToString();
}
}

timer.Interval = TimeSpan.FromMilliseconds(TimeCount);
timer.Tick += Timer_Tick; ;
timer.Start();
@@ -122,11 +156,12 @@ namespace BPASmartClient.SCADAControl.CustomerControls
{
if (Class_DataBus.GetInstance().Dic_DeviceData.ContainsKey(str[0]))
{
Dictionary<string,object> b = Class_DataBus.GetInstance().Dic_DeviceData[str[0]];
Dictionary<string,DeviceDataModel> b = Class_DataBus.GetInstance().Dic_DeviceData[str[0]];
if (b != null && b.ContainsKey(str[1]))
{
object _value = b[str[1]];
object _value = b[str[1]].VarVaule;
this.GetType().GetProperty(item.Key).SetValue(this,_value);
timer.Stop();
}
}
}


+ 134
- 7
BPASmartClient.SCADAControl/CustomerControls/TheToggleButton.xaml.cs View File

@@ -1,9 +1,13 @@
using BPASmartClient.Compiler;
using BPASmart.Model;
using BPASmartClient.Compiler;
using BPASmartClient.DATABUS;
using BPASmartClient.SCADAControl;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
@@ -16,6 +20,8 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;

namespace BPASmartClient.SCADAControl.CustomerControls
{
/// <summary>
@@ -31,11 +37,11 @@ namespace BPASmartClient.SCADAControl.CustomerControls
public TheToggleButton()
{
InitializeComponent();
Content = "开关";
Width = 80;
Height = 30;
Style = Application.Current.Resources["DesignToggleButton"] as Style;//FindResource("DesignToggleButton") as Style;
VerticalContentAlignment = VerticalAlignment.Center;
ResourceDictionary languageResDic = new ResourceDictionary();
languageResDic.Source = new Uri(@"/BPASmartClient.SCADAControl;component/Themes/Generic.xaml",UriKind.RelativeOrAbsolute);
this.Resources.MergedDictionaries.Add(languageResDic);
}

public string ControlType => "控件";
@@ -49,13 +55,28 @@ namespace BPASmartClient.SCADAControl.CustomerControls
isExecuteState = value;
if (IsExecuteState)
{
Style = Application.Current.Resources["ExecuteToggleButton"] as Style;//FindResource("ExecuteToggleButton") as Style;
//Style = Application.Current.Resources["ExecuteToggleButton"] as Style;//FindResource("ExecuteToggleButton") as Style;

Register();
}
}
}

[Category("事件")]
public string Value
{
get { return (string)GetValue(ValueProperty); }
set { SetValue(ValueProperty,value); }
}
public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value",typeof(string),typeof(TheToggleButton),new PropertyMetadata(string.Empty));
[Category("事件")]
public string Text
{
get { return (string)GetValue(TextProperty); }
set { SetValue(TextProperty,value); }
}
public static readonly DependencyProperty TextProperty =
DependencyProperty.Register("Text",typeof(string),typeof(TheToggleButton),new PropertyMetadata(string.Empty));
/// <summary>
/// 不勾选时执行代码
/// </summary>
@@ -79,20 +100,126 @@ namespace BPASmartClient.SCADAControl.CustomerControls
}
public static readonly DependencyProperty CheckedExecProperty =
DependencyProperty.Register("CheckedExec", typeof(string), typeof(TheToggleButton), new PropertyMetadata(string.Empty));

[Category("数据绑定-数据来源")]
public int TimeCount
{
get { return (int)GetValue(TimeCountProperty); }
set { SetValue(TimeCountProperty,value); }
}
public static readonly DependencyProperty TimeCountProperty =
DependencyProperty.Register("TimeCount",typeof(int),typeof(TheToggleButton),new PropertyMetadata(5));
/// <summary>
/// 属性刷新器
/// </summary>
DispatcherTimer timer = new DispatcherTimer();
/// <summary>
/// 属性绑定变量集合
/// </summary>
Dictionary<string,string> propertyBing = new Dictionary<string,string>();
public void Register()
{
PropertyInfo[] propertyInfos = this.GetType().GetProperties();
foreach (PropertyInfo propertyInfo in propertyInfos)
{
var propName = propertyInfo?.GetValue(this,null);
if (propName is string && propName != null && propName.ToString().Contains("Binding ") && propName.ToString().Contains("."))
{
propertyBing[propertyInfo.Name] = propName.ToString();
}
}
timer.Interval = TimeSpan.FromMilliseconds(TimeCount);
timer.Tick += Timer_Tick; ;
timer.Start();
Checked += TheCheckBox_Checked;
Unchecked += TheCheckBox_Unchecked;
}
/// <summary>
/// 属性刷新事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Timer_Tick(object? sender,EventArgs e)
{
try
{
foreach (var item in propertyBing)
{
//{Binding 测试设备.VAR_A_2}
string[] str = item.Value.Replace("{Binding ","").Replace("}","").Split(".");
if (str.Length > 1)
{
if (Class_DataBus.GetInstance().Dic_DeviceData.ContainsKey(str[0]))
{
Dictionary<string,DeviceDataModel> b = Class_DataBus.GetInstance().Dic_DeviceData[str[0]];
if (b != null && b.ContainsKey(str[1]))
{
object _value = b[str[1]].VarVaule;
bool _checked = false;
try
{
_checked = bool.Parse(_value.ToString());
}
catch (Exception ex)
{
_checked = false;
}
EDataType eDataType = (EDataType)Enum.Parse(typeof(EDataType),b[str[1]].DataType);
Text = JsonConvert.SerializeObject(new PublishModel { DeviceName = str[0],VarName = str[1],Value = _checked.ToString(),DataType = eDataType });
this.GetType().GetProperty("IsChecked").SetValue(this,_checked);
timer.Stop();
}
}
}
}
}
catch (Exception ex)
{

}
}
private void TheCheckBox_Unchecked(object sender, RoutedEventArgs e)
{
foreach (var item in propertyBing)
{
//{Binding 测试设备.VAR_A_2}
string[] str = item.Value.Replace("{Binding ","").Replace("}","").Split(".");
if (str.Length > 1)
{
if (Class_DataBus.GetInstance().Dic_DeviceData.ContainsKey(str[0]))
{
Dictionary<string,DeviceDataModel> b = Class_DataBus.GetInstance().Dic_DeviceData[str[0]];
if (b != null && b.ContainsKey(str[1]))
{
object _value = b[str[1]].VarVaule;
EDataType eDataType = (EDataType)Enum.Parse(typeof(EDataType),b[str[1]].DataType);
Text = JsonConvert.SerializeObject(new PublishModel { DeviceName = str[0],VarName = str[1],Value = "Flase",DataType = eDataType });
}
}
}
}
Config.GetInstance().RunJsScipt(UnCheckedExec);
}

private void TheCheckBox_Checked(object sender, RoutedEventArgs e)
{
foreach (var item in propertyBing)
{
//{Binding 测试设备.VAR_A_2}
string[] str = item.Value.Replace("{Binding ","").Replace("}","").Split(".");
if (str.Length > 1)
{
if (Class_DataBus.GetInstance().Dic_DeviceData.ContainsKey(str[0]))
{
Dictionary<string,DeviceDataModel> b = Class_DataBus.GetInstance().Dic_DeviceData[str[0]];
if (b != null && b.ContainsKey(str[1]))
{
object _value = b[str[1]].VarVaule;
EDataType eDataType = (EDataType)Enum.Parse(typeof(EDataType),b[str[1]].DataType);
Text = JsonConvert.SerializeObject(new PublishModel { DeviceName = str[0],VarName = str[1],Value = "True",DataType = eDataType });
}
}
}
}
Config.GetInstance().RunJsScipt(CheckedExec);
}
}


BIN
View File


BIN
View File


BIN
View File


+ 47
- 0
BPASmartClient.SCADAControl/Themes/Generic.xaml View File

@@ -262,6 +262,53 @@
</Style.Setters>
</Style>

<Style TargetType="{x:Type ctrl:TheToggleButton}" >
<Style.Setters>
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Foreground" Value="{DynamicResource ButtonSelectForeground}" />
<Setter Property="Height" Value="25" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ctrl:TheToggleButton}">
<Border x:Name="BD" Cursor="Hand">
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal" Cursor="Hand">
<TextBlock
x:Name="textBlock"
Margin="10,0,10,0"
VerticalAlignment="Center"
FontSize="14"
Foreground="{DynamicResource ButtonSelectForeground}"
Text="{TemplateBinding Content}" Cursor="Hand" />
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="true">
<Setter TargetName="BD" Property="Background">
<Setter.Value>
<ImageBrush ImageSource="../Images/button2.png" />
</Setter.Value>
</Setter>
<Setter TargetName="textBlock" Property="Foreground" Value="{DynamicResource MeunSelectForeground}" />
</Trigger>
<Trigger Property="IsChecked" Value="False">
<Setter TargetName="BD" Property="Background">
<Setter.Value>
<ImageBrush ImageSource="../Images/button1.png" />
</Setter.Value>
</Setter>
<Setter TargetName="textBlock" Property="Foreground" Value="{DynamicResource ButtonSelectForeground}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="textBlock" Property="Foreground" Value="{DynamicResource ButtonUnSelectForeground}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style.Setters>
</Style>

<Style TargetType="{x:Type ctrl:TheTextBox}">
<Setter Property="BorderBrush" Value="{x:Static Themes1:ClassicBorderDecorator.ClassicBorderBrush}" />
<Setter Property="BorderThickness" Value="1" />


+ 3
- 2
SCADA.Test/MainWindow.xaml.cs View File

@@ -40,13 +40,14 @@ namespace SCADA.Test
/// 接收消息集合
/// </summary>
List<EventReceiveMessage> eventReceiveMessages = new List<EventReceiveMessage>();
FRedisClient fRedisClient = new FRedisClient();

public MainWindow()
{
InitializeComponent();

RedisHelper.GetInstance.ConnectAsync(String.Empty);
fRedisClient.Connect("124.222.238.75:16000,password=123456,defaultDatabase=1");
Dictionary<string,string> sdsd= fRedisClient.GetKeys();
string _code = " public string main(string message) \n { \n //请在此填写你的代码\n\n return message; \n }\n";
string GenerateData = (string)CSharpConfig.GetInstance().RunCSharp(_code,new object[] { "ERERERERE" });



+ 23
- 0
SmartClient.sln View File

@@ -170,6 +170,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerTestDemo", "Compute
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "5.加载UI程序", "5.加载UI程序", "{1DA0F827-5F3D-4B87-9B51-6C0BF5365A3F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MinimalistUI", "BPASmartClient.MinimalistUI\BPASmartClient.MinimalistUI.csproj", "{AE49009F-B7D9-482E-AD1F-4514435272E1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -1544,6 +1546,26 @@ Global
{8940F1E2-693D-407E-AD03-722718860609}.Release|x64.Build.0 = Release|Any CPU
{8940F1E2-693D-407E-AD03-722718860609}.Release|x86.ActiveCfg = Release|Any CPU
{8940F1E2-693D-407E-AD03-722718860609}.Release|x86.Build.0 = Release|Any CPU
{AE49009F-B7D9-482E-AD1F-4514435272E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AE49009F-B7D9-482E-AD1F-4514435272E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AE49009F-B7D9-482E-AD1F-4514435272E1}.Debug|ARM.ActiveCfg = Debug|Any CPU
{AE49009F-B7D9-482E-AD1F-4514435272E1}.Debug|ARM.Build.0 = Debug|Any CPU
{AE49009F-B7D9-482E-AD1F-4514435272E1}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{AE49009F-B7D9-482E-AD1F-4514435272E1}.Debug|ARM64.Build.0 = Debug|Any CPU
{AE49009F-B7D9-482E-AD1F-4514435272E1}.Debug|x64.ActiveCfg = Debug|Any CPU
{AE49009F-B7D9-482E-AD1F-4514435272E1}.Debug|x64.Build.0 = Debug|Any CPU
{AE49009F-B7D9-482E-AD1F-4514435272E1}.Debug|x86.ActiveCfg = Debug|Any CPU
{AE49009F-B7D9-482E-AD1F-4514435272E1}.Debug|x86.Build.0 = Debug|Any CPU
{AE49009F-B7D9-482E-AD1F-4514435272E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AE49009F-B7D9-482E-AD1F-4514435272E1}.Release|Any CPU.Build.0 = Release|Any CPU
{AE49009F-B7D9-482E-AD1F-4514435272E1}.Release|ARM.ActiveCfg = Release|Any CPU
{AE49009F-B7D9-482E-AD1F-4514435272E1}.Release|ARM.Build.0 = Release|Any CPU
{AE49009F-B7D9-482E-AD1F-4514435272E1}.Release|ARM64.ActiveCfg = Release|Any CPU
{AE49009F-B7D9-482E-AD1F-4514435272E1}.Release|ARM64.Build.0 = Release|Any CPU
{AE49009F-B7D9-482E-AD1F-4514435272E1}.Release|x64.ActiveCfg = Release|Any CPU
{AE49009F-B7D9-482E-AD1F-4514435272E1}.Release|x64.Build.0 = Release|Any CPU
{AE49009F-B7D9-482E-AD1F-4514435272E1}.Release|x86.ActiveCfg = Release|Any CPU
{AE49009F-B7D9-482E-AD1F-4514435272E1}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1622,6 +1644,7 @@ Global
{1062F7C7-0117-413C-A45E-8F9B525FC036} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086}
{8940F1E2-693D-407E-AD03-722718860609} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086}
{1DA0F827-5F3D-4B87-9B51-6C0BF5365A3F} = {7B0175AD-BB74-4A98-B9A7-1E289032485E}
{AE49009F-B7D9-482E-AD1F-4514435272E1} = {1DA0F827-5F3D-4B87-9B51-6C0BF5365A3F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC}


Loading…
Cancel
Save