Skip to content

Portable Tool for an Ideal Windows Setup

fix flickering and delayed content in notification window

Greedeks8f008aa0b4c0
diff --git a/.Source/GTweak/Windows/NotificationWindow.xaml b/.Source/GTweak/Windows/NotificationWindow.xaml
index 8c7f035d..da7086a9 100644
--- a/.Source/GTweak/Windows/NotificationWindow.xaml
+++ b/.Source/GTweak/Windows/NotificationWindow.xaml
@@ -1,4 +1,4 @@
-<ui:FluentWindow x:Class="GTweak.Windows.NotificationWindow"
+<ui:FluentWindow x:Class="GTweak.Windows.NotificationWindow"
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"
diff --git a/.Source/GTweak/Windows/NotificationWindow.xaml.cs b/.Source/GTweak/Windows/NotificationWindow.xaml.cs
index 93c936da..afffe9d1 100644
--- a/.Source/GTweak/Windows/NotificationWindow.xaml.cs
+++ b/.Source/GTweak/Windows/NotificationWindow.xaml.cs
@@ -1,10 +1,8 @@
using System;
using System.Media;
using System.Windows;
-using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
-using System.Windows.Media.Animation;
using GTweak.Utilities.Animation;
using GTweak.Utilities.Controls;
using GTweak.Utilities.Helpers;
@@ -17,6 +15,7 @@ namespace GTweak.Windows
{
private NotificationManager.NoticeAction _requiredAction = default;
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; }
@@ -26,6 +25,12 @@ namespace GTweak.Windows
{
InitializeComponent();
+ SourceInitialized += delegate
+ {
+ Top = primaryMonitorArea.Bottom - Height - 10;
+ Left = primaryMonitorArea.Right + 10;
+ };
+
Unloaded += delegate { _timer.Stop(); };
Loaded += delegate
{
@@ -47,24 +52,7 @@ namespace GTweak.Windows
notificationSound.Play();
}
- Rect primaryMonitorArea = SystemParameters.WorkArea;
-
- Top = primaryMonitorArea.Bottom - Height - 10;
- Left = primaryMonitorArea.Right - Width - 10;
-
- DoubleAnimationUsingKeyFrames doubleAnimKeyFrames = new DoubleAnimationUsingKeyFrames();
-
- doubleAnimKeyFrames.KeyFrames.Add(new EasingDoubleKeyFrame(primaryMonitorArea.Right, TimeSpan.Zero)
- {
- EasingFunction = new QuadraticEase()
- });
- doubleAnimKeyFrames.KeyFrames.Add(new EasingDoubleKeyFrame(primaryMonitorArea.Right - Width - 10, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(300)))
- {
- EasingFunction = new QuadraticEase()
- });
-
- Timeline.SetDesiredFrameRate(doubleAnimKeyFrames, 120);
- BeginAnimation(Canvas.LeftProperty, doubleAnimKeyFrames);
+ BeginAnimation(LeftProperty, FactoryAnimation.CreateIn(primaryMonitorArea.Right + 10, primaryMonitorArea.Right - Width - 10, 0.3, null, false, true));
}
}
}