123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338 |
- <UserControl
- x:Class="ShakerManger.View.ShakerView"
- 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:oxy="http://oxyplot.org/wpf"
- xmlns:oxyplot="http://oxyplot.org/skiawpf"
- xmlns:system="clr-namespace:System;assembly=mscorlib"
- xmlns:vm="clr-namespace:ShakerManger.ViewModel"
- d:DataContext="{d:DesignInstance {x:Type vm:ShakerControlViewModel}}"
- d:DesignHeight="450"
- d:DesignWidth="800"
- mc:Ignorable="d">
- <UserControl.Resources>
- <SolidColorBrush x:Key="forecolor" Color="White" />
- </UserControl.Resources>
- <Border
- BorderBrush="Gray"
- BorderThickness="1"
- CornerRadius="6,6,0,0">
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="32" />
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
- <Border
- Grid.Row="0"
- Margin="-1"
- Background="BlueViolet"
- CornerRadius="6,6,0,0">
- <Grid>
- <Grid.Resources>
- <system:Double x:Key="buttonwidth">32</system:Double>
- <system:Double x:Key="buttonheight">32</system:Double>
- </Grid.Resources>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="auto" />
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="auto" />
- <ColumnDefinition Width="auto" />
- <ColumnDefinition Width="auto" />
- <ColumnDefinition Width="auto" />
- <ColumnDefinition Width="auto" />
- <ColumnDefinition Width="auto" />
- </Grid.ColumnDefinitions>
- <StackPanel Grid.Row="0" Orientation="Horizontal">
- <Viewbox Height="18" Margin="4,0,0,0">
- <Path>
- <Path.Style>
- <Style TargetType="Path">
- <Style.Triggers>
- <DataTrigger Binding="{Binding Path=IsOnline}" Value="True">
- <Setter Property="Data" Value="{StaticResource OnlineGeometry}" />
- <Setter Property="Fill" Value="Green" />
- <Setter Property="ToolTip" Value="控制终端在线" />
- </DataTrigger>
- <DataTrigger Binding="{Binding Path=IsOnline}" Value="False">
- <Setter Property="Data" Value="{StaticResource OfflineGeometry}" />
- <Setter Property="Fill" Value="Red" />
- <Setter Property="ToolTip" Value="控制终端已离线" />
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Path.Style>
- </Path>
- </Viewbox>
- <Viewbox
- Height="18"
- Margin="4,0,0,0"
- Visibility="{Binding IsOnline, Converter={StaticResource Boolean2VisibilityConverter}}">
- <Path Fill="White">
- <Path.Style>
- <Style TargetType="Path">
- <Style.Triggers>
- <DataTrigger Binding="{Binding Path=IsRemoteControl}" Value="True">
- <Setter Property="Data" Value="{StaticResource RemoteControl}" />
- <Setter Property="ToolTip" Value="远程控制" />
- </DataTrigger>
- <DataTrigger Binding="{Binding Path=IsRemoteControl}" Value="False">
- <Setter Property="Data" Value="{StaticResource LocalControl}" />
- <Setter Property="ToolTip" Value="本地控制" />
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Path.Style>
- </Path>
- </Viewbox>
- <TextBlock
- Margin="4,0,0,0"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- FontSize="16"
- 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}"
- hc:IconElement.Geometry="{StaticResource RequestPermissions}"
- hc:IconElement.Width="{StaticResource buttonwidth}"
- Command="{Binding RequestPermissionsCommand}"
- Cursor="Hand"
- RenderTransformOrigin="0.5,0.5"
- ToolTip="申请控制权限"
- Visibility="{Binding IsRemoteControl, Converter={StaticResource Boolean2VisibilityReConverter}}">
- <Button.Style>
- <Style TargetType="Button" BasedOn="{StaticResource ImageButton}">
- <Setter Property="IsEnabled">
- <Setter.Value>
- <MultiBinding Converter="{StaticResource MultiBoolConverter}">
- <Binding Path="IsOnline" />
- <Binding
- Converter="{StaticResource Boolean2BooleanReConverter}"
- Path="Data.IsAnonymous"
- Source="{StaticResource Login}" />
- </MultiBinding>
- </Setter.Value>
- </Setter>
- </Style>
- </Button.Style>
- </Button>
- <Button
- Grid.Column="3"
- Width="{StaticResource buttonwidth}"
- Margin="20,0,0,0"
- hc:IconElement.Geometry="M672 192v64h-512A96 96 0 0 0 64 352v129.6c0 52.992 43.008 96 96.32 96l511.552-1.728 0.256 64-512.128 1.728a160 160 0 0 1-160-160V352A160 160 0 0 1 160 192h512zM640 448V384h480A160 160 0 0 1 1280 544v128a160 160 0 0 1-160 160H640v-64h480a96 96 0 0 0 96-96v-128A96 96 0 0 0 1120 448H640z m128-448h64v192h-64V0zM448 832h64v192H448v-192z m-160-77.248l45.248 45.248L160 973.248l-45.248-45.248L288 754.752z m768-704l45.248 45.248L928 269.248l-45.248-45.248L1056 50.752z"
- hc:IconElement.Width="{StaticResource buttonwidth}"
- Command="{Binding DisConnectCommand}"
- Cursor="Hand"
- RenderTransformOrigin="0.5,0.5"
- ToolTip="断开连接"
- Visibility="{Binding IsConnected, Converter={StaticResource Boolean2VisibilityConverter}}">
- <Button.Style>
- <Style TargetType="Button" BasedOn="{StaticResource ImageButton}">
- <Setter Property="IsEnabled">
- <Setter.Value>
- <MultiBinding Converter="{StaticResource MultiBoolConverter}">
- <Binding Path="IsRemoteControl" />
- <Binding
- Converter="{StaticResource Boolean2BooleanReConverter}"
- Path="Data.IsAnonymous"
- Source="{StaticResource Login}" />
- </MultiBinding>
- </Setter.Value>
- </Setter>
- </Style>
- </Button.Style>
- </Button>
- <Button
- Grid.Column="4"
- Width="{StaticResource buttonwidth}"
- Margin="20,0,0,0"
- hc:IconElement.Geometry="m0,93.09092a93.09091,93.09091 0 0 1 93.09091,-93.09091l744.72728,0a93.09091,93.09091 0 0 1 93.0909,93.09091l0,558.54546a93.09091,93.09091 0 0 1 -93.0909,93.09091l-744.72728,0a93.09091,93.09091 0 0 1 -93.09091,-93.09091l0,-558.54546zm46.54546,302.54546l0,256q0,19.26982 13.63782,32.90763t32.90763,13.63782l744.72728,0q19.26981,0 32.90763,-13.63782t13.63782,-32.90763l0,-256l-115.29309,0l-102.86546,114.31563l-80.384,-223.18545l-59.67127,99.51418l-154.06545,171.19418l-76.38109,-233.33236l-76.33455,190.74327l-80.43054,-119.24945l-92.39273,0zm0,-46.54546l117.10836,0l45.14909,66.93237l91.27564,-228.16582l91.22909,278.66763l97.28,-108.07854l107.79927,-179.75855l87.22619,242.26909l64.69818,-71.86618l136.05236,0l0,-256q0,-19.26982 -13.63782,-32.90763t-32.90763,-13.63782l-744.72728,0q-19.26981,0 -32.90763,13.63782t-13.63782,32.90763l0,256z"
- hc:IconElement.Width="{StaticResource buttonwidth}"
- Cursor="Hand"
- Style="{StaticResource ImageButton}"
- Visibility="{Binding IsConnected, Converter={StaticResource Boolean2VisibilityConverter}}">
- <hc:Interaction.Triggers>
- <hc:EventTrigger EventName="Click">
- <hc:SetPropertyAction
- PropertyName="SetPlotConfigIsOpen"
- PropertyValue="True"
- TargetObject="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Button}, Path=DataContext}" />
- </hc:EventTrigger>
- </hc:Interaction.Triggers>
- </Button>
- <Button
- x:Name="shakerselct"
- Grid.Column="5"
- Width="{StaticResource buttonwidth}"
- Margin="20,0,0,0"
- hc:IconElement.Geometry="m840.336,401.168c-12.736,-12.736 -33.408,-12.736 -46.144,0l-346.176,346.176l-346.176,-346.176c-12.736,-12.736 -33.408,-12.736 -46.144,0l-46.144,46.144c-12.736,12.736 -12.736,33.408 0,46.144l415.36,415.36c12.736,12.736 33.408,12.736 46.144,0l415.36,-415.36c12.736,-12.736 12.736,-33.408 0,-46.144l-46.08,-46.144zm-415.424,116.096c12.736,12.736 33.408,12.736 46.144,0l415.36,-415.36c12.736,-12.736 12.736,-33.408 0,-46.144l-46.08,-46.208c-12.736,-12.736 -33.408,-12.736 -46.144,0l-346.176,346.176l-346.176,-346.176c-12.736,-12.736 -33.408,-12.736 -46.144,0l-46.144,46.144c-12.736,12.736 -12.736,33.408 0,46.144l415.36,415.424z"
- hc:IconElement.Width="{StaticResource buttonwidth}"
- Cursor="Hand"
- RenderTransformOrigin="0.5,0.5"
- Style="{StaticResource ImageButton}">
- <hc:Interaction.Triggers>
- <hc:EventTrigger EventName="Click">
- <hc:ExInvokeCommandAction Command="{Binding Source={StaticResource MainViewModel}, Path=Data.Shakers.SelectShakerCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Button}, Path=DataContext}" />
- </hc:EventTrigger>
- </hc:Interaction.Triggers>
- </Button>
- <Button
- x:Name="control"
- Grid.Column="6"
- Width="{StaticResource buttonwidth}"
- Margin="20,0,0,0"
- hc:IconElement.Geometry="m512,469.33333l0,-42.66666l170.66667,0l0,42.66666l85.33333,0l0,42.66667l-85.33333,0l0,42.66667l-170.66667,0l0,-42.66667l-512,0l0,-42.66667l512,0zm-213.33333,-213.33333l0,-42.66667l170.66666,0l0,42.66667l298.66667,0l0,42.66667l-298.66667,0l0,42.66666l-170.66666,0l0,-42.66666l-298.66667,0l0,-42.66667l298.66667,0zm-213.33334,-213.33333l0,-42.66667l170.66667,0l0,42.66667l512,0l0,42.66666l-512,0l0,42.66667l-170.66667,0l0,-42.66667l-85.33333,0l0,-42.66666l85.33333,0zm128,0l-85.33333,0l0,42.66666l85.33333,0l0,-42.66666zm213.33334,213.33333l-85.33334,0l0,42.66667l85.33334,0l0,-42.66667zm213.33333,213.33333l-85.33333,0l0,42.66667l85.33333,0l0,-42.66667z"
- hc:IconElement.Width="{StaticResource buttonwidth}"
- Cursor="Hand">
- <Button.Style>
- <Style TargetType="Button" BasedOn="{StaticResource ImageButton}">
- <Setter Property="IsEnabled">
- <Setter.Value>
- <MultiBinding Converter="{StaticResource MultiBoolConverter}">
- <Binding Path="IsConnected" />
- <Binding Path="IsRemoteControl" />
- <Binding
- Converter="{StaticResource Boolean2BooleanReConverter}"
- Path="Data.IsAnonymous"
- Source="{StaticResource Login}" />
- </MultiBinding>
- </Setter.Value>
- </Setter>
- </Style>
- </Button.Style>
- <hc:Interaction.Triggers>
- <hc:EventTrigger EventName="Click">
- <hc:SetPropertyAction
- PropertyName="ShakerControlIsOpen"
- PropertyValue="{x:Static system:Boolean.TrueString}"
- TargetObject="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Button}, Path=DataContext}" />
- </hc:EventTrigger>
- </hc:Interaction.Triggers>
- </Button>
- <Popup
- AllowsTransparency="True"
- IsOpen="{Binding ShakerControlIsOpen}"
- Placement="Bottom"
- PlacementTarget="{Binding ElementName=control}"
- PopupAnimation="Slide"
- StaysOpen="False">
- <local:ShakerControlView />
- </Popup>
- <Button
- Grid.Column="7"
- Width="{StaticResource buttonwidth}"
- Margin="20,0,20,0"
- hc:IconElement.Width="{StaticResource buttonwidth}"
- Cursor="Hand">
- <Button.Style>
- <Style TargetType="Button" BasedOn="{StaticResource ImageButton}">
- <Setter Property="hc:IconElement.Geometry" Value="{StaticResource WindowMaxGeometry}" />
- <Setter Property="ToolTip" Value="最大化" />
- <Style.Triggers>
- <DataTrigger Binding="{Binding Path=IsMax}" Value="True">
- <Setter Property="hc:IconElement.Geometry" Value="{StaticResource WindowRestoreGeometry}" />
- <Setter Property="ToolTip" Value="还原" />
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Button.Style>
- <hc:Interaction.Triggers>
- <hc:EventTrigger EventName="Click">
- <hc:ExInvokeCommandAction Command="{Binding Source={StaticResource MainViewModel}, Path=Data.Shakers.MaxOrMinCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Button}, Path=DataContext}" />
- </hc:EventTrigger>
- </hc:Interaction.Triggers>
- </Button>
- </Grid>
- </Border>
- <oxyplot:PlotView
- Grid.Row="1"
- Background="Transparent"
- Model="{Binding PlotModel}"
- Visibility="{Binding IsConnected, Converter={StaticResource Boolean2VisibilityConverter}}">
- <oxyplot:PlotView.DefaultTrackerTemplate>
- <ControlTemplate>
- <oxy:TrackerControl
- Background="#6F999999"
- BorderBrush="Gray"
- BorderEdgeMode="Unspecified"
- BorderThickness="1"
- CornerRadius="6"
- LineStroke="White"
- Position="{Binding Position}"
- ShowPointer="False">
- <oxy:TrackerControl.Content>
- <TextBlock Margin="6" Text="{Binding}" />
- </oxy:TrackerControl.Content>
- </oxy:TrackerControl>
- </ControlTemplate>
- </oxyplot:PlotView.DefaultTrackerTemplate>
- </oxyplot:PlotView>
- <Grid Grid.Row="1" Visibility="{Binding IsConnected, Converter={StaticResource Boolean2VisibilityReConverter}}">
- <StackPanel
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Orientation="Vertical">
- <TextBlock
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- FontSize="22"
- Foreground="Red"
- Text="当前控制台未上线" />
- <Button
- Width="126"
- Height="46"
- Margin="0,10,0,0"
- Command="{Binding ConnectCommand}"
- Content="连接功放"
- FontSize="14">
- <Button.Style>
- <Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
- <Setter Property="IsEnabled">
- <Setter.Value>
- <MultiBinding Converter="{StaticResource MultiBoolConverter}">
- <Binding Path="IsOnline" />
- <Binding
- Converter="{StaticResource Boolean2BooleanReConverter}"
- Path="Data.IsAnonymous"
- Source="{StaticResource Login}" />
- </MultiBinding>
- </Setter.Value>
- </Setter>
- </Style>
- </Button.Style>
- </Button>
- </StackPanel>
- </Grid>
- <Popup
- AllowsTransparency="True"
- IsOpen="{Binding SetPlotConfigIsOpen}"
- Placement="Center"
- PopupAnimation="Scroll"
- StaysOpen="True">
- <local:SetPlotConfigView />
- </Popup>
- </Grid>
- </Border>
- </UserControl>
|