Skip to content

Commit 8a9dc7c

Browse files
committed
Driver restart button
1 parent 4903567 commit 8a9dc7c

2 files changed

Lines changed: 25 additions & 4 deletions

File tree

TabletDriverGUI/MainWindow.xaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
66
xmlns:local="clr-namespace:TabletDriverGUI"
77
mc:Ignorable="d"
8-
Title="TabletDriverGUI" Height="670" Width="750"
8+
Title="TabletDriverGUI" Height="703" Width="750"
99
>
1010
<Window.Resources>
1111
<Style TargetType="GroupBox">
@@ -523,6 +523,12 @@
523523
ToolTip="Saves settings to Config.xml">Save</Button>
524524
<Button Name="buttonApplySettings" Margin="5,5,0,5" Width="50" Click="ApplySettings"
525525
ToolTip="Applies driver settings.">Apply</Button>
526+
<Button Name="buttonRestartDriver" Margin="25,5,0,5" Width="90"
527+
HorizontalAlignment="Right"
528+
Click="RestartDriverClick"
529+
ToolTip="Restarts the TabletDriverService">Restart Driver</Button>
530+
531+
526532
</StackPanel>
527533
<CheckBox Name="checkRunAtStartup"
528534
HorizontalAlignment="Right" VerticalAlignment="Center" VerticalContentAlignment="Center"

TabletDriverGUI/MainWindow.xaml.cs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ private void MainWindow_Closing(object sender, System.ComponentModel.CancelEvent
222222
// Window loaded -> Start driver
223223
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
224224
{
225-
225+
226226
// Configuration filename
227227
configFilename = "config/config.xml";
228228

@@ -268,8 +268,6 @@ private void MainWindow_Loaded(object sender, RoutedEventArgs e)
268268
// Update the settings back to the configuration
269269
UpdateSettingsToConfiguration();
270270

271-
// Console timer
272-
timerConsoleUpdate.Start();
273271

274272
// Set run at startup
275273
SetRunAtStartup(config.RunAtStartup);
@@ -1687,6 +1685,10 @@ void Start()
16871685
try
16881686
{
16891687
running = true;
1688+
1689+
// Console timer
1690+
timerConsoleUpdate.Start();
1691+
16901692
driver.Start(config.DriverPath, config.DriverArguments);
16911693
if (!driver.IsRunning)
16921694
{
@@ -1715,6 +1717,18 @@ void Stop()
17151717
timerConsoleUpdate.Stop();
17161718
}
17171719

1720+
//
1721+
// Restart Driver button click
1722+
//
1723+
private void RestartDriverClick(object sender, RoutedEventArgs e)
1724+
{
1725+
if (running)
1726+
{
1727+
Stop();
1728+
}
1729+
Start();
1730+
}
1731+
17181732
#endregion
17191733

17201734

@@ -2120,6 +2134,7 @@ private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref b
21202134
return IntPtr.Zero;
21212135
}
21222136

2137+
21232138
#endregion
21242139

21252140

0 commit comments

Comments
 (0)