Forráskód Böngészése

开始修改控制端的界面

l2736 9 hónapja
szülő
commit
4291b12d52

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 3 - 0
AppResource/MangerResource.xaml


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 220 - 220
HandyControl/HandyControl_Shared/Themes/Theme.xaml


+ 4 - 4
ShakerControl/App.xaml

@@ -341,8 +341,8 @@
             </Style>
             <Style
                 x:Key="ComboBoxStyle1"
-                TargetType="{x:Type ComboBox}"
-                BasedOn="{StaticResource InputElementBaseStyle}">
+                BasedOn="{StaticResource InputElementBaseStyle}"
+                TargetType="{x:Type ComboBox}">
                 <Setter Property="ItemContainerStyle" Value="{StaticResource ComboBoxItemBaseStyle1}" />
                 <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
                 <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
@@ -360,8 +360,8 @@
             </Style>
             <Style
                 x:Key="PowerAmplifierButtonStyle"
-                TargetType="Button"
-                BasedOn="{StaticResource ButtonIcon}">
+                BasedOn="{StaticResource ButtonIcon}"
+                TargetType="Button">
                 <Style.Triggers>
                     <Trigger Property="IsMouseOver" Value="True">
                         <Setter Property="Foreground" Value="CadetBlue" />

+ 11 - 67
ShakerControl/View/MainPage/MainPageView.xaml

@@ -165,7 +165,7 @@
                         FontSize="{StaticResource TextFontSize}"
                         Foreground="{StaticResource ContentTextBrush}"
                         Interval="1"
-                        IsEnabled="{Binding ShakerControl.PowerAmplifier.GainSwitch}"
+                        IsEnabled="{Binding ShakerControl.GainEnabled, Mode=OneWay}"
                         IsMoveToPointEnabled="True"
                         IsSnapToTickEnabled="True"
                         Maximum="100"
@@ -187,22 +187,8 @@
                         BorderBrush="Gray"
                         CheckedText="开"
                         IsChecked="{Binding ShakerControl.PowerAmplifier.GainSwitch}"
+                        IsEnabled="{Binding ShakerControl.GainSwitchEnabled, Mode=OneWay}"
                         Text="关">
-                        <hc:BulletCheckBox.Style>
-                            <Style TargetType="hc:BulletCheckBox" BasedOn="{StaticResource {x:Type hc:BulletCheckBox}}">
-                                <Style.Triggers>
-                                    <DataTrigger Binding="{Binding Path=ShakerControl.OperatingStatus}" Value="{x:Static model:OperatingStatus.Run}">
-                                        <Setter Property="IsEnabled" Value="True" />
-                                    </DataTrigger>
-                                    <DataTrigger Binding="{Binding Path=ShakerControl.OperatingStatus}" Value="{x:Static model:OperatingStatus.Wait}">
-                                        <Setter Property="IsEnabled" Value="False" />
-                                    </DataTrigger>
-                                    <DataTrigger Binding="{Binding Path=ShakerControl.OperatingStatus}" Value="{x:Static model:OperatingStatus.Warn}">
-                                        <Setter Property="IsEnabled" Value="False" />
-                                    </DataTrigger>
-                                </Style.Triggers>
-                            </Style>
-                        </hc:BulletCheckBox.Style>
                         <hc:Interaction.Triggers>
                             <hc:EventTrigger EventName="Click">
                                 <hc:ExInvokeCommandAction Command="{Binding ShakerControl.PowerAmplifier.GainSwitchCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=hc:BulletCheckBox}, Path=IsChecked}" />
@@ -229,23 +215,9 @@
                             hc:IconElement.Geometry="{StaticResource PowerAmplifierStart}"
                             Command="{Binding ShakerControl.PowerAmplifier.StartCommand}"
                             Cursor="Hand"
-                            ToolTip="启动">
-                            <Button.Style>
-                                <Style TargetType="Button" BasedOn="{StaticResource PowerAmplifierButtonStyle}">
-                                    <Style.Triggers>
-                                        <DataTrigger Binding="{Binding Path=ShakerControl.OperatingStatus}" Value="{x:Static model:OperatingStatus.Run}">
-                                            <Setter Property="IsEnabled" Value="False" />
-                                        </DataTrigger>
-                                        <DataTrigger Binding="{Binding Path=ShakerControl.OperatingStatus}" Value="{x:Static model:OperatingStatus.Wait}">
-                                            <Setter Property="IsEnabled" Value="True" />
-                                        </DataTrigger>
-                                        <DataTrigger Binding="{Binding Path=ShakerControl.OperatingStatus}" Value="{x:Static model:OperatingStatus.Warn}">
-                                            <Setter Property="IsEnabled" Value="False" />
-                                        </DataTrigger>
-                                    </Style.Triggers>
-                                </Style>
-                            </Button.Style>
-                        </Button>
+                            IsEnabled="{Binding ShakerControl.StartEnabled}"
+                            Style="{StaticResource PowerAmplifierButtonStyle}"
+                            ToolTip="启动" />
                     </StackPanel>
                     <StackPanel>
                         <TextBlock
@@ -262,23 +234,9 @@
                             hc:IconElement.Geometry="{StaticResource PowerAmplifierStop}"
                             Command="{Binding ShakerControl.PowerAmplifier.StopCommand}"
                             Cursor="Hand"
-                            ToolTip="停止">
-                            <Button.Style>
-                                <Style TargetType="Button" BasedOn="{StaticResource PowerAmplifierButtonStyle}">
-                                    <Style.Triggers>
-                                        <DataTrigger Binding="{Binding Path=ShakerControl.OperatingStatus}" Value="{x:Static model:OperatingStatus.Run}">
-                                            <Setter Property="IsEnabled" Value="True" />
-                                        </DataTrigger>
-                                        <DataTrigger Binding="{Binding Path=ShakerControl.OperatingStatus}" Value="{x:Static model:OperatingStatus.Wait}">
-                                            <Setter Property="IsEnabled" Value="False" />
-                                        </DataTrigger>
-                                        <DataTrigger Binding="{Binding Path=ShakerControl.OperatingStatus}" Value="{x:Static model:OperatingStatus.Warn}">
-                                            <Setter Property="IsEnabled" Value="False" />
-                                        </DataTrigger>
-                                    </Style.Triggers>
-                                </Style>
-                            </Button.Style>
-                        </Button>
+                            IsEnabled="{Binding ShakerControl.StopEnabled}"
+                            Style="{StaticResource PowerAmplifierButtonStyle}"
+                            ToolTip="停止" />
                     </StackPanel>
                     <StackPanel>
                         <TextBlock
@@ -295,23 +253,9 @@
                             hc:IconElement.Geometry="{StaticResource PowerAmplifierReset}"
                             Command="{Binding ShakerControl.PowerAmplifier.ResetCommand}"
                             Cursor="Hand"
-                            ToolTip="报警复位">
-                            <Button.Style>
-                                <Style TargetType="Button" BasedOn="{StaticResource PowerAmplifierButtonStyle}">
-                                    <Style.Triggers>
-                                        <DataTrigger Binding="{Binding Path=ShakerControl.OperatingStatus}" Value="{x:Static model:OperatingStatus.Run}">
-                                            <Setter Property="IsEnabled" Value="False" />
-                                        </DataTrigger>
-                                        <DataTrigger Binding="{Binding Path=ShakerControl.OperatingStatus}" Value="{x:Static model:OperatingStatus.Wait}">
-                                            <Setter Property="IsEnabled" Value="False" />
-                                        </DataTrigger>
-                                        <DataTrigger Binding="{Binding Path=ShakerControl.OperatingStatus}" Value="{x:Static model:OperatingStatus.Warn}">
-                                            <Setter Property="IsEnabled" Value="True" />
-                                        </DataTrigger>
-                                    </Style.Triggers>
-                                </Style>
-                            </Button.Style>
-                        </Button>
+                            IsEnabled="{Binding ShakerControl.ResetEnabled}"
+                            Style="{StaticResource PowerAmplifierButtonStyle}"
+                            ToolTip="报警复位" />
                     </StackPanel>
                 </UniformGrid>
             </Grid>

+ 0 - 6
ShakerControl/ViewModel/PowerAmplifierViewModel.cs

@@ -46,22 +46,16 @@ namespace ShakerControl.ViewModel
         public void StartControl()
         {
             Parent.PublishLog("启动功放");
-            //_control.WriteBit(Model.StartAddress, Model.StartBitIndex, false);
-            //await Task.Delay(SLEEP_TIME);
             _control.WriteBit(Model.StartAddress, Model.StartBitIndex, true);
         }
         public void StopControl()
         {
             Parent.PublishLog("停止功放");
-            //_control.WriteBit(Model.StopAddress, Model.StopBitIndex, false);
-            //await Task.Delay(SLEEP_TIME);
             _control.WriteBit(Model.StopAddress, Model.StopBitIndex, true);
         }
         public void ResetControl()
         {
             Parent.PublishLog("复位报警");
-            //_control.WriteBit(Model.ResetAddress, Model.ResetBitIndex, false);
-            //await Task.Delay(SLEEP_TIME);
             _control.WriteBit(Model.ResetAddress, Model.ResetBitIndex, true);
         }
         public void GainSwitchControl(ExCommandParameter parameter)

+ 100 - 11
ShakerControl/ViewModel/ShakerControlViewModel.cs

@@ -127,7 +127,7 @@ namespace ShakerControl.ViewModel
                                         Success = false,
                                     });
                                 }
-                                if (!PowerAmplifier.GainSwitch)
+                                if (!GainEnabled)
                                 {
                                     SystemLog.Default.WriteLog("增益开关未打开", LogType.Message);
                                     return (new Result()
@@ -189,14 +189,25 @@ namespace ShakerControl.ViewModel
                     switch(control.Cmd)
                     {
                         case SysCmd.Start:
+                            if (!StartEnabled) return;
                             PowerAmplifier?.StartCommand?.Execute(null);
                             break;
                         case SysCmd.Stop:
+                            if (!StopEnabled) return;
                             PowerAmplifier?.StopCommand?.Execute(null);
                             break;
                         case SysCmd.Reset:
+                            if (!ResetEnabled) return;
                             PowerAmplifier?.ResetCommand?.Execute(null);
                             break;
+                        case SysCmd.CloseGain:
+                            if (!GainSwitchEnabled || PowerAmplifier ==null) return;
+                            PowerAmplifier.GainSwitch = false;
+                            break;
+                        case SysCmd.OpenGain:
+                            if (!GainSwitchEnabled || PowerAmplifier ==null) return;
+                            PowerAmplifier.GainSwitch = true;
+                            break;
                     }
                 });
 
@@ -290,6 +301,13 @@ namespace ShakerControl.ViewModel
             ShakerDigitalGroup = new ShakerDigitalGroupViewModel(this);
             ShakerDigitalGroup.UpDateModel(model.DigitalGroup);
             PowerAmplifier = new PowerAmplifierViewModel(this);
+            PowerAmplifier.PropertyChanged += (sender, args) =>
+            {
+                if (args.PropertyName == nameof(PowerAmplifierViewModel.GainSwitch))
+                {
+                    OnPropertyChanged(nameof(GainEnabled));
+                }
+            };
             ShakerDigitalGroup1 = new ShakerDigitalGroupViewModel(this);
             ShakerDigitalGroup1.UpDateModel(model.DigitalGroup1);
             DataManger = new DataMangerViewModel(AnalogNames,Units);
@@ -348,27 +366,79 @@ namespace ShakerControl.ViewModel
                         switch (gain.Cmd)
                         {
                             case SysCmd.Start:
-                                PowerAmplifier.StartCommand?.Execute(null);
+                                if (StartEnabled)
+                                {
+                                    PowerAmplifier.StartCommand?.Execute(null);
+                                }
+                                else
+                                {
+                                    SystemLog.Default.WriteLog("当前状态无法启动功放", LogType.Message);
+                                    return (new Result()
+                                    {
+                                        Message = "当前状态无法启动功放",
+                                        Success = false,
+                                    });
+                                }
                                 break;
                             case SysCmd.Stop:
-                                PowerAmplifier.StopCommand?.Execute(null);
+                                if (StopEnabled)
+                                {
+                                    PowerAmplifier.StopCommand?.Execute(null);
+                                }
+                                else
+                                {
+                                    SystemLog.Default.WriteLog("当前状态无法停止功放", LogType.Message);
+                                    return (new Result()
+                                    {
+                                        Message = "当前状态无法停止功放",
+                                        Success = false,
+                                    });
+                                }
                                 break;
                             case SysCmd.Reset:
-                                PowerAmplifier.ResetCommand?.Execute(null);
+                                if (ResetEnabled)
+                                {
+                                    PowerAmplifier.ResetCommand?.Execute(null);
+                                }
+                                else
+                                {
+                                    SystemLog.Default.WriteLog("当前状态无法复位功放", LogType.Message);
+                                    return (new Result()
+                                    {
+                                        Message = "当前状态无法复位功放",
+                                        Success = false,
+                                    });
+                                }
                                 break;
                             case SysCmd.CloseGain:
-                                PowerAmplifier?.GainSwitchControl(false);
+                                if (GainSwitchEnabled)
+                                {
+                                    PowerAmplifier?.GainSwitchControl(false);
+                                }
+                                else
+                                {
+                                    SystemLog.Default.WriteLog("当前状态无法关闭增益输出", LogType.Message);
+                                    return (new Result()
+                                    {
+                                        Message = "当前状态无法关闭增益输出",
+                                        Success = false,
+                                    });
+                                }
                                 break;
                             case SysCmd.OpenGain:
-                                if (OperatingStatus != OperatingStatus.Run)
+                                if (GainSwitchEnabled)
                                 {
-                                    return new Result()
+                                    PowerAmplifier?.GainSwitchControl(true);
+                                }
+                                else
+                                {
+                                    SystemLog.Default.WriteLog("当前状态无法打开增益输出", LogType.Message);
+                                    return (new Result()
                                     {
+                                        Message = "当前状态无法打开增益输出",
                                         Success = false,
-                                        Message = "当前振动台不在运行状态",
-                                    };
+                                    });
                                 }
-                                PowerAmplifier?.GainSwitchControl(true);
                                 break;
                             case SysCmd.ApplicationControl:
                                 {
@@ -486,11 +556,30 @@ namespace ShakerControl.ViewModel
                 });
             }
         }
+
+        public bool ResetEnabled => OperatingStatus != OperatingStatus.Run;
+        public bool StartEnabled => OperatingStatus == OperatingStatus.Wait;
+        public bool StopEnabled => OperatingStatus == OperatingStatus.Run;
+        public bool GainSwitchEnabled => OperatingStatus == OperatingStatus.Run;
+        public bool GainEnabled => (PowerAmplifier?.GainSwitch ?? false)&& OperatingStatus == OperatingStatus.Run;
         public string[] AnalogNames { get; } = new string[12];
         public string[] Units { get; } = new string[12];
         public OperatingStatus OperatingStatus
         {
-            get => (OperatingStatus)Model.OperatingStatus.Value; private set => UpdateProperty(ref Model.OperatingStatus.Value, (short)value);
+            get => (OperatingStatus)Model.OperatingStatus.Value;
+            private set
+            {
+                var temp = Model.OperatingStatus.Value;
+                if (temp != (short)value)
+                {
+                    UpdateProperty(ref Model.OperatingStatus.Value, (short)value);
+                    OnPropertyChanged(nameof(ResetEnabled));
+                    OnPropertyChanged(nameof(StartEnabled));
+                    OnPropertyChanged(nameof(StopEnabled));
+                    OnPropertyChanged(nameof(GainSwitchEnabled));
+                    OnPropertyChanged(nameof(GainEnabled));
+                }
+            }
         }
         public void Exit()
         {

+ 4 - 4
ShakerManger/App.xaml

@@ -236,8 +236,8 @@
             </Style>
             <Style
                 x:Key="ComboBoxStyle1"
-                TargetType="{x:Type ComboBox}"
-                BasedOn="{StaticResource InputElementBaseStyle}">
+                BasedOn="{StaticResource InputElementBaseStyle}"
+                TargetType="{x:Type ComboBox}">
                 <Setter Property="ItemContainerStyle" Value="{StaticResource ComboBoxItemBaseStyle1}" />
                 <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
                 <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
@@ -310,8 +310,8 @@
 
             <Style
                 x:Key="ImageButton"
-                TargetType="Button"
-                BasedOn="{StaticResource ButtonIcon}">
+                BasedOn="{StaticResource ButtonIcon}"
+                TargetType="Button">
                 <Setter Property="Template">
                     <Setter.Value>
                         <ControlTemplate TargetType="Button">

+ 6 - 0
ShakerManger/ShakerManger.csproj.user

@@ -19,6 +19,9 @@
     <Compile Update="View\SetPlotConfigView.xaml.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Update="View\ShakerInfoView.xaml.cs">
+      <SubType>Code</SubType>
+    </Compile>
     <Compile Update="View\ShakerPageView.xaml.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -60,6 +63,9 @@
     <Page Update="View\ResetPassWordView.xaml">
       <SubType>Designer</SubType>
     </Page>
+    <Page Update="View\ShakerInfoView.xaml">
+      <SubType>Designer</SubType>
+    </Page>
     <Page Update="View\ShakerPageView.xaml">
       <SubType>Designer</SubType>
     </Page>

+ 289 - 0
ShakerManger/View/ShakerInfoView.xaml

@@ -0,0 +1,289 @@
+<UserControl
+    x:Class="ShakerManger.View.ShakerInfoView"
+    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:hc="https://handyorg.github.io/handycontrol"
+    xmlns:local="clr-namespace:ShakerManger.View"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:vm="clr-namespace:ShakerManger.ViewModel"
+    d:DataContext="{d:DesignInstance {x:Type vm:ShakerControlViewModel}}"
+    d:DesignHeight="450"
+    d:DesignWidth="800"
+    mc:Ignorable="d">
+    <Viewbox Margin="4" Stretch="Fill">
+        <Grid Width="960" Height="460">
+            <Grid.RowDefinitions>
+                <RowDefinition Height="0.4*" />
+                <RowDefinition Height="0.6*" />
+                <RowDefinition Height="Auto" />
+            </Grid.RowDefinitions>
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition />
+                <ColumnDefinition />
+            </Grid.ColumnDefinitions>
+            <GroupBox
+                Grid.Row="0"
+                Grid.Column="0"
+                hc:TitleElement.Background="Transparent"
+                hc:TitleElement.Foreground="White"
+                hc:TitleElement.MinHeight="42"
+                Background="Transparent"
+                BorderBrush="Gray"
+                BorderThickness="1"
+                FontSize="22"
+                FontWeight="Bold"
+                Foreground="{StaticResource TitleBrush}"
+                Header="输出"
+                Style="{StaticResource GroupBoxTab}">
+                <Grid>
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition />
+                        <ColumnDefinition />
+                    </Grid.ColumnDefinitions>
+                    <StackPanel
+                        Grid.Column="0"
+                        VerticalAlignment="Center"
+                        Orientation="Vertical">
+                        <StackPanel
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            Orientation="Horizontal">
+                            <Viewbox
+                                Width="20"
+                                Height="20"
+                                Stretch="Fill">
+                                <Path
+                                    Data="{StaticResource CurrentGeometry}"
+                                    Fill="Green"
+                                    Stretch="Fill" />
+                            </Viewbox>
+                            <TextBlock
+                                HorizontalAlignment="Center"
+                                VerticalAlignment="Center"
+                                FontSize="16"
+                                FontWeight="Normal"
+                                Foreground="White"
+                                Text="电流(A)" />
+                        </StackPanel>
+                        <TextBlock
+                            Margin="4,0,0,0"
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            FontSize="48"
+                            Foreground="Green"
+                            Text="{Binding CurrentData.OutputCurrent, StringFormat={}{0:0000}}" />
+                    </StackPanel>
+                    <Line
+                        HorizontalAlignment="Right"
+                        VerticalAlignment="Center"
+                        Stroke="Gray"
+                        StrokeThickness="1"
+                        X1="0"
+                        X2="0"
+                        Y1="0"
+                        Y2="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Grid}, Path=ActualHeight}" />
+                    <StackPanel
+                        Grid.Column="1"
+                        VerticalAlignment="Center"
+                        Orientation="Vertical">
+
+                        <StackPanel
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            Orientation="Horizontal">
+                            <Viewbox
+                                Width="20"
+                                Height="20"
+                                Stretch="Fill">
+                                <Path
+                                    Data="{StaticResource VoltageGeometry}"
+                                    Fill="Green"
+                                    Stretch="Fill" />
+                            </Viewbox>
+                            <TextBlock
+                                Margin="4,0,0,0"
+                                HorizontalAlignment="Center"
+                                VerticalAlignment="Center"
+                                FontSize="16"
+                                FontWeight="Normal"
+                                Foreground="White"
+                                Text="电压(V)" />
+                        </StackPanel>
+                        <TextBlock
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            FontSize="48"
+                            Foreground="Green"
+                            Text="{Binding CurrentData.OutputVoltage, StringFormat={}{0:0000}}" />
+                    </StackPanel>
+                </Grid>
+            </GroupBox>
+
+            <GroupBox
+                Grid.Row="1"
+                Grid.Column="0"
+                Margin="0,4,0,0"
+                hc:TitleElement.Background="Transparent"
+                hc:TitleElement.Foreground="White"
+                hc:TitleElement.MinHeight="42"
+                Background="Transparent"
+                BorderBrush="Gray"
+                BorderThickness="1"
+                FontSize="22"
+                FontWeight="Black"
+                Foreground="{StaticResource TitleBrush}"
+                Header="系统"
+                Style="{StaticResource GroupBoxTab}">
+                <Grid Margin="4,0,0,0" TextBlock.FontWeight="Normal">
+                    <Grid.RowDefinitions>
+                        <RowDefinition />
+                        <RowDefinition />
+                        <RowDefinition />
+                        <RowDefinition />
+                    </Grid.RowDefinitions>
+                    <StackPanel
+                        Grid.Row="0"
+                        VerticalAlignment="Center"
+                        Orientation="Horizontal">
+                        <TextBlock
+                            Width="120"
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            FontSize="16"
+                            Foreground="White"
+                            Text="励磁电流(A)" />
+                        <TextBlock
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            FontSize="16"
+                            Foreground="White"
+                            Text="{Binding CurrentData.ExcitationCurrent, StringFormat={}{0:000}}" />
+                    </StackPanel>
+                    <StackPanel
+                        Grid.Row="1"
+                        VerticalAlignment="Center"
+                        Orientation="Horizontal">
+                        <TextBlock
+                            Width="120"
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            FontSize="16"
+                            Foreground="White"
+                            Text="直流电压(V)" />
+                        <TextBlock
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            FontSize="16"
+                            Foreground="White"
+                            Text="{Binding CurrentData.DCVoltage1, StringFormat={}{0:000}}" />
+                        <TextBlock
+                            Margin="20,0,0,0"
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            FontSize="16"
+                            Foreground="White"
+                            Text="{Binding CurrentData.DCVoltage2, StringFormat={}{0:000}}" />
+                        <TextBlock
+                            Margin="20,0,0,0"
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            FontSize="16"
+                            Foreground="White"
+                            Text="{Binding CurrentData.DCVoltage3, StringFormat={}{0:000}}" />
+                        <TextBlock
+                            Margin="20,0,0,0"
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            FontSize="16"
+                            Foreground="White"
+                            Text="{Binding CurrentData.DCVoltage4, StringFormat={}{0:000}}" />
+                    </StackPanel>
+                    <StackPanel
+                        Grid.Row="2"
+                        VerticalAlignment="Center"
+                        Orientation="Horizontal">
+                        <TextBlock
+                            Width="120"
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            FontSize="16"
+                            Foreground="White"
+                            Text="温度(℃)" />
+                        <TextBlock
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            FontSize="16"
+                            Foreground="White"
+                            Text="{Binding CurrentData.AbutmentTemperature0, StringFormat={}{0:000}}" />
+                        <TextBlock
+                            Margin="20,0,0,0"
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            FontSize="16"
+                            Foreground="White"
+                            Text="{Binding CurrentData.AbutmentTemperature1, StringFormat={}{0:000}}" />
+                    </StackPanel>
+                    <StackPanel
+                        Grid.Row="3"
+                        VerticalAlignment="Center"
+                        Orientation="Horizontal">
+                        <TextBlock
+                            Width="120"
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            FontSize="16"
+                            Foreground="White"
+                            Text="三相电压(V)" />
+                        <TextBlock
+                            HorizontalAlignment="Center"
+                            VerticalAlignment="Center"
+                            FontSize="16"
+                            Foreground="White"
+                            Text="{Binding CurrentData.ThreePhaseVoltage, StringFormat={}{0:000}}" />
+                    </StackPanel>
+                </Grid>
+            </GroupBox>
+
+            <GroupBox
+                Grid.Row="0"
+                Margin="4,0,0,0"
+                Grid.Column="1"
+                Grid.RowSpan="2"
+                hc:TitleElement.Background="Transparent"
+                hc:TitleElement.Foreground="White"
+                hc:TitleElement.MinHeight="42"
+                Background="Transparent"
+                BorderBrush="Gray"
+                BorderThickness="1"
+                FontSize="22"
+                FontWeight="Black"
+                Foreground="{StaticResource TitleBrush}"
+                Header="系统"
+                Style="{StaticResource GroupBoxTab}">
+                <Grid Margin="4,0,0,0" TextBlock.FontWeight="Normal">
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="0.25*"/>
+                        <RowDefinition Height="0.25*"/>
+                        <RowDefinition Height="0.5*"/>
+                    </Grid.RowDefinitions>
+                    <hc:BulletCheckBox
+                        Width="140"
+                        Height="48"
+                        BorderBrush="Gray"
+                        CheckedText="开"
+                        IsChecked="{Binding  GainSwich}"
+                        IsEnabled="{Binding ShakerControl.GainSwitchEnabled, Mode=OneWay}"
+                        Text="关">
+                        <hc:Interaction.Triggers>
+                            <hc:EventTrigger EventName="Click">
+                                <hc:ExInvokeCommandAction Command="{Binding ShakerControl.PowerAmplifier.GainSwitchCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=hc:BulletCheckBox}, Path=IsChecked}" />
+                            </hc:EventTrigger>
+                        </hc:Interaction.Triggers>
+                    </hc:BulletCheckBox>
+                </Grid>
+            </GroupBox>
+        </Grid>
+    </Viewbox>
+
+</UserControl>

+ 28 - 0
ShakerManger/View/ShakerInfoView.xaml.cs

@@ -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 ShakerManger.View
+{
+    /// <summary>
+    /// ShakerInfoView.xaml 的交互逻辑
+    /// </summary>
+    public partial class ShakerInfoView : UserControl
+    {
+        public ShakerInfoView()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 8 - 21
ShakerManger/View/ShakerView.xaml

@@ -96,20 +96,6 @@
                             Foreground="White"
                             Text="{Binding Title}" />
                     </StackPanel>
-                    <TextBlock
-                        Grid.Column="1"
-                        Margin="10,0,0,6"
-                        VerticalAlignment="Bottom"
-                        FontSize="12"
-                        Foreground="White"
-                        Visibility="{Binding IsConnected, Converter={StaticResource Boolean2VisibilityConverter}}">
-                        <Run Text="{Binding CurrentData.Gain, Mode=OneWay, StringFormat=输出功率:{0}%}" />
-                        <Run Text="{Binding CurrentData.OutputCurrent, Mode=OneWay, StringFormat=输出电流:{0}A}" />
-                        <Run Text="{Binding CurrentData.OutputVoltage, Mode=OneWay, StringFormat=输出电压:{0}V}" />
-                        <Run Text="{Binding CurrentData.ExcitationCurrent, Mode=OneWay, StringFormat=励磁电流:{0}A}" />
-                        <Run Text="{Binding CurrentData.ExcitationCurrent, Mode=OneWay, StringFormat=励磁电压:{0}V}" />
-                        <Run Text="{Binding CurrentData.OperatingStatus, Converter={StaticResource EnumToDescription}, Mode=OneWay, StringFormat=运行状态:{0}}" />
-                    </TextBlock>
                     <Button
                         Grid.Column="2"
                         Width="{StaticResource buttonwidth}"
@@ -121,7 +107,7 @@
                         ToolTip="申请控制权限"
                         Visibility="{Binding IsRemoteControl, Converter={StaticResource Boolean2VisibilityReConverter}}">
                         <Button.Style>
-                            <Style TargetType="Button" BasedOn="{StaticResource ImageButton}">
+                            <Style BasedOn="{StaticResource ImageButton}" TargetType="Button">
                                 <Setter Property="IsEnabled">
                                     <Setter.Value>
                                         <MultiBinding Converter="{StaticResource MultiBoolConverter}">
@@ -148,7 +134,7 @@
                         ToolTip="断开连接"
                         Visibility="{Binding IsConnected, Converter={StaticResource Boolean2VisibilityConverter}}">
                         <Button.Style>
-                            <Style TargetType="Button" BasedOn="{StaticResource ImageButton}">
+                            <Style BasedOn="{StaticResource ImageButton}" TargetType="Button">
                                 <Setter Property="IsEnabled">
                                     <Setter.Value>
                                         <MultiBinding Converter="{StaticResource MultiBoolConverter}">
@@ -207,7 +193,7 @@
                         hc:IconElement.Width="{StaticResource buttonwidth}"
                         Cursor="Hand">
                         <Button.Style>
-                            <Style TargetType="Button" BasedOn="{StaticResource ImageButton}">
+                            <Style BasedOn="{StaticResource ImageButton}" TargetType="Button">
                                 <Setter Property="IsEnabled">
                                     <Setter.Value>
                                         <MultiBinding Converter="{StaticResource MultiBoolConverter}">
@@ -247,7 +233,7 @@
                         hc:IconElement.Width="{StaticResource buttonwidth}"
                         Cursor="Hand">
                         <Button.Style>
-                            <Style TargetType="Button" BasedOn="{StaticResource ImageButton}">
+                            <Style BasedOn="{StaticResource ImageButton}" TargetType="Button">
                                 <Setter Property="hc:IconElement.Geometry" Value="{StaticResource WindowMaxGeometry}" />
                                 <Setter Property="ToolTip" Value="最大化" />
                                 <Style.Triggers>
@@ -266,7 +252,8 @@
                     </Button>
                 </Grid>
             </Border>
-            <oxyplot:PlotView
+            <local:ShakerInfoView Grid.Row="1" />
+            <!--<oxyplot:PlotView
                 Grid.Row="1"
                 Background="Transparent"
                 Model="{Binding PlotModel}"
@@ -288,7 +275,7 @@
                         </oxy:TrackerControl>
                     </ControlTemplate>
                 </oxyplot:PlotView.DefaultTrackerTemplate>
-            </oxyplot:PlotView>
+            </oxyplot:PlotView>-->
             <Grid Grid.Row="1" Visibility="{Binding IsConnected, Converter={StaticResource Boolean2VisibilityReConverter}}">
                 <StackPanel
                     HorizontalAlignment="Center"
@@ -308,7 +295,7 @@
                         Content="连接功放"
                         FontSize="14">
                         <Button.Style>
-                            <Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
+                            <Style BasedOn="{StaticResource {x:Type Button}}" TargetType="Button">
                                 <Setter Property="IsEnabled">
                                     <Setter.Value>
                                         <MultiBinding Converter="{StaticResource MultiBoolConverter}">

+ 6 - 0
ShakerManger/ViewModel/ShakerControlViewModel.cs

@@ -4,6 +4,8 @@ using Shaker.Model;
 using System;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
+using System.ComponentModel.DataAnnotations;
+using System.Diagnostics.CodeAnalysis;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -102,6 +104,7 @@ namespace ShakerManger.ViewModel
         public ShakerControlViewModel(Shaker.Model.ShakerControlModel model)
         {
             Model = model;
+            CurrentData = new DataMangerItemViewModel(new DataMangerItemModel());
             Properties[Shaker.Model.GlobalVariable.ShakerIDKey] = model.Id;
             AnalogNames[0] = Model.OperatingStatus.Name;
             AnalogNames[1] = Model.OutputCurrent.Name;
@@ -369,6 +372,8 @@ namespace ShakerManger.ViewModel
                 PromptViewModel.Default.IsOpen = true;
             }
         }
+        public bool GainSwitchEnabled => CurrentData?.OperatingStatus == OperatingStatus.Run;
+        public bool GainEnabled=>CurrentData?.OperatingStatus == OperatingStatus.Run && CurrentData?.
         private async void Start()
         {
             GetEvent<Shaker.Model.LogModel>().Publish(this, new Shaker.Model.LogModel($"振动台{Name}功放开始"));
@@ -429,6 +434,7 @@ namespace ShakerManger.ViewModel
         private short gain;
         private bool shakerControlIsOpen = false;
         private bool setPlotConfigIsOpen = false;
+        [AllowNull]
         private DataMangerItemViewModel currentData;
         private bool isConnected = false;
         private bool isRemoteControl = false;

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott