@@ -207,9 +207,11 @@ | |||
<None Remove="Image\表格标题背景2.png" /> | |||
<None Remove="Image\调味品.jpeg" /> | |||
<None Remove="Image\边框效果2.png" /> | |||
<None Remove="Image\边框线.png" /> | |||
<None Remove="Image\边角.png" /> | |||
<None Remove="Image\退出.png" /> | |||
<None Remove="Image\退出按钮.png" /> | |||
<None Remove="Image\透明背景.png" /> | |||
<None Remove="Image\阴影边框.png" /> | |||
<None Remove="Image\顶部.png" /> | |||
<None Remove="Image\顶部切图\Button_No.png" /> | |||
@@ -315,6 +317,7 @@ | |||
<Resource Include="Image\蓝色背景.png" /> | |||
<Resource Include="Image\蓝边框.png" /> | |||
<Resource Include="Image\调味品.jpeg" /> | |||
<Resource Include="Image\边框线.png" /> | |||
<Resource Include="Image\边角.png" /> | |||
</ItemGroup> | |||
@@ -322,6 +325,7 @@ | |||
<Resource Include="Image\HBL.png" /> | |||
<Resource Include="Image\告警\Wifi_NO.ico" /> | |||
<Resource Include="Image\告警\Wifi_OK.ico" /> | |||
<Resource Include="Image\透明背景.png" /> | |||
<Resource Include="Image\阴影边框.png" /> | |||
<Resource Include="Image\顶部切图\Button_No.png" /> | |||
<Resource Include="Image\顶部切图\Button_Select.png" /> | |||
@@ -13,14 +13,75 @@ | |||
<SolidColorBrush x:Key="scb" Color="#FFB1B1B9" /> | |||
<SolidColorBrush x:Key="scbs" Color="#FF6d6666" /> | |||
<SineEase x:Key="SineEaseOut" EasingMode="EaseOut" /> | |||
<Storyboard x:Key="AnimateRound" RepeatBehavior="Forever"> | |||
<DoubleAnimation | |||
EasingFunction="{StaticResource SineEaseOut}" | |||
Storyboard.TargetName="Scale" | |||
Storyboard.TargetProperty="ScaleX" | |||
To="2" | |||
Duration="0:0:01" /> | |||
<DoubleAnimation | |||
EasingFunction="{StaticResource SineEaseOut}" | |||
Storyboard.TargetName="Scale" | |||
Storyboard.TargetProperty="ScaleY" | |||
To="2" | |||
Duration="0:0:01" /> | |||
<DoubleAnimation | |||
EasingFunction="{StaticResource SineEaseOut}" | |||
Storyboard.TargetProperty="Opacity" | |||
To="0" | |||
Duration="0:0:01" /> | |||
</Storyboard> | |||
<Style x:Key="toggleButtonStyle" TargetType="ToggleButton"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="ToggleButton"> | |||
<Grid> | |||
<Ellipse | |||
Name="el" | |||
Width="{TemplateBinding Width}" | |||
Height="{TemplateBinding Height}" | |||
Fill="Red" | |||
RenderTransformOrigin="0.5,0.5"> | |||
<Ellipse.OpacityMask> | |||
<RadialGradientBrush> | |||
<GradientStop Offset="0" Color="Transparent" /> | |||
<GradientStop Offset="1" Color="Black" /> | |||
</RadialGradientBrush> | |||
</Ellipse.OpacityMask> | |||
<Ellipse.RenderTransform> | |||
<ScaleTransform x:Name="Scale" /> | |||
</Ellipse.RenderTransform> | |||
<!--<Ellipse.Triggers> | |||
<EventTrigger RoutedEvent="Loaded"> | |||
<BeginStoryboard Storyboard="{StaticResource AnimateRound}" /> | |||
</EventTrigger> | |||
</Ellipse.Triggers>--> | |||
</Ellipse> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsChecked" Value="True"> | |||
<Setter TargetName="el" Property="Fill" Value="Green" /> | |||
</Trigger> | |||
<Trigger Property="IsChecked" Value="False"> | |||
<Setter TargetName="el" Property="Fill" Value="red" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</UserControl.Resources> | |||
<Grid Name="cav"> | |||
<Viewbox Width="auto" Height="auto"> | |||
<Canvas | |||
Name="cv" | |||
Width="{Binding ElementName=cav, Path=ActualWidth}" | |||
Height="{Binding ElementName=cav, Path=ActualHeight}"> | |||
Width="389" | |||
Height="100"> | |||
<Path | |||
Data="M2 30 L2 70" | |||
Stroke="{StaticResource scb}" | |||
@@ -229,18 +290,37 @@ | |||
Stroke="{StaticResource scbs}" | |||
StrokeThickness="4" /> | |||
<Ellipse | |||
<ToggleButton | |||
IsEnabled="False" | |||
Name="LeftTog" | |||
Width="30" | |||
Height="30" | |||
Margin="120,35,0,0" | |||
HorizontalAlignment="Left" | |||
Fill="Red" /> | |||
<Ellipse | |||
Style="{StaticResource toggleButtonStyle}" /> | |||
<ToggleButton | |||
IsEnabled="False" | |||
Name="RightTog" | |||
Width="30" | |||
Height="30" | |||
Margin="325,35,0,0" | |||
HorizontalAlignment="Left" | |||
Style="{StaticResource toggleButtonStyle}" /> | |||
<!--<Ellipse | |||
Width="30" | |||
Height="30" | |||
Margin="120,35,0,0" | |||
HorizontalAlignment="Left" | |||
Fill="Red" />--> | |||
<!--<Ellipse | |||
Width="30" | |||
Height="30" | |||
Margin="325,35,0,0" | |||
HorizontalAlignment="Left" | |||
Fill="Red" /> | |||
Fill="Red" />--> | |||
</Canvas> | |||
</Viewbox> | |||
@@ -26,6 +26,38 @@ namespace BPASmartClient.CustomResource.UserControls | |||
} | |||
private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | |||
{ | |||
(d as Cylinder)?.Refresh(); | |||
} | |||
private void Refresh() | |||
{ | |||
this.LeftTog.IsChecked = LeftTogIsChecked; | |||
this.RightTog.IsChecked = RightTogIsChecked; | |||
} | |||
public bool LeftTogIsChecked | |||
{ | |||
get { return (bool)GetValue(LeftTogIsCheckedProperty); } | |||
set { SetValue(LeftTogIsCheckedProperty, value); } | |||
} | |||
public static readonly DependencyProperty LeftTogIsCheckedProperty = | |||
DependencyProperty.Register("LeftTogIsChecked", typeof(bool), typeof(Cylinder), | |||
new PropertyMetadata(false, new PropertyChangedCallback(OnPropertyChanged))); | |||
public bool RightTogIsChecked | |||
{ | |||
get { return (bool)GetValue(RightTogIsCheckedProperty); } | |||
set { SetValue(RightTogIsCheckedProperty, value); } | |||
} | |||
public static readonly DependencyProperty RightTogIsCheckedProperty = | |||
DependencyProperty.Register("RightTogIsChecked", typeof(bool), typeof(Cylinder), | |||
new PropertyMetadata(false, new PropertyChangedCallback(OnPropertyChanged))); | |||
} | |||
} |
@@ -27,7 +27,7 @@ | |||
</ResourceDictionary> | |||
</Window.Resources> | |||
<Border Style="{DynamicResource border主窗体背景}"> | |||
<Border Style="{DynamicResource border主窗体背景}"> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="60" /> | |||
@@ -40,7 +40,8 @@ | |||
<ColumnDefinition Width="300" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<Border x:Name="br" | |||
<Border | |||
x:Name="br" | |||
Grid.ColumnSpan="2" | |||
Height="52" | |||
VerticalAlignment="Top" | |||
@@ -103,6 +103,25 @@ namespace BPASmartClient.DosingSystem | |||
}); | |||
#endregion | |||
#region 手动控制 | |||
ObservableCollection<SubMenumodel> ManualControl = new ObservableCollection<SubMenumodel>(); | |||
ManualControl.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "手动控制", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.DosingSystem", | |||
ToggleWindowPath = "View.ManualControlView" | |||
}); | |||
MenuManage.GetInstance.menuModels.Add(new MenuModel() | |||
{ | |||
MainMenuIcon = "", | |||
MainMenuName = "手动控制", | |||
Alias = "Parameter Set", | |||
subMenumodels = ManualControl, | |||
}); | |||
#endregion | |||
#region 消息日志 | |||
ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>(); | |||
InfoLog.Add(new SubMenumodel() | |||
@@ -0,0 +1,186 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.DosingSystem.View.ManualControlView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
<UserControl.Resources> | |||
<Style x:Key="radioButtonStyle" TargetType="RadioButton"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="RadioButton"> | |||
<Grid Name="gr" Opacity="0.8"> | |||
<ContentControl | |||
Margin="{TemplateBinding Margin}" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
HorizontalContentAlignment="Center" | |||
VerticalContentAlignment="Center" | |||
Content="{TemplateBinding Content}" | |||
FontSize="{TemplateBinding FontSize}" | |||
Foreground="{TemplateBinding Foreground}" /> | |||
<Image | |||
Name="image" | |||
Source="/BPASmartClient.CustomResource;component/Image/边框线.png" | |||
Stretch="Fill" /> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsChecked" Value="False"> | |||
<Setter TargetName="image" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/边框线.png" /> | |||
</Trigger> | |||
<Trigger Property="IsChecked" Value="True"> | |||
<Setter TargetName="image" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/透明背景.png" /> | |||
</Trigger> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="gr" Property="Opacity" Value="1" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</UserControl.Resources> | |||
<UserControl.DataContext> | |||
<vm:ManualControlViewModel /> | |||
</UserControl.DataContext> | |||
<Grid> | |||
<ListView | |||
Grid.Column="1" | |||
Margin="10" | |||
Background="Transparent" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="0" | |||
ItemsSource="{Binding cylinderModels}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Grid | |||
Margin="0 0 0 15" | |||
Width="200" | |||
Height="100" | |||
Background="Transparent"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
<RowDefinition Height="30" /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.5*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="1" | |||
Grid.ColumnSpan="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="Aqua" | |||
Text="{Binding Name}" /> | |||
<pry:Cylinder | |||
Grid.Row="1" | |||
Grid.ColumnSpan="3" | |||
Width="200" | |||
Height="50" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
LeftTogIsChecked="{Binding LeftTog}" | |||
RightTogIsChecked="{Binding RightTog}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="1" | |||
Content="打开" | |||
Foreground="Aqua" | |||
IsChecked="True" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="2" | |||
Content="关闭" | |||
Foreground="Aqua" | |||
IsChecked="False" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
<!--<UniformGrid Columns="7" Rows="5"> | |||
<Grid | |||
Width="200" | |||
Height="100" | |||
Background="Transparent"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
<RowDefinition Height="30" /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.5*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="1" | |||
Grid.ColumnSpan="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="Aqua" | |||
Text="设备1" /> | |||
<pry:Cylinder | |||
Grid.Row="1" | |||
Grid.ColumnSpan="3" | |||
Width="200" | |||
Height="50" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="1" | |||
Content="打开" | |||
Foreground="Aqua" | |||
IsChecked="True" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="2" | |||
Content="关闭" | |||
Foreground="Aqua" | |||
IsChecked="False" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
</Grid> | |||
</UniformGrid>--> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,28 @@ | |||
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.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// ManualControlView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class ManualControlView : UserControl | |||
{ | |||
public ManualControlView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,45 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.ObjectModel; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class ManualControlViewModel : ObservableObject | |||
{ | |||
public ManualControlViewModel() | |||
{ | |||
for (int i = 0; i < 40; i++) | |||
{ | |||
cylinderModels.Add(new CylinderModel() | |||
{ | |||
Name = $"设备 {i.ToString()}", | |||
LeftTog = false, | |||
RightTog = false, | |||
}); | |||
} | |||
} | |||
public ObservableCollection<CylinderModel> cylinderModels { get; set; } = new ObservableCollection<CylinderModel>(); | |||
} | |||
public class CylinderModel : ObservableObject | |||
{ | |||
public bool LeftTog { get { return _mLeftTog; } set { _mLeftTog = value; OnPropertyChanged(); } } | |||
private bool _mLeftTog; | |||
public bool RightTog { get { return _mRightTog; } set { _mRightTog = value; OnPropertyChanged(); } } | |||
private bool _mRightTog; | |||
public string Name { get { return _mName; } set { _mName = value; OnPropertyChanged(); } } | |||
private string _mName; | |||
} | |||
} |