-
Notifications
You must be signed in to change notification settings - Fork 1
/
MainWindow.xaml
290 lines (268 loc) · 16.2 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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
<Window xmlns:XamlHost="clr-namespace:Microsoft.Toolkit.Wpf.UI.XamlHost;assembly=Microsoft.Toolkit.Wpf.UI.XamlHost" x:Class="PocketTDPControl.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:local="clr-namespace:PocketTDPControl" d:DataContext="{d:DesignInstance Type=local:ViewModel}"
mc:Ignorable="d"
Title="Pocket TDP Control"
MouseDown="Window_MouseDown" Closing="Window_Closing"
BorderThickness="1" AllowsTransparency="False"
WindowStyle="None" ResizeMode="NoResize"
WindowStartupLocation="CenterScreen" Height="420" Width="600">
<Window.Resources>
<Style TargetType="{x:Type Button}" x:Key="SudokuButton">
<Setter Property="BorderBrush" Value="LightGray"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="FontSize" Value="24"/>
<Setter Property="Padding" Value="10"/>
</Style>
<Style TargetType="{x:Type Button}" x:Key="MenuButton">
<Setter Property="FontSize" Value="10"/>
<Setter Property="Margin" Value="0"/>
<Setter Property="Padding" Value="0"/>
</Style>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="16"/>
</Style>
<Style TargetType="{x:Type Slider}">
<Setter Property="IsDirectionReversed" Value="True"/>
<Setter Property="Orientation" Value="Vertical"/>
<Setter Property="TickPlacement" Value="Both"/>
<Setter Property="TickFrequency" Value="1"/>
<Setter Property="Height" Value="Auto"/>
<Setter Property="Margin" Value="5,0,5,0"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Stretch"/>
</Style>
<Style TargetType="{x:Type RadioButton}">
<Setter Property="Margin" Value="5"/>
<Setter Property="FontSize" Value="12"/>
</Style>
<Style TargetType="{x:Type GroupBox}">
<Setter Property="Margin" Value="5"/>
<Setter Property="Width" Value="Auto"/>
<Setter Property="Height" Value="Auto"/>
<Setter Property="FontSize" Value="10"/>
<Setter Property="VerticalAlignment" Value="Stretch"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
</Style>
<Style TargetType="{x:Type StackPanel}">
<Setter Property="Margin" Value="0"/>
<Setter Property="Width" Value="Auto"/>
<Setter Property="Height" Value="Auto"/>
<Setter Property="VerticalAlignment" Value="Stretch"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
</Style>
<local:EstimatedRunTimeConverter x:Key="EstimatedRunTimeConverter" />
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="20">
</RowDefinition>
<RowDefinition>
</RowDefinition>
<RowDefinition Height="80">
</RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition>
</ColumnDefinition>
<ColumnDefinition>
</ColumnDefinition>
<ColumnDefinition>
</ColumnDefinition>
</Grid.ColumnDefinitions>
<Button Content="Pocket TDP Control" Grid.Column="0" Grid.Row="0" Style="{StaticResource MenuButton}" FontWeight="ExtraBold"
Click="GlobalSettingButton_Click" />
<Button Content="Minimize" Grid.Column="1" Grid.Row="0" Style="{StaticResource MenuButton}"
Click="MinimizeButton_Click" />
<Button Content="Close" Grid.Column="2" Grid.Row="0" Style="{StaticResource MenuButton}"
Click="CloseButton_Click" />
<StackPanel Grid.Column="0" Grid.Row="1" Orientation="Vertical">
<GroupBox Header="Machine">
<StackPanel HorizontalAlignment="Stretch">
<TextBlock Text="{Binding MachineName}" d:Text="ThinkPad" TextWrapping="Wrap" HorizontalAlignment="Center" Margin="5" />
<Button Content="Setting" HorizontalAlignment="Stretch" Click="MachineSettingButton_Click" IsEnabled="{Binding IsSupportedMachine}" />
</StackPanel>
</GroupBox>
<GroupBox Header="CPU" HorizontalContentAlignment="Stretch">
<StackPanel HorizontalAlignment="Left">
<TextBlock Text="{Binding CpuName}" d:Text="INTEL Core i9 13900K" FontSize="10" TextWrapping="Wrap" />
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<GroupBox Header="Temp" Margin="0">
<TextBlock Text="{Binding CpuTemperture}" d:Text="100" />
</GroupBox>
<GroupBox Header="Clock" Margin="0">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding CpuClock}" d:Text="9999" />
<Button Margin="3" Content="*" Height="12" Width="12" IsEnabled="False" />
</StackPanel>
</GroupBox>
<GroupBox Header="TDP" Margin="0">
<TextBlock Text="{Binding ReadingCpuTDP}" d:Text="99" />
</GroupBox>
</StackPanel>
</StackPanel>
</GroupBox>
<GroupBox Header="GPU" HorizontalContentAlignment="Stretch">
<StackPanel HorizontalAlignment="Left">
<TextBlock Text="{Binding GpuName}" d:Text="NVIDIA GeForce RTX4090" FontSize="10" TextWrapping="Wrap" />
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<GroupBox Header="Temp" Margin="0">
<TextBlock Text="{Binding GpuTemperture}" d:Text="100" />
</GroupBox>
<GroupBox Header="Clock" Margin="0">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding GpuClock}" d:Text="9999" />
<Button Margin="3" Content="*" Height="12" Width="12" IsEnabled="False" />
</StackPanel>
</GroupBox>
<GroupBox Header="TDP" Margin="0">
<TextBlock Text="{Binding ReadingGpuTDP}" d:Text="99" />
</GroupBox>
</StackPanel>
</StackPanel>
</GroupBox>
<GroupBox Header="Battery">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<ProgressBar Value="{Binding EstimatedChargeRemaining}" Height="15" Width="125" Margin="5,0,5,0" d:Value="50" />
<TextBlock Text="{Binding EstimatedRunTime, Converter={StaticResource EstimatedRunTimeConverter}}" d:Text="999" Margin="5,0,0,0" />
</StackPanel>
</GroupBox>
</StackPanel>
<StackPanel Grid.Column="1" Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center">
<GroupBox Header="SLOW" Margin="5">
<StackPanel>
<Slider Minimum="{Binding MinTDP}" Maximum="{Binding MaxTDP}" Height="260"
Value="{Binding ApplyTDP, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" d:Value="15" />
<TextBlock Text="{Binding ApplyTDP}" d:Text="15" HorizontalAlignment="Center" Margin="5" />
</StackPanel>
</GroupBox>
<GroupBox Header="FAST" Margin="5">
<StackPanel>
<Slider Minimum="{Binding MinTDP}" Maximum="{Binding MaxTDP}" Height="260"
Value="{Binding ApplyTDP, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" d:Value="15" />
<TextBlock Text="{Binding ApplyTDP}" d:Text="15" HorizontalAlignment="Center" Margin="5" />
</StackPanel>
</GroupBox>
<GroupBox Header="STAPM" Margin="5">
<StackPanel>
<Slider Minimum="{Binding MinTDP}" Maximum="{Binding MaxTDP}" Height="260"
Value="{Binding ApplyTDP, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" d:Value="15" />
<TextBlock Text="{Binding ApplyTDP}" d:Text="15" HorizontalAlignment="Center" Margin="5" />
</StackPanel>
</GroupBox>
</StackPanel>
<GroupBox Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2" Margin="5" Header="Fan Speed Adjust" IsEnabled="{Binding IsSupportedMachine}">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<GroupBox FontSize="8" Header="RPM" Margin="0" Padding="0">
<TextBlock Text="{Binding FanSpeed}" d:Text="6000" FontSize="20" />
</GroupBox>
<GroupBox FontSize="8" Header="Precentage" Margin="0" Padding="0">
<TextBlock Text="{Binding FanSpeedPrecentage}" d:Text="100" FontSize="20" />
</GroupBox>
<Slider Interval="10" Maximum="100" Minimum="10" TickFrequency="10" TickPlacement="Both" Orientation="Horizontal"
Margin="5,12,0,0" Padding="0" FlowDirection="RightToLeft" IsEnabled="{Binding IsFanSpeedManualControlEnabled}"
Value="{Binding ApplyFanSpeedPrecentage, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Height="60" Width="160" />
<!--<XamlHost:WindowsXamlHost InitialTypeName="Windows.UI.Xaml.Controls.Slider" ChildChanged="WindowsXamlHost_ChildChanged" />-->
<CheckBox Margin="5,20,2,2" IsChecked="{Binding IsFanSpeedManualControlEnabled}"
Checked="FanSpeedControlCheckBox_Checked" Unchecked="FanSpeedControlCheckBox_Unchecked" />
<Button Height="20" Margin="5,9,5,5" Click="CurveButton_Click">
<StackPanel Orientation="Horizontal" Margin="0">
<CheckBox Margin="2,0,2,0" />
<TextBlock Margin="2,2,2,0" Text="Curve" FontSize="8" />
</StackPanel>
</Button>
</StackPanel>
</GroupBox>
<GroupBox Grid.Column="2" Grid.Row="1" >
<GroupBox.Header>
<StackPanel Orientation="Horizontal" Margin="0" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock VerticalAlignment="Center" Text=" Preset TDP Button " FontSize="10" Margin="5,4,0,0" />
<GroupBox VerticalAlignment="Center" Header="Edit Mode" Margin="0,0,0,3" Padding="0">
<StackPanel Orientation="Horizontal">
<CheckBox FontSize="8" Checked="EditModeCheckBox_Checked" Margin="5,0,5,0"
IsChecked="{Binding IsEditModeEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<Button Content="Sort" Padding="5,0,5,0" Margin="0" FontSize="8"
IsEnabled="{Binding IsEditModeEnabled}" Click="SortButton_Click" />
</StackPanel>
</GroupBox>
</StackPanel>
</GroupBox.Header>
<Grid>
<Grid.RowDefinitions>
<RowDefinition>
</RowDefinition>
<RowDefinition>
</RowDefinition>
<RowDefinition>
</RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition>
</ColumnDefinition>
<ColumnDefinition>
</ColumnDefinition>
<ColumnDefinition>
</ColumnDefinition>
</Grid.ColumnDefinitions>
<Button x:Name="SudokuButton_0" Grid.Column="0" Grid.Row="0"
Content="{Binding PresetTDP[0]}" Click="SudokuButton_Click"
BorderThickness="0,0,1,1" Style="{StaticResource SudokuButton}" />
<Button x:Name="SudokuButton_1" Grid.Column="0" Grid.Row="1"
Content="{Binding PresetTDP[1]}" Click="SudokuButton_Click"
BorderThickness="0,0,1,1" Style="{StaticResource SudokuButton}" />
<Button x:Name="SudokuButton_2" Grid.Column="0" Grid.Row="2"
Content="{Binding PresetTDP[2]}" Click="SudokuButton_Click"
BorderThickness="0,0,1,0" Style="{StaticResource SudokuButton}" />
<Button x:Name="SudokuButton_3" Grid.Column="1" Grid.Row="0"
Content="{Binding PresetTDP[3]}" Click="SudokuButton_Click"
BorderThickness="0,0,1,1" Style="{StaticResource SudokuButton}" />
<Button x:Name="SudokuButton_4" Grid.Column="1" Grid.Row="1"
Content="{Binding PresetTDP[4]}" Click="SudokuButton_Click"
BorderThickness="0,0,1,1" Style="{StaticResource SudokuButton}" />
<Button x:Name="SudokuButton_5" Grid.Column="1" Grid.Row="2"
Content="{Binding PresetTDP[5]}" Click="SudokuButton_Click"
BorderThickness="0,0,1,0" Style="{StaticResource SudokuButton}" />
<Button x:Name="SudokuButton_6" Grid.Column="2" Grid.Row="0"
Content="{Binding PresetTDP[6]}" Click="SudokuButton_Click"
BorderThickness="0,0,0,1" Style="{StaticResource SudokuButton}" />
<Button x:Name="SudokuButton_7" Grid.Column="2" Grid.Row="1"
Content="{Binding PresetTDP[7]}" Click="SudokuButton_Click"
BorderThickness="0,0,0,1" Style="{StaticResource SudokuButton}" />
<Button x:Name="SudokuButton_8" Grid.Column="2" Grid.Row="2"
Content="{Binding PresetTDP[8]}" Click="SudokuButton_Click"
BorderThickness="0,0,0,0" Style="{StaticResource SudokuButton}" />
</Grid>
</GroupBox>
<GroupBox Grid.Column="2" Grid.Row="2">
<GroupBox.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Target FPS Mode" FontSize="10" Margin="0,1,5,0" />
<CheckBox Checked="TargetFPSModeCheckBox_Checked" Unchecked="TargetFPSModeCheckBox_Unchecked"
IsChecked="{Binding IsTargetFPSModelEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
</StackPanel>
</GroupBox.Header>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition>
</ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<RadioButton Grid.Row="0" Grid.Column="0" Content="30"
IsEnabled="{Binding IsTargetFPSModelEnabled}" Checked="TargetFPSModelRadioButton_Checked" />
<RadioButton Grid.Row="0" Grid.Column="1" Content="45"
IsEnabled="{Binding IsTargetFPSModelEnabled}" Checked="TargetFPSModelRadioButton_Checked" />
<RadioButton Grid.Row="1" Grid.Column="0" Content="60"
IsEnabled="{Binding IsTargetFPSModelEnabled}" Checked="TargetFPSModelRadioButton_Checked" />
<RadioButton Grid.Row="1" Grid.Column="1" Content="∞"
IsEnabled="{Binding IsTargetFPSModelEnabled}" Checked="TargetFPSModelRadioButton_Checked" />
</Grid>
</GroupBox>
</Grid>
</Window>