Skip to content

Commit 67ad92e

Browse files
committed
* Added confirmation messages when saving or resetting settings
1 parent e725530 commit 67ad92e

3 files changed

Lines changed: 27 additions & 17 deletions

File tree

Advanced PortChecker/Classes/PortChecker.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,6 @@ private static bool IsUdpOpen(string address, int port, int timeout)
162162
udpClient.Client.ReceiveTimeout = timeout;
163163
udpClient.Client.SendTimeout = timeout;
164164

165-
166-
167165
udpClient.Connect(address, port);
168166
return true;
169167
}

Advanced PortChecker/Windows/SettingsWindow.xaml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,35 @@
1919
</Grid.RowDefinitions>
2020
<TabControl>
2121
<TabItem Header="General">
22-
<Grid >
22+
<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
2323
<Grid.RowDefinitions>
2424
<RowDefinition Height="Auto"></RowDefinition>
25+
<RowDefinition Height="Auto"></RowDefinition>
2526
</Grid.RowDefinitions>
26-
<Grid.ColumnDefinitions>
27-
<ColumnDefinition Width="Auto"></ColumnDefinition>
28-
<ColumnDefinition Width="Auto"></ColumnDefinition>
29-
<ColumnDefinition Width="Auto"></ColumnDefinition>
30-
</Grid.ColumnDefinitions>
31-
<Label Content="Connection time-out:"></Label>
32-
<syncfusion:IntegerTextBox x:Name="IntTimeOut" Grid.Column="1" MinValue="1"></syncfusion:IntegerTextBox>
33-
<Label Grid.Column="2" Content="milliseconds"></Label>
27+
<Grid>
28+
<CheckBox x:Name="ChbAutoUpdate">Automatically check for updates</CheckBox>
29+
</Grid>
30+
<Grid Grid.Row="1">
31+
<Grid.RowDefinitions>
32+
<RowDefinition Height="Auto"></RowDefinition>
33+
</Grid.RowDefinitions>
34+
<Grid.ColumnDefinitions>
35+
<ColumnDefinition Width="Auto"></ColumnDefinition>
36+
<ColumnDefinition Width="Auto"></ColumnDefinition>
37+
<ColumnDefinition Width="Auto"></ColumnDefinition>
38+
</Grid.ColumnDefinitions>
39+
<Label Content="Connection time-out:"></Label>
40+
<syncfusion:IntegerTextBox x:Name="IntTimeOut" Grid.Column="1" MinValue="1"></syncfusion:IntegerTextBox>
41+
<Label Grid.Column="2" Content="milliseconds"></Label>
42+
</Grid>
3443
</Grid>
3544
</TabItem>
3645
<TabItem Header="Theme">
37-
<Grid>
46+
<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
3847
<Grid.RowDefinitions>
3948
<RowDefinition Height="Auto"></RowDefinition>
40-
<RowDefinition Height="Auto"></RowDefinition>
4149
</Grid.RowDefinitions>
42-
<Grid HorizontalAlignment="Center">
43-
<CheckBox x:Name="ChbAutoUpdate">Automatically check for updates</CheckBox>
44-
</Grid>
45-
<Grid Grid.Row="1">
50+
<Grid>
4651
<Grid.RowDefinitions>
4752
<RowDefinition Height="Auto"></RowDefinition>
4853
<RowDefinition Height="Auto"></RowDefinition>

Advanced PortChecker/Windows/SettingsWindow.xaml.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ private void BtnSave_Click(object sender, RoutedEventArgs e)
6565

6666
_mw.ChangeVisualStyle();
6767
ChangeVisualStyle();
68+
69+
MessageBox.Show("All settings have been saved!", "Advanced PortChecker", MessageBoxButton.OK, MessageBoxImage.Information);
6870
}
6971
catch (Exception ex)
7072
{
@@ -76,6 +78,11 @@ private void BtnReset_Click(object sender, RoutedEventArgs e)
7678
{
7779
try
7880
{
81+
if (MessageBox.Show("Are you sure you want to reset all settings?", "Advanced PortChecker", MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
82+
{
83+
return;
84+
}
85+
7986
Properties.Settings.Default.Reset();
8087
Properties.Settings.Default.Save();
8188

0 commit comments

Comments
 (0)