소스 검색

新增了gif显示

luo 7 달 전
부모
커밋
812780136a

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 9 - 0
AppResource/MangerResource.xaml


+ 4 - 0
HandyControl/HandyControl_Shared/Input/SimpleMouseBinding.cs

@@ -70,6 +70,10 @@ internal sealed class SimpleMouseBinding : InputBinding
         try
         {
             MouseAction = mouseGesture.MouseAction;
+        }
+        catch
+        {
+
         }
         finally
         {

+ 1 - 0
Shaker.Model/Model/ShakerControlModel.cs

@@ -789,6 +789,7 @@ namespace Shaker.Model
         public PLCDigitalGroupModel CoolingWaterDigitalGroup = new PLCDigitalGroupModel();
         [MessagePack.Key(34)]
         public PLCAnlogModel CoolingWaterOperatingStatus = new PLCAnlogModel();
+  
         public short[] GetDatas()
         {
             return new short[Shaker.Model.DataMangerItemModel.ANALOG_DATA_LENGTH]

+ 1 - 1
ShakerControl/App.xaml.cs

@@ -43,7 +43,7 @@ namespace ShakerControl
                     ShakerControl.MainWindow mainWindow = new ShakerControl.MainWindow();
                     mainWindow.Top = 0;
                     mainWindow.Left = 0;
-                    mainWindow.Topmost = true;
+                    mainWindow.Topmost = false;
                     mainWindow.ShowInTaskbar = true;
                     mainWindow.Show();
                     splashScreen.Close();

+ 1 - 1
ShakerControl/Tools/DispatherInovke.cs

@@ -13,7 +13,7 @@ namespace ShakerControl.Tools
             if (action == null) return;
             try
             {
-                if (App.Current.Dispatcher.Thread == Thread.CurrentThread)
+                if (App.Current?.Dispatcher?.Thread == Thread.CurrentThread)
                 {
                     action();
                 }

+ 74 - 0
ShakerManger/App.xaml

@@ -607,6 +607,80 @@
                 </Style.Triggers>
             </Style>
 
+            <Style x:Key="HasIconButton" TargetType="Button">
+                <Setter Property="Background" Value="Transparent" />
+                <Setter Property="Tag" Value="{StaticResource LightEmbellishBrush}" />
+                <Setter Property="BorderBrush" Value="{DynamicResource EmbellishBrush}" />
+                <Setter Property="BorderThickness" Value="1" />
+                <Setter Property="Foreground" Value="{DynamicResource LableBrush}" />
+                <Setter Property="Template">
+                    <Setter.Value>
+                        <ControlTemplate TargetType="Button">
+                            <Border
+                                Background="{TemplateBinding Background}"
+                                BorderBrush="{TemplateBinding BorderBrush}"
+                                BorderThickness="{TemplateBinding BorderThickness}"
+                                CornerRadius="6">
+                                <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
+                                    <Grid.ColumnDefinitions>
+                                        <ColumnDefinition Width="auto" />
+                                        <ColumnDefinition Width="*" />
+                                    </Grid.ColumnDefinitions>
+                                    <Viewbox
+                                        Width="{TemplateBinding hc:IconElement.Width}"
+                                        Height="{TemplateBinding hc:IconElement.Height}"
+                                        HorizontalAlignment="Right"
+                                        VerticalAlignment="Center">
+                                        <Path Data="{TemplateBinding hc:IconElement.Geometry}" Fill="{TemplateBinding Foreground}" />
+                                    </Viewbox>
+                                    <TextBlock
+                                        Grid.Column="1"
+                                        Margin="4,0,0,0"
+                                        Padding="0"
+                                        HorizontalAlignment="Left"
+                                        VerticalAlignment="Center"
+                                        Background="Transparent"
+                                        FontFamily="{TemplateBinding FontFamily}"
+                                        FontSize="{TemplateBinding FontSize}"
+                                        FontStretch="{TemplateBinding FontStretch}"
+                                        FontWeight="{TemplateBinding FontWeight}"
+                                        Foreground="{TemplateBinding Foreground}"
+                                        Text="{TemplateBinding Content}" />
+                                </Grid>
+                            </Border>
+                        </ControlTemplate>
+                    </Setter.Value>
+                </Setter>
+                <Setter Property="Cursor" Value="Hand" />
+                <Setter Property="FocusVisualStyle" Value="{x:Null}" />
+                <Style.Triggers>
+                    <Trigger Property="IsFocused" Value="True">
+                        <Setter Property="Background" Value="{DynamicResource EmbellishBrush}" />
+                    </Trigger>
+                    <Trigger Property="IsMouseOver" Value="True">
+                        <Setter Property="Foreground" Value="{Binding Path=Tag, RelativeSource={RelativeSource Mode=Self}}" />
+                    </Trigger>
+                    <MultiTrigger>
+                        <MultiTrigger.Conditions>
+                            <Condition Property="IsMouseOver" Value="True" />
+                            <Condition Property="IsFocused" Value="True" />
+                        </MultiTrigger.Conditions>
+                        <Setter Property="Foreground" Value="{DynamicResource MainBrush}" />
+                    </MultiTrigger>
+                    <MultiTrigger>
+                        <MultiTrigger.Conditions>
+                            <Condition Property="IsMouseOver" Value="True" />
+                            <Condition Property="IsFocused" Value="False" />
+                        </MultiTrigger.Conditions>
+                        <Setter Property="Background" Value="{DynamicResource EmbellishBrush}" />
+                        <Setter Property="Foreground" Value="{DynamicResource MainBrush}" />
+                    </MultiTrigger>
+                    <Trigger Property="IsEnabled" Value="False">
+                        <Setter Property="Foreground" Value="Gray" />
+                        <Setter Property="BorderBrush" Value="Gray" />
+                    </Trigger>
+                </Style.Triggers>
+            </Style>
             <Style
                 x:Key="ImageButton"
                 TargetType="Button"

+ 2 - 2
ShakerManger/App.xaml.cs

@@ -62,7 +62,7 @@ namespace ShakerManger
             BsonSerializer.RegisterSerializer(DateTimeSerializer.LocalInstance);
             BsonSerializer.RegisterSerializer(new ObjectSerializer(ObjectSerializer.AllAllowedTypes));
             View.SplashScreenView view = new View.SplashScreenView();
-            view.Topmost = true;
+            view.Topmost = false;
             view.DataContext = new ViewModel.SplashScreenViewModel();
             view.Show();
             MainWindow window = new MainWindow();
@@ -71,7 +71,7 @@ namespace ShakerManger
                 view.Visibility = Visibility.Collapsed;
                 window.Top = 0;
                 window.Left = 0;
-                window.Topmost = true;
+                window.Topmost = false;
                 window.ShowInTaskbar = true;
                 window.Show();
                 view.Close();

BIN
ShakerManger/GIF/Shaker0.gif


BIN
ShakerManger/GIF/Shaker1.gif


+ 48 - 10
ShakerManger/MainWindow.xaml

@@ -860,20 +860,32 @@
                                 <Button
                                     Width="88"
                                     Height="38"
+                                    hc:IconElement.Geometry="{StaticResource YesGeometry}"
+                                    hc:IconElement.Height="20"
+                                    hc:IconElement.Width="20"
+                                    BorderBrush="Green"
                                     Command="{Binding YesCommand}"
                                     Content="{Binding YesText}"
                                     Cursor="Hand"
                                     FontSize="16"
+                                    Foreground="Green"
+                                    Style="{StaticResource HasIconButton}"
                                     ToolTip="{Binding YesText}"
                                     Visibility="{Binding YesVisibility}" />
                                 <Button
                                     Width="88"
                                     Height="38"
                                     Margin="40,0,0,0"
+                                    hc:IconElement.Geometry="{StaticResource NoGeometry}"
+                                    hc:IconElement.Height="20"
+                                    hc:IconElement.Width="20"
+                                    BorderBrush="Red"
                                     Command="{Binding NoCommand}"
                                     Content="{Binding NoText}"
                                     Cursor="Hand"
                                     FontSize="16"
+                                    Foreground="Red"
+                                    Style="{StaticResource HasIconButton}"
                                     ToolTip="{Binding NoText}"
                                     Visibility="{Binding NoVisibility}" />
 
@@ -995,18 +1007,28 @@
                                 <Button
                                     Width="120"
                                     Height="36"
+                                    hc:IconElement.Geometry="{StaticResource LoginGeometry}"
+                                    hc:IconElement.Height="20"
+                                    hc:IconElement.Width="20"
                                     Command="{Binding LoginCommand}"
                                     Content="登录"
                                     Cursor="Hand"
-                                    FontSize="16" />
+                                    FontSize="16"
+                                    Style="{StaticResource HasIconButton}" />
                                 <Button
                                     Width="120"
                                     Height="36"
                                     Margin="40,0,0,0"
+                                    hc:IconElement.Geometry="{StaticResource ExitGeometry}"
+                                    hc:IconElement.Height="20"
+                                    hc:IconElement.Width="20"
                                     Command="{Binding Source={StaticResource MainViewModel}, Path=Data.ShutDownCommand}"
                                     Content="退出"
                                     Cursor="Hand"
-                                    FontSize="16" />
+                                    FontSize="16"
+                                    BorderBrush="Red"
+                                    Foreground="Red"
+                                    Style="{StaticResource HasIconButton}" />
                             </StackPanel>
                         </Grid>
                     </Grid>
@@ -1054,7 +1076,7 @@
                     Height="{x:Static SystemParameters.PrimaryScreenHeight}"
                     Background="#9FAAAAAA">
                     <Border
-                        Width="1220"
+                        Width="760"
                         Height="760"
                         Background="{StaticResource MainBrush}"
                         BorderBrush="{StaticResource AuxiliaryBrush}"
@@ -1121,17 +1143,25 @@
                                                 <Button
                                                     Width="180"
                                                     Height="48"
+                                                    hc:IconElement.Geometry="{StaticResource StartGeometry}"
+                                                    hc:IconElement.Height="28"
+                                                    hc:IconElement.Width="28"
                                                     Command="{Binding Shakers.OpenCommand}"
-                                                    Content="打开"
-                                                    FontSize="14"
+                                                    Content="打开增益"
+                                                    FontSize="16"
+                                                    Style="{StaticResource HasIconButton}"
                                                     ToolTip="打开增益" />
                                                 <Button
                                                     Width="180"
                                                     Height="48"
                                                     Margin="80,0,0,0"
+                                                    hc:IconElement.Geometry="{StaticResource StopGeometry}"
+                                                    hc:IconElement.Height="28"
+                                                    hc:IconElement.Width="28"
                                                     Command="{Binding Shakers.CloseCommand}"
-                                                    Content="关闭"
-                                                    FontSize="14"
+                                                    Content="关闭增益"
+                                                    FontSize="16"
+                                                    Style="{StaticResource HasIconButton}"
                                                     ToolTip="关闭增益" />
                                             </StackPanel>
                                         </UniformGrid>
@@ -1223,7 +1253,7 @@
                                                             <Border Background="{StaticResource EmbellishBrush}" CornerRadius="6,6,0,0">
                                                                 <Grid>
                                                                     <Grid.ColumnDefinitions>
-                                                                        <ColumnDefinition Width="66" />
+                                                                        <ColumnDefinition Width="68" />
                                                                         <ColumnDefinition Width="*" />
                                                                     </Grid.ColumnDefinitions>
                                                                     <TextBlock
@@ -1254,8 +1284,8 @@
                                                     <DataTemplate>
                                                         <Grid IsEnabled="{Binding IsConnected}">
                                                             <Grid.ColumnDefinitions>
-                                                                <ColumnDefinition Width="66" />
-                                                                <ColumnDefinition Width="1142" />
+                                                                <ColumnDefinition Width="68" />
+                                                                <ColumnDefinition Width="680" />
                                                             </Grid.ColumnDefinitions>
                                                             <Line
                                                                 Grid.ColumnSpan="2"
@@ -1275,6 +1305,14 @@
                                                                 HorizontalAlignment="Center"
                                                                 VerticalAlignment="Center"
                                                                 Text="{Binding Description}">
+                                                                <hc:Interaction.Triggers>
+                                                                    <hc:EventTrigger EventName="MouseUp">
+                                                                        <hc:SetPropertyAction
+                                                                            PropertyName="IsDeviceControl"
+                                                                            PropertyValue="{Binding IsDeviceControl, Converter={StaticResource Boolean2BooleanReConverter}}"
+                                                                            TargetObject="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=TextBlock}, Path=DataContext}" />
+                                                                    </hc:EventTrigger>
+                                                                </hc:Interaction.Triggers>
                                                                 <TextBlock.Style>
                                                                     <Style TargetType="TextBlock">
                                                                         <Style.Triggers>

+ 12 - 0
ShakerManger/ShakerManger.csproj

@@ -60,6 +60,18 @@
     </EmbeddedResource>
   </ItemGroup>
 
+  <ItemGroup>
+    <None Update="GIF\Shaker0.gif">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="GIF\Shaker1.gif">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Update="GIF\Shaker3.gif">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+  </ItemGroup>
+
   <Import Project="..\ActiveMQ\Apache.NMS.ActiveMQ\Apache.NMS.ActiveMQ.projitems" Label="Shared" />
   <Import Project="..\EasyMQ\EasyMQ.projitems" Label="Shared" />
 

+ 14 - 6
ShakerManger/View/AddUserView.xaml

@@ -21,9 +21,9 @@
     <Border
         HorizontalAlignment="Center"
         VerticalAlignment="Center"
+        Background="{StaticResource MainBrush}"
         BorderBrush="{StaticResource AuxiliaryBrush}"
         BorderThickness="1"
-        Background="{StaticResource MainBrush}"
         CornerRadius="6">
 
         <Grid
@@ -131,16 +131,16 @@
                                                     Y2="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Grid}, Path=ActualHeight}" />
 
                                                 <TextBlock
-                                                    Foreground="{StaticResource MainBrush}"
                                                     HorizontalAlignment="Center"
                                                     VerticalAlignment="Center"
-                                                    Text="振动台ClientID" />
+                                                    Foreground="{StaticResource MainBrush}"
+                                                    Text="振动台" />
 
                                                 <TextBlock
                                                     Grid.Column="1"
-                                                    Foreground="{StaticResource MainBrush}"
                                                     HorizontalAlignment="Center"
                                                     VerticalAlignment="Center"
+                                                    Foreground="{StaticResource MainBrush}"
                                                     Text="是否允许" />
                                             </Grid>
                                             <hc:ScrollViewer
@@ -266,17 +266,25 @@
                 <Button
                     Width="120"
                     Height="32"
+                    hc:IconElement.Geometry="{StaticResource YesGeometry}"
+                    hc:IconElement.Height="20"
+                    hc:IconElement.Width="20"
                     Command="{Binding OkCommand}"
                     Content="确认"
                     FontSize="16"
-                    IsEnabled="{Binding CanOk}" />
+                    IsEnabled="{Binding CanOk}"
+                    Style="{StaticResource HasIconButton}" />
                 <Button
                     Width="120"
                     Height="32"
                     Margin="20,0,0,0"
+                    hc:IconElement.Geometry="{StaticResource NoGeometry}"
+                    hc:IconElement.Height="20"
+                    hc:IconElement.Width="20"
                     Command="{Binding CancelCommand}"
                     Content="取消"
-                    FontSize="16" />
+                    FontSize="16"
+                    Style="{StaticResource HasIconButton}" />
             </StackPanel>
         </Grid>
     </Border>

+ 12 - 3
ShakerManger/View/ResetPassWordView.xaml

@@ -20,9 +20,10 @@
     <Border
         HorizontalAlignment="Center"
         VerticalAlignment="Center"
+        Background="{StaticResource MainBrush}"
         BorderBrush="{StaticResource AuxiliaryBrush}"
         BorderThickness="1"
-        Background="{StaticResource MainBrush}" CornerRadius="6">
+        CornerRadius="6">
         <Grid Margin="60">
             <Grid.RowDefinitions>
                 <RowDefinition Height="46" />
@@ -73,15 +74,23 @@
                 <Button
                     Width="86"
                     Height="36"
+                    hc:IconElement.Geometry="{StaticResource YesGeometry}"
+                    hc:IconElement.Height="20"
+                    hc:IconElement.Width="20"
                     Command="{Binding OkCommand}"
                     Content="确认"
-                    IsEnabled="{Binding CanOk}" />
+                    IsEnabled="{Binding CanOk}"
+                    Style="{StaticResource HasIconButton}" />
                 <Button
                     Width="86"
                     Height="36"
                     Margin="80,0,0,0"
+                    hc:IconElement.Geometry="{StaticResource NoGeometry}"
+                    hc:IconElement.Height="20"
+                    hc:IconElement.Width="20"
                     Command="{Binding CancelCommand}"
-                    Content="取消" />
+                    Content="取消"
+                    Style="{StaticResource HasIconButton}" />
             </StackPanel>
         </Grid>
     </Border>

+ 32 - 0
ShakerManger/View/ShakerCoolingWaterView.xaml

@@ -66,6 +66,7 @@
                             Stroke="{StaticResource ButtonNomalColor}"
                             StrokeThickness="1" />
                         <Path
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Left"
                             VerticalAlignment="Bottom"
                             Data="M0,0 L0,8 L8,8"
@@ -80,6 +81,7 @@
                             StrokeThickness="1" />
                         <Path
                             Grid.ColumnSpan="2"
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Right"
                             VerticalAlignment="Bottom"
                             Data="M0,8 L8,8 L8,0"
@@ -119,6 +121,7 @@
                             Stroke="{StaticResource ButtonNomalColor}"
                             StrokeThickness="1" />
                         <Path
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Left"
                             VerticalAlignment="Bottom"
                             Data="M0,0 L0,8 L8,8"
@@ -133,6 +136,7 @@
                             StrokeThickness="1" />
                         <Path
                             Grid.ColumnSpan="2"
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Right"
                             VerticalAlignment="Bottom"
                             Data="M0,8 L8,8 L8,0"
@@ -173,6 +177,7 @@
                             Stroke="{StaticResource ButtonNomalColor}"
                             StrokeThickness="1" />
                         <Path
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Left"
                             VerticalAlignment="Bottom"
                             Data="M0,0 L0,8 L8,8"
@@ -187,6 +192,7 @@
                             StrokeThickness="1" />
                         <Path
                             Grid.ColumnSpan="2"
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Right"
                             VerticalAlignment="Bottom"
                             Data="M0,8 L8,8 L8,0"
@@ -227,6 +233,7 @@
                             Stroke="{StaticResource ButtonNomalColor}"
                             StrokeThickness="1" />
                         <Path
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Left"
                             VerticalAlignment="Bottom"
                             Data="M0,0 L0,8 L8,8"
@@ -241,6 +248,7 @@
                             StrokeThickness="1" />
                         <Path
                             Grid.ColumnSpan="2"
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Right"
                             VerticalAlignment="Bottom"
                             Data="M0,8 L8,8 L8,0"
@@ -281,6 +289,7 @@
                             Stroke="{StaticResource ButtonNomalColor}"
                             StrokeThickness="1" />
                         <Path
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Left"
                             VerticalAlignment="Bottom"
                             Data="M0,0 L0,8 L8,8"
@@ -295,6 +304,7 @@
                             StrokeThickness="1" />
                         <Path
                             Grid.ColumnSpan="2"
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Right"
                             VerticalAlignment="Bottom"
                             Data="M0,8 L8,8 L8,0"
@@ -335,6 +345,7 @@
                             Stroke="{StaticResource ButtonNomalColor}"
                             StrokeThickness="1" />
                         <Path
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Left"
                             VerticalAlignment="Bottom"
                             Data="M0,0 L0,8 L8,8"
@@ -349,6 +360,7 @@
                             StrokeThickness="1" />
                         <Path
                             Grid.ColumnSpan="2"
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Right"
                             VerticalAlignment="Bottom"
                             Data="M0,8 L8,8 L8,0"
@@ -389,6 +401,7 @@
                             Stroke="{StaticResource ButtonNomalColor}"
                             StrokeThickness="1" />
                         <Path
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Left"
                             VerticalAlignment="Bottom"
                             Data="M0,0 L0,8 L8,8"
@@ -403,6 +416,7 @@
                             StrokeThickness="1" />
                         <Path
                             Grid.ColumnSpan="2"
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Right"
                             VerticalAlignment="Bottom"
                             Data="M0,8 L8,8 L8,0"
@@ -443,6 +457,7 @@
                             Stroke="{StaticResource ButtonNomalColor}"
                             StrokeThickness="1" />
                         <Path
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Left"
                             VerticalAlignment="Bottom"
                             Data="M0,0 L0,8 L8,8"
@@ -457,6 +472,7 @@
                             StrokeThickness="1" />
                         <Path
                             Grid.ColumnSpan="2"
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Right"
                             VerticalAlignment="Bottom"
                             Data="M0,8 L8,8 L8,0"
@@ -496,6 +512,7 @@
                             Stroke="{StaticResource ButtonNomalColor}"
                             StrokeThickness="1" />
                         <Path
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Left"
                             VerticalAlignment="Bottom"
                             Data="M0,0 L0,8 L8,8"
@@ -510,6 +527,7 @@
                             StrokeThickness="1" />
                         <Path
                             Grid.ColumnSpan="2"
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Right"
                             VerticalAlignment="Bottom"
                             Data="M0,8 L8,8 L8,0"
@@ -549,6 +567,7 @@
                             Stroke="{StaticResource ButtonNomalColor}"
                             StrokeThickness="1" />
                         <Path
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Left"
                             VerticalAlignment="Bottom"
                             Data="M0,0 L0,8 L8,8"
@@ -563,6 +582,7 @@
                             StrokeThickness="1" />
                         <Path
                             Grid.ColumnSpan="2"
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Right"
                             VerticalAlignment="Bottom"
                             Data="M0,8 L8,8 L8,0"
@@ -602,6 +622,7 @@
                             Stroke="{StaticResource ButtonNomalColor}"
                             StrokeThickness="1" />
                         <Path
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Left"
                             VerticalAlignment="Bottom"
                             Data="M0,0 L0,8 L8,8"
@@ -616,6 +637,7 @@
                             StrokeThickness="1" />
                         <Path
                             Grid.ColumnSpan="2"
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Right"
                             VerticalAlignment="Bottom"
                             Data="M0,8 L8,8 L8,0"
@@ -655,6 +677,7 @@
                             Stroke="{StaticResource ButtonNomalColor}"
                             StrokeThickness="1" />
                         <Path
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Left"
                             VerticalAlignment="Bottom"
                             Data="M0,0 L0,8 L8,8"
@@ -669,6 +692,7 @@
                             StrokeThickness="1" />
                         <Path
                             Grid.ColumnSpan="2"
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Right"
                             VerticalAlignment="Bottom"
                             Data="M0,8 L8,8 L8,0"
@@ -708,6 +732,7 @@
                             Stroke="{StaticResource ButtonNomalColor}"
                             StrokeThickness="1" />
                         <Path
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Left"
                             VerticalAlignment="Bottom"
                             Data="M0,0 L0,8 L8,8"
@@ -722,6 +747,7 @@
                             StrokeThickness="1" />
                         <Path
                             Grid.ColumnSpan="2"
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Right"
                             VerticalAlignment="Bottom"
                             Data="M0,8 L8,8 L8,0"
@@ -761,6 +787,7 @@
                             Stroke="{StaticResource ButtonNomalColor}"
                             StrokeThickness="1" />
                         <Path
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Left"
                             VerticalAlignment="Bottom"
                             Data="M0,0 L0,8 L8,8"
@@ -775,6 +802,7 @@
                             StrokeThickness="1" />
                         <Path
                             Grid.ColumnSpan="2"
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Right"
                             VerticalAlignment="Bottom"
                             Data="M0,8 L8,8 L8,0"
@@ -814,6 +842,7 @@
                             Stroke="{StaticResource ButtonNomalColor}"
                             StrokeThickness="1" />
                         <Path
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Left"
                             VerticalAlignment="Bottom"
                             Data="M0,0 L0,8 L8,8"
@@ -828,6 +857,7 @@
                             StrokeThickness="1" />
                         <Path
                             Grid.ColumnSpan="2"
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Right"
                             VerticalAlignment="Bottom"
                             Data="M0,8 L8,8 L8,0"
@@ -867,6 +897,7 @@
                             Stroke="{StaticResource ButtonNomalColor}"
                             StrokeThickness="1" />
                         <Path
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Left"
                             VerticalAlignment="Bottom"
                             Data="M0,0 L0,8 L8,8"
@@ -881,6 +912,7 @@
                             StrokeThickness="1" />
                         <Path
                             Grid.ColumnSpan="2"
+                            Margin="0,0,0,4"
                             HorizontalAlignment="Right"
                             VerticalAlignment="Bottom"
                             Data="M0,8 L8,8 L8,0"

+ 72 - 5
ShakerManger/View/ShakerInfoView.xaml

@@ -29,12 +29,12 @@
                 <ColumnDefinition Width="0.45*" />
                 <ColumnDefinition Width="0.35*" />
             </Grid.ColumnDefinitions>
+
             <Image
-                Width="288"
+                MaxWidth="260"
                 gif:AnimationBehavior.AutoStart="{Binding AutoStart}"
                 gif:AnimationBehavior.RepeatBehavior="{Binding RepeatBehavior}"
-                gif:AnimationBehavior.SourceUri="{Binding GifPath}"
-                Visibility="{Binding ImageVisibily, Converter={StaticResource Boolean2VisibilityConverter}}">
+                gif:AnimationBehavior.SourceUri="{Binding GifPath}">
                 <hc:Interaction.Triggers>
                     <hc:EventTrigger EventName="Loaded">
                         <hc:SetPropertyAction
@@ -48,8 +48,8 @@
                 Grid.Row="0"
                 Grid.Column="1"
                 hc:TitleElement.Background="{StaticResource EmbellishBrush}"
-                hc:TitleElement.MinHeight="40"
                 hc:TitleElement.Foreground="{StaticResource MainBrush}"
+                hc:TitleElement.MinHeight="40"
                 Background="Transparent"
                 BorderBrush="Gray"
                 BorderThickness="1"
@@ -274,6 +274,72 @@
                         <RowDefinition Height="0.3*" />
                         <RowDefinition Height="0.4*" />
                     </Grid.RowDefinitions>
+                    <StackPanel
+                        Grid.Row="0"
+                        HorizontalAlignment="Center"
+                        VerticalAlignment="Center"
+                        Orientation="Horizontal"
+                        TextBlock.FontSize="16">
+                        <Button
+                            Width="120"
+                            Height="48"
+                            hc:IconElement.Geometry="{StaticResource StartGeometry}"
+                            hc:IconElement.Height="20"
+                            hc:IconElement.Width="20"
+                            Content="打开增益">
+                            <Button.Style>
+                                <Style TargetType="Button" BasedOn="{StaticResource HasIconButton}">
+                                    <Style.Setters>
+                                        <Setter Property="IsEnabled">
+                                            <Setter.Value>
+                                                <MultiBinding
+                                                    Converter="{StaticResource MultiBoolConverter}"
+                                                    Mode="OneWay">
+                                                    <Binding Path="GainSwitchEnabled" />
+                                                    <Binding Converter="{StaticResource Boolean2BooleanReConverter}" Path="GainSwitch" />
+                                                </MultiBinding>
+                                            </Setter.Value>
+                                        </Setter>
+                                    </Style.Setters>
+                                </Style>
+                            </Button.Style>
+                            <hc:Interaction.Triggers>
+                                <hc:EventTrigger EventName="Click">
+                                    <hc:ExInvokeCommandAction Command="{Binding GainSwitchCommand}" CommandParameter="{x:Static system:Boolean.TrueString}" />
+                                </hc:EventTrigger>
+                            </hc:Interaction.Triggers>
+                        </Button>
+                        <Button
+                            Width="120"
+                            Height="48"
+                            Margin="20,0,0,0"
+                            hc:IconElement.Geometry="{StaticResource StopGeometry}"
+                            hc:IconElement.Height="20"
+                            hc:IconElement.Width="20"
+                            Content="关闭增益">
+                            <Button.Style>
+                                <Style TargetType="Button" BasedOn="{StaticResource HasIconButton}">
+                                    <Style.Setters>
+                                        <Setter Property="IsEnabled">
+                                            <Setter.Value>
+                                                <MultiBinding
+                                                    Converter="{StaticResource MultiBoolConverter}"
+                                                    Mode="OneWay">
+                                                    <Binding Path="GainSwitchEnabled" />
+                                                    <Binding Path="GainSwitch" />
+                                                </MultiBinding>
+                                            </Setter.Value>
+                                        </Setter>
+                                    </Style.Setters>
+                                </Style>
+                            </Button.Style>
+                            <hc:Interaction.Triggers>
+                                <hc:EventTrigger EventName="Click">
+                                    <hc:ExInvokeCommandAction Command="{Binding GainSwitchCommand}" CommandParameter="{x:Static system:Boolean.FalseString}" />
+                                </hc:EventTrigger>
+                            </hc:Interaction.Triggers>
+                        </Button>
+                    </StackPanel>
                     <hc:BulletCheckBox
                         Width="120"
                         Height="48"
@@ -281,7 +347,8 @@
                         CheckedText="开"
                         IsChecked="{Binding GainSwitch}"
                         IsEnabled="{Binding GainSwitchEnabled, Mode=OneWay}"
-                        Text="关">
+                        Text="关"
+                        Visibility="Collapsed">
                         <hc:Interaction.Triggers>
                             <hc:EventTrigger EventName="Click">
                                 <hc:ExInvokeCommandAction Command="{Binding GainSwitchCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=hc:BulletCheckBox}, Path=IsChecked}" />

+ 5 - 2
ShakerManger/View/ShakerPageView.xaml

@@ -183,14 +183,17 @@
                     Value="{Binding SystemConfig.ShakerPage.CurrentShaker.SlaveID, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
             </StackPanel>
 
-
             <UniformGrid Rows="1">
                 <Button
-                    Width="120"
+                    Width="144"
                     Height="34"
+                    hc:IconElement.Geometry="{StaticResource SaveGeometry}"
+                    hc:IconElement.Height="20"
+                    hc:IconElement.Width="20"
                     Command="{Binding SystemConfig.ShakerPage.SaveCommand}"
                     Content="保存配置"
                     FontSize="16"
+                    Style="{StaticResource HasIconButton}"
                     TabIndex="4" />
             </UniformGrid>
         </UniformGrid>

+ 51 - 26
ShakerManger/View/ShakerView.xaml

@@ -131,11 +131,29 @@
                                     </Style>
                                 </TextBlock.Style>
                             </TextBlock>
-                            <Ellipse
+                            <Grid
                                 Width="30"
                                 Height="30"
-                                Margin="4,0,0,0"
-                                Fill="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=StackPanel}, Path=Children[0].Foreground}" />
+                                Margin="4,0,0,0">
+                                <Ellipse
+                                    Width="30"
+                                    Height="30"
+                                    HorizontalAlignment="Center"
+                                    VerticalAlignment="Center"
+                                    Stroke="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=StackPanel}, Path=Children[0].Foreground}"
+                                    StrokeThickness="1" />
+                                <Viewbox
+                                    Margin="2"
+                                    HorizontalAlignment="Center"
+                                    VerticalAlignment="Center">
+                                    <Ellipse
+                                        Width="20"
+                                        Height="{Binding RelativeSource={RelativeSource Mode=Self}, Path=ActualWidth}"
+                                        HorizontalAlignment="Center"
+                                        VerticalAlignment="Center"
+                                        Fill="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=StackPanel}, Path=Children[0].Foreground}" />
+                                </Viewbox>
+                            </Grid>
                             <TextBlock
                                 Margin="4,0,0,0"
                                 VerticalAlignment="Center"
@@ -187,7 +205,7 @@
                         Visibility="{Binding RelativeSource={RelativeSource Mode=Self}, Path=IsEnabled, Converter={StaticResource Boolean2VisibilityConverter}}">
                         <Button.Style>
                             <Style TargetType="Button" BasedOn="{StaticResource ImageButton}">
-                                <Setter Property="Foreground" Value="{StaticResource MainBrush}"/>
+                                <Setter Property="Foreground" Value="{StaticResource MainBrush}" />
                                 <Setter Property="IsEnabled">
                                     <Setter.Value>
                                         <MultiBinding Converter="{StaticResource MultiBoolConverter}">
@@ -216,7 +234,7 @@
                         Visibility="{Binding RelativeSource={RelativeSource Mode=Self}, Path=IsEnabled, Converter={StaticResource Boolean2VisibilityConverter}}">
                         <Button.Style>
                             <Style TargetType="Button" BasedOn="{StaticResource ImageButton}">
-                                <Setter Property="Foreground" Value="{StaticResource MainBrush}"/>
+                                <Setter Property="Foreground" Value="{StaticResource MainBrush}" />
                                 <Setter Property="IsEnabled">
                                     <Setter.Value>
                                         <MultiBinding Converter="{StaticResource MultiBoolConverter}">
@@ -241,7 +259,7 @@
                         Cursor="Hand">
                         <Button.Style>
                             <Style TargetType="Button" BasedOn="{StaticResource ImageButton}">
-                                <Setter Property="Foreground" Value="{StaticResource MainBrush}"/>
+                                <Setter Property="Foreground" Value="{StaticResource MainBrush}" />
                                 <Style.Triggers>
                                     <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.None}">
                                         <Setter Property="Visibility" Value="Collapsed" />
@@ -429,11 +447,14 @@
                         Width="126"
                         Height="46"
                         Margin="0,10,0,0"
+                        hc:IconElement.Geometry="{StaticResource LinkGeometry}"
+                        hc:IconElement.Height="20"
+                        hc:IconElement.Width="20"
                         Command="{Binding ConnectCommand}"
                         Content="连接功放"
                         FontSize="14">
                         <Button.Style>
-                            <Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
+                            <Style TargetType="Button" BasedOn="{StaticResource HasIconButton}">
                                 <Setter Property="IsEnabled">
                                     <Setter.Value>
                                         <MultiBinding Converter="{StaticResource MultiBoolConverter}">
@@ -502,6 +523,18 @@
                             <Border.Style>
                                 <Style TargetType="Border">
                                     <Style.Triggers>
+                                        <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.None}">
+                                            <Setter Property="IsEnabled" Value="False" />
+                                        </DataTrigger>
+                                        <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.ShakerControl}">
+                                            <Setter Property="IsEnabled" Value="True" />
+                                        </DataTrigger>
+                                        <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.Plot}">
+                                            <Setter Property="IsEnabled" Value="True" />
+                                        </DataTrigger>
+                                        <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.CoolingWater}">
+                                            <Setter Property="IsEnabled" Value="True" />
+                                        </DataTrigger>
                                         <Trigger Property="IsMouseOver" Value="True">
                                             <Setter Property="Background" Value="{StaticResource ButtonFocusedColor}" />
                                         </Trigger>
@@ -509,28 +542,20 @@
                                 </Style>
                             </Border.Style>
                             <StackPanel Margin="10,0,0,0" Orientation="Horizontal">
-                                <StackPanel.Style>
-                                    <Style TargetType="StackPanel">
-                                        <Style.Triggers>
-                                            <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.None}">
-                                                <Setter Property="Visibility" Value="Collapsed" />
-                                            </DataTrigger>
-                                            <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.ShakerControl}">
-                                                <Setter Property="Visibility" Value="Visible" />
-                                            </DataTrigger>
-                                            <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.Plot}">
-                                                <Setter Property="Visibility" Value="Visible" />
-                                            </DataTrigger>
-                                            <DataTrigger Binding="{Binding ShakerView}" Value="{x:Static mangerdata:ShakerViewType.CoolingWater}">
-                                                <Setter Property="Visibility" Value="Visible" />
-                                            </DataTrigger>
-                                        </Style.Triggers>
-                                    </Style>
-                                </StackPanel.Style>
                                 <TextBlock
                                     VerticalAlignment="Center"
                                     FontSize="14"
-                                    Text="显示内容" />
+                                    Text="显示内容">
+                                    <TextBlock.Style>
+                                        <Style TargetType="TextBlock">
+                                            <Style.Triggers>
+                                                <Trigger Property="IsEnabled" Value="False">
+                                                    <Setter Property="Foreground" Value="Gray" />
+                                                </Trigger>
+                                            </Style.Triggers>
+                                        </Style>
+                                    </TextBlock.Style>
+                                </TextBlock>
                                 <ComboBox
                                     Width="120"
                                     Margin="4,0,0,0"

+ 17 - 9
ShakerManger/View/SqlPageView.xaml

@@ -76,13 +76,13 @@
                     VerticalAlignment="Center"
                     FontSize="16">
                     <Run Foreground="Red" Text="*" />
-                    <Run  Text="数据库地址:" />
+                    <Run Text="数据库地址:" />
                 </TextBlock>
                 <hc:TextBox
                     Width="720"
                     Margin="10,0,0,0"
                     Background="Transparent"
-                    CaretBrush="{Binding RelativeSource={RelativeSource Mode=Self},Path=Foreground}"
+                    CaretBrush="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Foreground}"
                     FontSize="16"
                     TabIndex="0"
                     Text="{Binding IP, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
@@ -97,13 +97,13 @@
                     VerticalAlignment="Center"
                     FontSize="16">
                     <Run Foreground="Red" Text="*" />
-                    <Run  Text="数据库端口:" />
+                    <Run Text="数据库端口:" />
                 </TextBlock>
                 <hc:NumericUpDown
                     Width="120"
                     Margin="10,0,0,0"
                     Background="Transparent"
-                    CaretBrush="{Binding RelativeSource={RelativeSource Mode=Self},Path=Foreground}"
+                    CaretBrush="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Foreground}"
                     FontSize="16"
                     Maximum="65535"
                     Minimum="1"
@@ -126,7 +126,7 @@
                     Width="720"
                     Margin="10,0,0,0"
                     Background="Transparent"
-                    CaretBrush="{Binding RelativeSource={RelativeSource Mode=Self},Path=Foreground}"
+                    CaretBrush="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Foreground}"
                     FontSize="16"
                     TabIndex="2"
                     Text="{Binding DbName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
@@ -161,7 +161,7 @@
                         Width="720"
                         Margin="10,0,0,0"
                         Background="Transparent"
-                        CaretBrush="{Binding RelativeSource={RelativeSource Mode=Self},Path=Foreground}"
+                        CaretBrush="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Foreground}"
                         FontSize="16"
                         TabIndex="4"
                         Text="{Binding UserName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
@@ -180,12 +180,12 @@
                         BorderBrush="Transparent"
                         BorderThickness="0"
                         Content="数据库密码:"
-                        FontSize="16"/>
+                        FontSize="16" />
                     <hc:PasswordBox
                         Width="720"
                         Margin="10,0,0,0"
                         Background="Transparent"
-                        CaretBrush="{Binding RelativeSource={RelativeSource Mode=Self},Path=Foreground}"
+                        CaretBrush="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Foreground}"
                         FontSize="16"
                         IsSafeEnabled="True"
                         TabIndex="5"
@@ -199,16 +199,24 @@
                 <Button
                     Width="120"
                     Height="34"
+                    hc:IconElement.Geometry="{StaticResource TestGeometry}"
+                    hc:IconElement.Height="20"
+                    hc:IconElement.Width="20"
                     Command="{Binding TestConnectCommand}"
                     Content="测试连接"
                     FontSize="16"
+                    Style="{StaticResource HasIconButton}"
                     TabIndex="6" />
                 <Button
-                    Width="140"
+                    Width="160"
                     Height="34"
+                    hc:IconElement.Geometry="{StaticResource SaveGeometry}"
+                    hc:IconElement.Height="20"
+                    hc:IconElement.Width="20"
                     Command="{Binding SaveCommand}"
                     Content="保存配置并重启"
                     FontSize="16"
+                    Style="{StaticResource HasIconButton}"
                     TabIndex="7" />
             </UniformGrid>
         </Grid>

+ 10 - 6
ShakerManger/View/SystemPageView.xaml

@@ -46,7 +46,7 @@
                 Height="32"
                 Margin="4,0,0,0"
                 Background="Transparent"
-                CaretBrush="{Binding RelativeSource={RelativeSource Mode=Self},Path=Foreground}"
+                CaretBrush="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Foreground}"
                 FontSize="14"
                 Minimum="10"
                 Value="{Binding LoopTime}" />
@@ -68,7 +68,7 @@
                 Height="32"
                 Margin="4,0,0,0"
                 Background="Transparent"
-                CaretBrush="{Binding RelativeSource={RelativeSource Mode=Self},Path=Foreground}"
+                CaretBrush="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Foreground}"
                 FontSize="14"
                 Minimum="1000"
                 Value="{Binding RequestPermissionsTimeout, Mode=TwoWay}" />
@@ -89,7 +89,7 @@
                 Height="32"
                 Margin="4,0,0,0"
                 Background="Transparent"
-                CaretBrush="{Binding RelativeSource={RelativeSource Mode=Self},Path=Foreground}"
+                CaretBrush="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Foreground}"
                 FontSize="14"
                 Maximum="12000"
                 Minimum="10"
@@ -102,9 +102,13 @@
                 Text="s" />
         </StackPanel>
         <Button
-            Height="32"
+            Height="42"
+            hc:IconElement.Geometry="{StaticResource SaveGeometry}"
+            hc:IconElement.Height="20"
+            hc:IconElement.Width="20"
             Command="{Binding SaveCommand}"
-            Content="确认"
-            FontSize="16" />
+            Content="保存"
+            FontSize="16"
+            Style="{StaticResource HasIconButton}" />
     </UniformGrid>
 </UserControl>

+ 22 - 6
ShakerManger/View/UserPageView.xaml

@@ -141,9 +141,9 @@
 
                                             <TextBlock
                                                 Grid.Column="1"
-                                                Foreground="{StaticResource MainBrush}"
                                                 HorizontalAlignment="Center"
                                                 VerticalAlignment="Center"
+                                                Foreground="{StaticResource MainBrush}"
                                                 Text="是否允许" />
                                         </Grid>
                                         <hc:ScrollViewer
@@ -180,7 +180,7 @@
                                             Grid.Column="0"
                                             Grid.ColumnSpan="2"
                                             VerticalAlignment="Bottom"
-                                            Stroke="{StaticResource AuxiliaryBrush }"
+                                            Stroke="{StaticResource AuxiliaryBrush}"
                                             X1="0"
                                             X2="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Grid}, Path=ActualWidth}"
                                             Y1="0"
@@ -269,29 +269,45 @@
             <Button
                 Width="120"
                 Height="32"
+                hc:IconElement.Geometry="{StaticResource AddUserGeometry}"
+                hc:IconElement.Height="20"
+                hc:IconElement.Width="20"
                 Command="{Binding AddUserCommand}"
-                Content="新增用户" />
+                Content="新增用户"
+                Style="{StaticResource HasIconButton}" />
             <Button
                 Width="120"
                 Height="32"
                 Margin="20,0,0,0"
+                hc:IconElement.Geometry="{StaticResource SaveGeometry}"
+                hc:IconElement.Height="20"
+                hc:IconElement.Width="20"
                 Command="{Binding SaveUserCommand}"
                 Content="保存"
-                IsEnabled="{Binding SelectedUser.IsChanged}" />
+                IsEnabled="{Binding SelectedUser.IsChanged}"
+                Style="{StaticResource HasIconButton}" />
             <Button
                 Width="120"
                 Height="32"
                 Margin="20,0,0,0"
+                hc:IconElement.Geometry="{StaticResource EditPasswordGeometry}"
+                hc:IconElement.Height="20"
+                hc:IconElement.Width="20"
                 Command="{Binding ResetPasswordCommand}"
                 Content="修改密码"
-                IsEnabled="{Binding IsLocalUser}" />
+                IsEnabled="{Binding IsLocalUser}"
+                Style="{StaticResource HasIconButton}" />
             <Button
                 Width="120"
                 Height="32"
                 Margin="20,0,0,0"
+                hc:IconElement.Geometry="{StaticResource DelUserGeometry}"
+                hc:IconElement.Height="20"
+                hc:IconElement.Width="20"
                 Command="{Binding DeleteUserCommand}"
                 Content="删除用户"
-                IsEnabled="{Binding IsLocalUser}" />
+                IsEnabled="{Binding IsLocalUser}"
+                Style="{StaticResource HasIconButton}" />
         </StackPanel>
     </Grid>
 </UserControl>

+ 9 - 2
ShakerManger/ViewModel/LogMangerViewModel.cs

@@ -78,8 +78,15 @@ namespace ShakerManger.ViewModel
             {
                 collection.ForEach(x =>
                 {
-                    x.UserID = user?.FirstOrDefault(y => y.Id == x.UserID)?.UserName ?? "";
-                    x.ShakerID = MainWindowViewModel.Default.Shakers.Shakers.FirstOrDefault(y => y.Model.Id == x.ShakerID)?.Title ?? "";
+                    if (string.IsNullOrEmpty(x.UserID))
+                    {
+                        x.UserID = "---";
+                    }
+                    else
+                    {
+                        x.UserID = user?.FirstOrDefault(y => y.Id == x.UserID)?.UserName ?? "未知用户";
+                    }
+                    x.ShakerID = MainWindowViewModel.Default.Shakers.Shakers.FirstOrDefault(y => y.Model.Id == x.ShakerID)?.Title ?? "未知振动台";
                 });
             }
             

+ 63 - 46
ShakerManger/ViewModel/ShakerControlViewModel.cs

@@ -11,6 +11,7 @@ using System.ComponentModel.DataAnnotations;
 using System.Diagnostics.CodeAnalysis;
 using System.IO;
 using System.Linq;
+using System.Security.AccessControl;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows;
@@ -18,6 +19,8 @@ using System.Windows.Controls;
 using System.Windows.Input;
 using System.Windows.Media;
 using System.Windows.Media.Animation;
+using System.Windows.Media.Media3D;
+using System.Windows.Threading;
 using XamlAnimatedGif;
 
 namespace ShakerManger.ViewModel
@@ -30,7 +33,7 @@ namespace ShakerManger.ViewModel
         private ObservableCollection<DataMangerItemViewModel> Items { get; } = new ObservableCollection<DataMangerItemViewModel>();
 
         private List<OxyPlot.Series.LineSeries> _LineSeries = new List<OxyPlot.Series.LineSeries>();
-        public string GifPath { get => gifPath; set =>UpdateProperty(ref gifPath, value); }
+
         public string[] PropertiyNames { get; }= new string[]
         {
             nameof(DataMangerItemViewModel.OperatingStatus),
@@ -58,13 +61,13 @@ namespace ShakerManger.ViewModel
             nameof(DataMangerItemViewModel.Gain),
         };
 
-        public bool ImageVisibily { get => imageVisibily; set =>UpdateProperty(ref imageVisibily,value); }
+        public bool ModelVisibily { get => modelVisibily; set =>UpdateProperty(ref modelVisibily,value); }
         public ICommand MenuShowCommand => new DelegateCommand<ExCommandParameter>(MenuShow);
         private void MenuShow(ExCommandParameter parameter)
         {
             if(parameter.EventArgs is MouseButtonEventArgs args)
             {
-                if (args.ChangedButton == MouseButton.Right)
+                if (args.ChangedButton == MouseButton.Right && (args.OriginalSource == null ? true :!(args.OriginalSource.GetType().FullName.Contains("Helix"))))
                 {
                     MenuIsOpen = true;
                 }
@@ -138,25 +141,7 @@ namespace ShakerManger.ViewModel
                 }
             }
         }
-        public bool StartupCompleted
-        { 
-            get => startupCompleted;
-            set
-            {
-                if (startupCompleted == value) return;
-                UpdateProperty(ref startupCompleted, value);
-                OnPropertyChanged(nameof(GainSwitchEnabled));
-                if (animator == null) return;
-                if(value)
-                {
-                    animator?.Play();
-                }
-                else
-                {
-                    animator?.Pause();
-                }
-            }
-        }
+
         public bool MenuIsOpen { get => menuIsOpen; set =>UpdateProperty(ref menuIsOpen , value); }
         private Data.ShakerViewType lastviewType = ShakerViewType.ShakerControl;
         public Data.ShakerViewType ShakerView 
@@ -188,22 +173,61 @@ namespace ShakerManger.ViewModel
                 }
             }
         }
-        private bool isVisible = false;
+        public bool StartupCompleted
+        {
+            get => startupCompleted;
+            set
+            {
+                if (startupCompleted == value) return;
+                UpdateProperty(ref startupCompleted, value);
+                OnPropertyChanged(nameof(GainSwitchEnabled));
+                if (value)
+                {
+                    animator?.Play();
+                }
+                else
+                {
+                    animator.Pause();
+                }
+            }
+        }
+        public bool CacheFramesInMemory { get => cacheFramesInMemory; set => UpdateProperty(ref cacheFramesInMemory, value); }
+        public bool AutoStart { get => autoStart; set => UpdateProperty(ref autoStart, value); }
+        [AllowNull]
+        private Animator animator;
+
+        [AllowNull]
+        private Image image;
+
 
+        public Image Image
+        {
+            get => image;
+            set
+            {
+                image = value;
+                if (animator == null && value != null) animator = AnimationBehavior.GetAnimator(value);
+            }
+        }
+        public RepeatBehavior RepeatBehavior { get => repeatBehavior; set =>UpdateProperty(ref repeatBehavior, value); }
+        public string GifPath { get => gifPath; set => UpdateProperty(ref gifPath, value); }
+        private bool isVisible = false;
+        private static string ModelDirectory=System.AppDomain.CurrentDomain.BaseDirectory + $"Model\\";
         public bool IsVisible { get => isVisible; set => UpdateProperty(ref isVisible, value); }
         public string[] AnalogNames { get; } = new string[Shaker.Model.DataMangerItemModel.ANALOG_DATA_LENGTH];
         public string[] Units { get; } = new string[Shaker.Model.DataMangerItemModel.ANALOG_DATA_LENGTH];
         private Dictionary<string, string> Properties { get; init; } = new Dictionary<string, string>();
 
         public ObservableCollection<PlotConfigViewModel> PlotConfig { get; } = new ObservableCollection<PlotConfigViewModel>();
-        public RepeatBehavior RepeatBehavior { get => repeatBehavior; set =>UpdateProperty(ref repeatBehavior, value); }
         public int Index { get; }
+
         public ShakerControlViewModel(Shaker.Model.ShakerControlModel model,int index)
         {
             Index = index;
-            GifPath = System.AppDomain.CurrentDomain.BaseDirectory + $"\\GIF\\Shaker{index}.gif";
-            ImageVisibily = File.Exists(GifPath);
             Model = model;
+            GifPath = System.AppDomain.CurrentDomain.BaseDirectory + $"\\GIF\\Shaker{index}.gif";
+            ModelVisibily = File.Exists(GifPath);
+
             Values.Add(new PLCAnlogViewModel(model.ExcitationVoltage));
             Values.Add(new PLCAnlogViewModel(model.ExcitationCurrent)
             {
@@ -416,7 +440,7 @@ namespace ShakerManger.ViewModel
                 {
                     GainSwitch = data.GainSwich;
                     StartupCompleted = data.StartupCompleted;
-                    
+
                 });
             }, $"{Shaker.Model.GlobalVariable.ShakerIDKey}='{Model.Id}'");
             BusManger.Defaut.Bus.PubSub.Subscribe<Shaker.Model.ClientExitModel>((data, pro) =>
@@ -467,6 +491,7 @@ namespace ShakerManger.ViewModel
                 MenuIsOpen = true;
             })); 
         }
+
         public OxyPlot.IPlotController PlotController { get; } = new OxyPlot.PlotController();
         public View.ShakerView Content { get; } = new View.ShakerView();
         public bool GainSwitch 
@@ -562,6 +587,13 @@ namespace ShakerManger.ViewModel
             {
                 if (switchon) Open();
                 else Close();
+                return;
+            }
+            if(parameter.Parameter is string val && bool.TryParse(val,out var result))
+            {
+                if (result) Open();
+                else Close();
+                return;
             }
         }
         private void SetGain(short gain)
@@ -579,8 +611,7 @@ namespace ShakerManger.ViewModel
                 PromptViewModel.Default.NoVisibility = Visibility.Collapsed;
                 PromptViewModel.Default.IsOpen = true;
             }
-        }
-        public bool GainSwitchEnabled => CurrentData?.OperatingStatus == OperatingStatus.Run && StartupCompleted;
+        } public bool GainSwitchEnabled => CurrentData?.OperatingStatus == OperatingStatus.Run && StartupCompleted;
         public bool GainEnabled => CurrentData != null && (CurrentData.OperatingStatus == OperatingStatus.Run && GainSwitch);
         public bool StartEnabled => CurrentData?.OperatingStatus == OperatingStatus.Wait;
         public bool StopEnabled => CurrentData?.OperatingStatus == OperatingStatus.Run;
@@ -659,18 +690,12 @@ namespace ShakerManger.ViewModel
         private string activeMQClintID = string.Empty;
         private string gifPath = string.Empty;
         private RepeatBehavior repeatBehavior = RepeatBehavior.Forever;
-        private bool autoStart = false;
+        private bool autoStart = true;
         private bool cacheFramesInMemory = true;
 
-        public bool CacheFramesInMemory { get => cacheFramesInMemory; set =>UpdateProperty(ref cacheFramesInMemory, value); }
-        public bool AutoStart { get => autoStart; set =>UpdateProperty(ref autoStart ,value); }
         public string Title => string.IsNullOrEmpty(Description) ? Name : Description;
-        [AllowNull]
-        private Animator animator;
 
-        [AllowNull]
-        private Image image;
-        private bool imageVisibily = false;
+        private bool modelVisibily = false;
 
         public string Name
         {
@@ -681,15 +706,7 @@ namespace ShakerManger.ViewModel
                 OnPropertyChanged(nameof(Title));
             }
         }
-        public Image Image 
-        {
-            get => image;
-            set
-            {
-                image = value;
-                if (animator == null && value!=null) animator = AnimationBehavior.GetAnimator(value);
-            }
-        }
+
         public string Description
         {
             get => Model.Description;

+ 5 - 2
ShakerManger/ViewModel/ShakersViewModel.cs

@@ -293,7 +293,6 @@ namespace ShakerManger.ViewModel
                 while(!source.IsCancellationRequested)
                 {
                     if (shaker.CurrentData.OperatingStatus == Shaker.Model.OperatingStatus.Warn) return true;
-                    if (shaker.StartupCompleted) return false;
                     await Task.Delay(50);
                     if ((DateTime.Now - dateTime).TotalSeconds >= timeout) return true;
                 }
@@ -359,7 +358,7 @@ namespace ShakerManger.ViewModel
                     int srcindex = -1;
                     for (int i = 0; i < LayoutShakers.Count; i++)
                     {
-                        if (LayoutShakers[i].Name == shaker.Name)
+                        if (LayoutShakers[i].Model.Id == shaker.Model.Id)
                         {
                             srcindex = i;
                             break;
@@ -373,6 +372,10 @@ namespace ShakerManger.ViewModel
                     UpdateProperty(ref selectedInfo, value);
                     SelectedIsOpen = false;
                 }
+                for(int i=0;i<LayoutShakers.Count;i++)
+                {
+                    LayoutShakers[i].IsVisible = i < Layout.RowCount * Layout.ColumnCount;
+                }
             }
         }
         public bool IsSelected { get; set; }

+ 6 - 2
ShakerManger/ViewModel/WarnMangerViewModel.cs

@@ -44,8 +44,12 @@ namespace ShakerManger.ViewModel
             {
                 collection.ForEach(x =>
                 {
-                    x.UserID = user?.FirstOrDefault(y => y.Id == x.UserID)?.UserName ?? "";
-                    x.ShakerID = MainWindowViewModel.Default.Shakers.Shakers.FirstOrDefault(y => y.Model.Id == x.ShakerID)?.Title ?? "";
+                    if(string.IsNullOrEmpty(x.UserID))
+                    {
+                        x.UserID = "---";
+                    }
+                    else x.UserID = user?.FirstOrDefault(y => y.Id == x.UserID)?.UserName ?? "未知用户";
+                    x.ShakerID = MainWindowViewModel.Default.Shakers.Shakers.FirstOrDefault(y => y.Model.Id == x.ShakerID)?.Title ?? "未知振动台";
                 });
             }
 

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.