Skip to content

Portable Tool for an Ideal Windows Setup

fix notification flickering on initialization

Greedeksa633b915b4fd
diff --git a/.Source/GTweak/Windows/NotificationWindow.xaml b/.Source/GTweak/Windows/NotificationWindow.xaml
index 46d58322..e6b4a27a 100644
--- a/.Source/GTweak/Windows/NotificationWindow.xaml
+++ b/.Source/GTweak/Windows/NotificationWindow.xaml
@@ -8,7 +8,7 @@
mc:Ignorable="d" Icon="/GTweak.ico"
Background="Transparent" WindowStyle="None" IsTabStop="False" SnapsToDevicePixels="True" UseLayoutRounding="True" ShowInTaskbar="False"
ExtendsContentIntoTitleBar="True" WindowBackdropType="Mica" SizeToContent="Height" ResizeMode="NoResize" WindowStartupLocation="Manual" KeyboardNavigation.TabNavigation="None"
- Title="{DynamicResource title_win_noty}" Topmost="True" MinHeight="125" MinWidth="375" MaxHeight="170" MaxWidth="375" Loaded="Window_Loaded">
+ Title="{DynamicResource title_win_noty}" Topmost="True" MinHeight="125" MinWidth="375" MaxHeight="170" MaxWidth="375">
<Grid Background="{StaticResource Brush_Background}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
diff --git a/.Source/GTweak/Windows/NotificationWindow.xaml.cs b/.Source/GTweak/Windows/NotificationWindow.xaml.cs
index df16ea32..4c4826a3 100644
--- a/.Source/GTweak/Windows/NotificationWindow.xaml.cs
+++ b/.Source/GTweak/Windows/NotificationWindow.xaml.cs
@@ -29,11 +29,22 @@ namespace GTweak.Windows
{
Top = primaryMonitorArea.Bottom - Height - 10;
Left = primaryMonitorArea.Right + 10;
+
+
};
Unloaded += delegate { _timer.Stop(); };
- Loaded += delegate
+ Loaded += (s, e) =>
{
+ if (SettingsEngine.IsPlayingSound)
+ {
+ using SoundPlayer notificationSound = new SoundPlayer(Properties.Resources.Sound);
+ notificationSound.Play();
+ }
+
+ BeginAnimation(OpacityProperty, FactoryAnimation.CreateIn(0, 1, 0.2));
+ BeginAnimation(LeftProperty, FactoryAnimation.CreateIn(primaryMonitorArea.Right + 10, primaryMonitorArea.Right - Width - 10, 0.35, useCubicEase: true));
+
_timer = new TimerControlManager(TimeSpan.FromSeconds(3), TimerControlManager.TimerMode.CountDown, null, () => { Close(); });
_timer.Start();
ProgressTimer.BeginAnimation(RangeBase.ValueProperty, FactoryAnimation.CreateIn(0, 100, 4.1));
@@ -49,16 +60,5 @@ namespace GTweak.Windows
CommandExecutor.RunCommand(RequiredAction == NotificationManager.NoticeAction.Logout ? @"/c logoff" : @"/c shutdown /r /t 0");
}
}
-
- private void Window_Loaded(object sender, RoutedEventArgs e)
- {
- if (SettingsEngine.IsPlayingSound)
- {
- using SoundPlayer notificationSound = new SoundPlayer(Properties.Resources.Sound);
- notificationSound.Play();
- }
-
- BeginAnimation(LeftProperty, FactoryAnimation.CreateIn(primaryMonitorArea.Right + 10, primaryMonitorArea.Right - Width - 10, 0.3, useCubicEase: true));
- }
}
}