-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMainWindow.xaml
197 lines (191 loc) · 14.1 KB
/
MainWindow.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<Window x:Class="KeithleyControl.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:models="clr-namespace:KeithleyControl.Models"
xmlns:local="clr-namespace:KeithleyControl"
xmlns:tbex="clr-namespace:TextBoxEx"
xmlns:btnex="clr-namespace:ButtonEx"
xmlns:tb="clr-namespace:ToggleButton"
xmlns:oxy="http://oxyplot.org/wpf"
mc:Ignorable="d"
Title="Keithley Power Supply Control" Height="800" Width="1000">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="250"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" Background="#f8f9fc">
<Grid.RowDefinitions>
<RowDefinition Height="240"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<GroupBox Header="OUTPUT1" Grid.Row="0" Margin="5,0,5,0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Background="#323743" Margin="5,5,5,5" Grid.Row="0">
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<TextBlock Foreground="LightGreen" Text="V :" FontWeight="Bold" FontSize="20" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,5,0,0"></TextBlock>
<TextBlock Foreground="LightGreen" Text="{Binding PowerSupplyModel.VoltageVal}" FontWeight="Bold" FontSize="20" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,5,65,0"></TextBlock>
<TextBlock Foreground="LightGreen" Text="V" FontWeight="Bold" FontSize="25" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,5,10,0"></TextBlock>
</Grid>
<Grid Grid.Row="1">
<TextBlock Foreground="#00ffff" Text="I :" FontWeight="Bold" FontSize="20" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="11,0,0,0"></TextBlock>
<TextBlock Foreground="#00ffff" Text="{Binding PowerSupplyModel.CurrentVal}" FontWeight="Bold" FontSize="20" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,5,65,0"></TextBlock>
<TextBlock Foreground="#00ffff" Text="mA" FontWeight="Bold" FontSize="25" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
</Grid>
<Grid Grid.Row="2" Margin="10,5,0,0" >
<Grid.RowDefinitions>
<RowDefinition Height="25"/>
<RowDefinition Height="25"/>
</Grid.RowDefinitions>
<!--<TextBlock Grid.Row="0" Foreground="LightGreen" Text="Range:" FontSize="12" HorizontalAlignment="Left"></TextBlock>
<TextBlock Grid.Row="0" Foreground="LightGreen" Text="0.000" FontSize="12" HorizontalAlignment="Left" Margin="50,0,0,0"></TextBlock>
<TextBlock Grid.Row="0" Foreground="LightGreen" Text="V" FontSize="12" HorizontalAlignment="Left" Margin="85,0,0,0"></TextBlock>-->
<TextBlock Grid.Row="0" Foreground="#00ffff" Text="V-Set:" FontSize="12" HorizontalAlignment="Left" VerticalAlignment="Top"></TextBlock>
<TextBlock Grid.Row="0" Foreground="#f8f9fc" Text="{Binding PowerSupplyModel.GetVoltageSet}" FontSize="12" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="55,0,0,0"></TextBlock>
<TextBlock Grid.Row="0" Foreground="#f8f9fc" Text="V" FontSize="12" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="95,0,0,0"></TextBlock>
<TextBlock Grid.Row="1" Foreground="#00ffff" Text="I-Limit:" FontSize="12" HorizontalAlignment="Left" VerticalAlignment="Top"></TextBlock>
<TextBlock Grid.Row="1" Foreground="#f8f9fc" Text="{Binding PowerSupplyModel.GetCurrentMax}" FontSize="12" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="55,0,0,0"></TextBlock>
<TextBlock Grid.Row="1" Foreground="#f8f9fc" Text="A" FontSize="12" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="95,0,0,0"></TextBlock>
<TextBlock Grid.RowSpan="2" Foreground="Red" Text="{Binding PowerSupplyModel.State}" FontSize="30" FontWeight="Bold" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,20,5"></TextBlock>
</Grid>
</Grid>
<Grid VerticalAlignment="Bottom" Margin="5,5,5,5" Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" >
<TextBlock Text="Voltage Set (V)" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock>
<tbex:TextBoxEx Width="75" Text="{Binding PowerSupplyModel.SetVoltageSet}" Step="0.1" Minimum="0" HorizontalAlignment="Right" />
<!--<TextBlock Text="V" HorizontalAlignment="Right" VerticalAlignment="Center"></TextBlock>-->
</Grid>
<Grid Grid.Row="1" Margin="0,5,0,0">
<TextBlock Text="Current Limit (A)" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock>
<tbex:TextBoxEx Width="75" Text="{Binding PowerSupplyModel.SetCurrentMax}" Step="0.1" Minimum="0" HorizontalAlignment="Right"/>
<!--<TextBlock Text="A" HorizontalAlignment="Right" VerticalAlignment="Center"></TextBlock>-->
</Grid>
<Grid Grid.Row="2" Margin="0,5,0,0">
<TextBlock Text="Output" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock>
<tb:ToggleButton Content="SwitchCheckBox" OnText="On" OffText="Off"
IsChecked="{Binding PowerSupplyModel.Checked}"
IsEnabled="{Binding PowerSupplyModel.Output}"
Command="{Binding PowerSetCommand}"
HorizontalAlignment="Right"
VerticalAlignment="Center" Cursor="Hand"/>
</Grid>
</Grid>
</Grid>
</GroupBox>
<GroupBox Header="CONTROL" Grid.Row="1" Margin="5,0,5,0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Margin="5,5,5,0">
<TextBlock Text="Interface" VerticalAlignment="Center" HorizontalAlignment="Left"></TextBlock>
<ComboBox x:Name="Interface" Text="{Binding PowerSupplyModel.Interface,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" SelectedItem="{Binding PowerSupplyModel.Interface}" Width="100" HorizontalAlignment="Right">
<ComboBoxItem Content="LAN"></ComboBoxItem>
<ComboBoxItem Content="GPIB"></ComboBoxItem>
</ComboBox>
</Grid>
<Grid Grid.Row="1" Margin="5,5,5,0">
<TextBlock Text="IP:" VerticalAlignment="Center" HorizontalAlignment="Left" ></TextBlock>
<TextBox Text="{Binding SocketModel.IpAddr}" Height="25" Width="100" HorizontalAlignment="Right"></TextBox>
</Grid>
<Grid Grid.Row="2" Margin="5,5,5,0">
<TextBlock Text="Port:" VerticalAlignment="Center" HorizontalAlignment="Left"></TextBlock>
<tbex:TextBoxEx Width="100" Text="{Binding SocketModel.Port}" Step="1" Minimum="0" HorizontalAlignment="Right" />
</Grid>
<Grid Grid.Row="3" Margin="5,5,5,0">
<btnex:ButtonEx Content="Connect" Width="80" ButtonType="Normal" HorizontalAlignment="Left" IsEnabled="{Binding SocketModel.ConnectFlag}" Command="{Binding ConnectCommand}"/>
<btnex:ButtonEx Content="Disconnect" Width="80" ButtonType="Normal" HorizontalAlignment="Right" IsEnabled="{Binding SocketModel.DisConnectFlag}" Command="{Binding DisconnectCommand}"/>
</Grid>
<Grid Grid.Row="4" Height="25" Margin="5,5,5,0">
<!--<TextBlock Text="Command:" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="16,0,0,0"></TextBlock>
<TextBox Text="{Binding SocketModel.Command}" HorizontalAlignment="Center"></TextBox>-->
<TextBox Width="150" Text="{Binding SocketModel.Command}" HorizontalAlignment="Left" >
<TextBox.Resources>
<VisualBrush x:Key="HintText" TileMode="None" Opacity="0.5" Stretch="None" AlignmentX="Left">
<VisualBrush.Visual>
<TextBlock FontStyle="Italic" Text="Command:"/>
</VisualBrush.Visual>
</VisualBrush>
</TextBox.Resources>
<TextBox.Style>
<Style TargetType="TextBox">
<Style.Triggers>
<Trigger Property="Text" Value="{x:Null}">
<Setter Property="Background" Value="{StaticResource HintText}"/>
</Trigger>
<Trigger Property="Text" Value="">
<Setter Property="Background" Value="{StaticResource HintText}"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
<btnex:ButtonEx Content="Send" Width="50" ButtonType="Normal" HorizontalAlignment="Right" Command="{Binding CmdDebugCommand}"/>
</Grid>
<Grid Grid.Row="5" Margin="5,5,5,0">
<TextBox Width="218" Height="50" Text="{Binding SocketModel.Response}" HorizontalAlignment="Left" TextWrapping="WrapWithOverflow" >
<TextBox.Resources>
<VisualBrush x:Key="HintText" TileMode="None" Opacity="0.5" Stretch="None" AlignmentX="Left">
<VisualBrush.Visual>
<TextBlock FontStyle="Italic" Text="Response...."/>
</VisualBrush.Visual>
</VisualBrush>
</TextBox.Resources>
<TextBox.Style>
<Style TargetType="TextBox">
<Style.Triggers>
<Trigger Property="Text" Value="{x:Null}">
<Setter Property="Background" Value="{StaticResource HintText}"/>
</Trigger>
<Trigger Property="Text" Value="">
<Setter Property="Background" Value="{StaticResource HintText}"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
</Grid>
</Grid>
</GroupBox>
<Grid Grid.Row="2" VerticalAlignment="Bottom" Height="25" Background="#FFE0DCDC">
<TextBlock Text="{Binding LogInfo}" VerticalAlignment="Center" Margin="5,0,0,0"></TextBlock>
</Grid>
</Grid>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="25"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Margin="5,0,0,0">
<btnex:ButtonEx Content="Y+" Width="30" ButtonType="Normal" HorizontalAlignment="Left" Command="{Binding ZoomOutCommand}"/>
<btnex:ButtonEx Content="Y-" Width="30" ButtonType="Normal" HorizontalAlignment="Left" Command="{Binding ZoomInCommand}" Margin="35,0,0,0"/>
<btnex:ButtonEx Content="Clear" Width="35" ButtonType="Normal" HorizontalAlignment="Left" Command="{Binding ClearCommand}" Margin="70,0,0,0"/>
</Grid>
<Grid Grid.Row="1">
<oxy:PlotView Model="{Binding PlotModelData}" PanCursor="Hand" ZoomHorizontalCursor="SizeWE" ZoomRectangleCursor="SizeNWSE" ZoomVerticalCursor="SizeNS" Width="Auto"></oxy:PlotView>
</Grid>
</Grid>
</Grid>
</Window>