Skip to content

Portable Tool for an Ideal Windows Setup

fix misclick triggering notification actions on close

Greedeks2d3ecec04f7a
diff --git a/.Source/GTweak/Modules/Managers/NotificationManager.cs b/.Source/GTweak/Modules/Managers/NotificationManager.cs
index b05b9894..14da75b8 100644
--- a/.Source/GTweak/Modules/Managers/NotificationManager.cs
+++ b/.Source/GTweak/Modules/Managers/NotificationManager.cs
@@ -61,15 +61,15 @@ namespace GTweak.Modules.Managers
{
NotificationWindow window = new NotificationWindow
{
- NoticeTitle = _title,
- NoticeText = _text,
+ Caption = _title,
+ Description = _text,
AlertType = type
};
- if (string.IsNullOrWhiteSpace(window.NoticeTitle) && string.IsNullOrWhiteSpace(window.NoticeText))
+ if (string.IsNullOrWhiteSpace(window.Caption) && string.IsNullOrWhiteSpace(window.Description))
{
- window.NoticeTitle = (Application.Current?.Resources)?["title_warn_noty"] as string ?? string.Empty;
- window.NoticeText = (Application.Current?.Resources)?[type == AlertType.Logout ? "logout_noty" : "restart_noty"] as string ?? string.Empty;
+ window.Caption = (Application.Current?.Resources)?["title_warn_noty"] as string ?? string.Empty;
+ window.Description = (Application.Current?.Resources)?[type == AlertType.Logout ? "logout_noty" : "restart_noty"] as string ?? string.Empty;
}
window.Closed += delegate { Interlocked.Exchange(ref _isNotificationOpen, 0); };
diff --git a/.Source/GTweak/Windows/NotificationWindow.xaml b/.Source/GTweak/Windows/NotificationWindow.xaml
index 93d1228d..6f0a9bfb 100644
--- a/.Source/GTweak/Windows/NotificationWindow.xaml
+++ b/.Source/GTweak/Windows/NotificationWindow.xaml
@@ -30,7 +30,7 @@
<Button x:Name="ButtonClose" Style="{StaticResource ButtonClose}" Width="25" Height="25" Margin="0,4,4,0" HorizontalAlignment="Right" VerticalAlignment="Center" Click="ButtonClose_Click"/>
</Grid>
- <Grid Grid.Row="1" Background="Transparent" PreviewMouseLeftButtonUp="Grid_PreviewMouseLeftButtonUp">
+ <Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
@@ -38,7 +38,7 @@
<Image Grid.Column="0" Width="53" Height="53" Source="/GTweak.ico" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="20,0,10,10"/>
- <Grid Grid.Column="1" Margin="10">
+ <Grid Grid.Column="1" x:Name="ActionArea" Margin="10" Background="Transparent" PreviewMouseLeftButtonUp="Grid_PreviewMouseLeftButtonUp">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
@@ -50,7 +50,7 @@
<TranslateTransform X="3" Y="3"/>
</TextBlock.RenderTransform>
</TextBlock>
- <TextBlock x:Name="Header" Text="Title" Foreground="{StaticResource Brush_Highlighted}" FontFamily="{StaticResource Jura}" FontSize="15" TextWrapping="Wrap" HorizontalAlignment="Left" TextAlignment="Left" FontStretch="Medium"/>
+ <TextBlock x:Name="Headline" Text="Title" Foreground="{StaticResource Brush_Highlighted}" FontFamily="{StaticResource Jura}" FontSize="15" TextWrapping="Wrap" HorizontalAlignment="Left" TextAlignment="Left" FontStretch="Medium"/>
</Grid>
<Grid Grid.Row="1" HorizontalAlignment="Left" Margin="0,2,0,0">
@@ -59,7 +59,7 @@
<TranslateTransform X="3" Y="3"/>
</TextBlock.RenderTransform>
</TextBlock>
- <TextBlock x:Name="MessageBody" Text="Text" Foreground="{StaticResource Brush_TextBlock_Inactivity}" FontFamily="{StaticResource Jura}" FontSize="14" TextWrapping="Wrap" HorizontalAlignment="Left" TextAlignment="Left" FontStretch="Medium" MaxWidth="265"/>
+ <TextBlock x:Name="Subtitle" Text="Text" Foreground="{StaticResource Brush_TextBlock_Inactivity}" FontFamily="{StaticResource Jura}" FontSize="14" TextWrapping="Wrap" HorizontalAlignment="Left" TextAlignment="Left" FontStretch="Medium" MaxWidth="265"/>
</Grid>
</Grid>
</Grid>
diff --git a/.Source/GTweak/Windows/NotificationWindow.xaml.cs b/.Source/GTweak/Windows/NotificationWindow.xaml.cs
index 5c4d9346..a6fab1bb 100644
--- a/.Source/GTweak/Windows/NotificationWindow.xaml.cs
+++ b/.Source/GTweak/Windows/NotificationWindow.xaml.cs
@@ -20,9 +20,20 @@ namespace GTweak.Windows
private TimerControlManager _timer = default;
private Rect primaryMonitorArea = SystemParameters.WorkArea;
- internal string NoticeTitle { set => Header.Text = value; get => Header.Text; }
- internal string NoticeText { set => MessageBody.Text = value; get => MessageBody.Text; }
- internal NotificationManager.AlertType AlertType { set => _alertType = value; get => _alertType; }
+ internal string Caption { set => Headline.Text = value; get => Headline.Text; }
+ internal string Description { set => Subtitle.Text = value; get => Subtitle.Text; }
+ internal NotificationManager.AlertType AlertType
+ {
+ set
+ {
+ _alertType = value;
+ if (ActionArea != null)
+ {
+ ActionArea.Cursor = (value != NotificationManager.AlertType.None) ? Cursors.Hand : Cursors.Arrow;
+ }
+ }
+ get => _alertType;
+ }
public NotificationWindow()
{