空值检测?
去你的空值 炸了不关我事
This commit is contained in:
@@ -87,7 +87,7 @@ namespace Ink_Canvas
|
|||||||
private void SysTrayMenu_Closed(object sender, RoutedEventArgs e)
|
private void SysTrayMenu_Closed(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var mainWin = (MainWindow)Current.MainWindow;
|
var mainWin = (MainWindow)Current.MainWindow;
|
||||||
if (mainWin.IsLoaded)
|
if (mainWin != null && mainWin.IsLoaded)
|
||||||
{
|
{
|
||||||
// 菜单关闭后,恢复主窗口的置顶状态
|
// 菜单关闭后,恢复主窗口的置顶状态
|
||||||
if (Ink_Canvas.MainWindow.Settings.Advanced.IsAlwaysOnTop && Ink_Canvas.MainWindow.Settings.Advanced.IsNoFocusMode)
|
if (Ink_Canvas.MainWindow.Settings.Advanced.IsAlwaysOnTop && Ink_Canvas.MainWindow.Settings.Advanced.IsNoFocusMode)
|
||||||
@@ -112,7 +112,7 @@ namespace Ink_Canvas
|
|||||||
private void CloseAppTrayIconMenuItem_Clicked(object sender, RoutedEventArgs e)
|
private void CloseAppTrayIconMenuItem_Clicked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var mainWin = (MainWindow)Current.MainWindow;
|
var mainWin = (MainWindow)Current.MainWindow;
|
||||||
if (mainWin.IsLoaded)
|
if (mainWin != null && mainWin.IsLoaded)
|
||||||
{
|
{
|
||||||
IsAppExitByUser = true;
|
IsAppExitByUser = true;
|
||||||
mainWin.BtnExit_Click(null, null);
|
mainWin.BtnExit_Click(null, null);
|
||||||
@@ -136,7 +136,7 @@ namespace Ink_Canvas
|
|||||||
private void RestartAppTrayIconMenuItem_Clicked(object sender, RoutedEventArgs e)
|
private void RestartAppTrayIconMenuItem_Clicked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var mainWin = (MainWindow)Current.MainWindow;
|
var mainWin = (MainWindow)Current.MainWindow;
|
||||||
if (mainWin.IsLoaded)
|
if (mainWin != null && mainWin.IsLoaded)
|
||||||
{
|
{
|
||||||
IsAppExitByUser = true;
|
IsAppExitByUser = true;
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ namespace Ink_Canvas
|
|||||||
private void ForceFullScreenTrayIconMenuItem_Clicked(object sender, RoutedEventArgs e)
|
private void ForceFullScreenTrayIconMenuItem_Clicked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var mainWin = (MainWindow)Current.MainWindow;
|
var mainWin = (MainWindow)Current.MainWindow;
|
||||||
if (mainWin.IsLoaded)
|
if (mainWin != null && mainWin.IsLoaded)
|
||||||
{
|
{
|
||||||
Ink_Canvas.MainWindow.MoveWindow(new WindowInteropHelper(mainWin).Handle, 0, 0,
|
Ink_Canvas.MainWindow.MoveWindow(new WindowInteropHelper(mainWin).Handle, 0, 0,
|
||||||
Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, true);
|
Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, true);
|
||||||
@@ -199,7 +199,7 @@ namespace Ink_Canvas
|
|||||||
private void FoldFloatingBarTrayIconMenuItem_Clicked(object sender, RoutedEventArgs e)
|
private void FoldFloatingBarTrayIconMenuItem_Clicked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var mainWin = (MainWindow)Current.MainWindow;
|
var mainWin = (MainWindow)Current.MainWindow;
|
||||||
if (mainWin.IsLoaded)
|
if (mainWin != null && mainWin.IsLoaded)
|
||||||
if (mainWin.isFloatingBarFolded) mainWin.UnFoldFloatingBar_MouseUp(new object(), null);
|
if (mainWin.isFloatingBarFolded) mainWin.UnFoldFloatingBar_MouseUp(new object(), null);
|
||||||
else mainWin.FoldFloatingBar_MouseUp(new object(), null);
|
else mainWin.FoldFloatingBar_MouseUp(new object(), null);
|
||||||
}
|
}
|
||||||
@@ -221,7 +221,7 @@ namespace Ink_Canvas
|
|||||||
private void ResetFloatingBarPositionTrayIconMenuItem_Clicked(object sender, RoutedEventArgs e)
|
private void ResetFloatingBarPositionTrayIconMenuItem_Clicked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var mainWin = (MainWindow)Current.MainWindow;
|
var mainWin = (MainWindow)Current.MainWindow;
|
||||||
if (mainWin.IsLoaded)
|
if (mainWin != null && mainWin.IsLoaded)
|
||||||
{
|
{
|
||||||
var isInPPTPresentationMode = false;
|
var isInPPTPresentationMode = false;
|
||||||
Dispatcher.Invoke(() =>
|
Dispatcher.Invoke(() =>
|
||||||
@@ -257,19 +257,22 @@ namespace Ink_Canvas
|
|||||||
{
|
{
|
||||||
var mi = (MenuItem)sender;
|
var mi = (MenuItem)sender;
|
||||||
var mainWin = (MainWindow)Current.MainWindow;
|
var mainWin = (MainWindow)Current.MainWindow;
|
||||||
if (mainWin.IsLoaded)
|
if (mainWin != null && mainWin.IsLoaded)
|
||||||
{
|
{
|
||||||
mainWin.Hide();
|
mainWin.Hide();
|
||||||
var s = ((TaskbarIcon)Current.Resources["TaskbarTrayIcon"]).ContextMenu;
|
var s = ((TaskbarIcon)Current.Resources["TaskbarTrayIcon"]).ContextMenu;
|
||||||
var ResetFloatingBarPositionTrayIconMenuItem = (MenuItem)s.Items[s.Items.Count - 4];
|
if (s != null)
|
||||||
var FoldFloatingBarTrayIconMenuItem = (MenuItem)s.Items[s.Items.Count - 5];
|
{
|
||||||
var ForceFullScreenTrayIconMenuItem = (MenuItem)s.Items[s.Items.Count - 6];
|
var ResetFloatingBarPositionTrayIconMenuItem = (MenuItem)s.Items[s.Items.Count - 4];
|
||||||
ResetFloatingBarPositionTrayIconMenuItem.IsEnabled = false;
|
var FoldFloatingBarTrayIconMenuItem = (MenuItem)s.Items[s.Items.Count - 5];
|
||||||
FoldFloatingBarTrayIconMenuItem.IsEnabled = false;
|
var ForceFullScreenTrayIconMenuItem = (MenuItem)s.Items[s.Items.Count - 6];
|
||||||
ForceFullScreenTrayIconMenuItem.IsEnabled = false;
|
ResetFloatingBarPositionTrayIconMenuItem.IsEnabled = false;
|
||||||
ResetFloatingBarPositionTrayIconMenuItem.Opacity = 0.5;
|
FoldFloatingBarTrayIconMenuItem.IsEnabled = false;
|
||||||
FoldFloatingBarTrayIconMenuItem.Opacity = 0.5;
|
ForceFullScreenTrayIconMenuItem.IsEnabled = false;
|
||||||
ForceFullScreenTrayIconMenuItem.Opacity = 0.5;
|
ResetFloatingBarPositionTrayIconMenuItem.Opacity = 0.5;
|
||||||
|
FoldFloatingBarTrayIconMenuItem.Opacity = 0.5;
|
||||||
|
ForceFullScreenTrayIconMenuItem.Opacity = 0.5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -299,19 +302,22 @@ namespace Ink_Canvas
|
|||||||
{
|
{
|
||||||
var mi = (MenuItem)sender;
|
var mi = (MenuItem)sender;
|
||||||
var mainWin = (MainWindow)Current.MainWindow;
|
var mainWin = (MainWindow)Current.MainWindow;
|
||||||
if (mainWin.IsLoaded)
|
if (mainWin != null && mainWin.IsLoaded)
|
||||||
{
|
{
|
||||||
mainWin.Show();
|
mainWin.Show();
|
||||||
var s = ((TaskbarIcon)Current.Resources["TaskbarTrayIcon"]).ContextMenu;
|
var s = ((TaskbarIcon)Current.Resources["TaskbarTrayIcon"]).ContextMenu;
|
||||||
var ResetFloatingBarPositionTrayIconMenuItem = (MenuItem)s.Items[s.Items.Count - 4];
|
if (s != null)
|
||||||
var FoldFloatingBarTrayIconMenuItem = (MenuItem)s.Items[s.Items.Count - 5];
|
{
|
||||||
var ForceFullScreenTrayIconMenuItem = (MenuItem)s.Items[s.Items.Count - 6];
|
var ResetFloatingBarPositionTrayIconMenuItem = (MenuItem)s.Items[s.Items.Count - 4];
|
||||||
ResetFloatingBarPositionTrayIconMenuItem.IsEnabled = true;
|
var FoldFloatingBarTrayIconMenuItem = (MenuItem)s.Items[s.Items.Count - 5];
|
||||||
FoldFloatingBarTrayIconMenuItem.IsEnabled = true;
|
var ForceFullScreenTrayIconMenuItem = (MenuItem)s.Items[s.Items.Count - 6];
|
||||||
ForceFullScreenTrayIconMenuItem.IsEnabled = true;
|
ResetFloatingBarPositionTrayIconMenuItem.IsEnabled = true;
|
||||||
ResetFloatingBarPositionTrayIconMenuItem.Opacity = 1;
|
FoldFloatingBarTrayIconMenuItem.IsEnabled = true;
|
||||||
FoldFloatingBarTrayIconMenuItem.Opacity = 1;
|
ForceFullScreenTrayIconMenuItem.IsEnabled = true;
|
||||||
ForceFullScreenTrayIconMenuItem.Opacity = 1;
|
ResetFloatingBarPositionTrayIconMenuItem.Opacity = 1;
|
||||||
|
FoldFloatingBarTrayIconMenuItem.Opacity = 1;
|
||||||
|
ForceFullScreenTrayIconMenuItem.Opacity = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -340,7 +346,7 @@ namespace Ink_Canvas
|
|||||||
private void DisableAllHotkeysMenuItem_Clicked(object sender, RoutedEventArgs e)
|
private void DisableAllHotkeysMenuItem_Clicked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var mainWin = (MainWindow)Current.MainWindow;
|
var mainWin = (MainWindow)Current.MainWindow;
|
||||||
if (mainWin.IsLoaded)
|
if (mainWin != null && mainWin.IsLoaded)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using iNKORE.UI.WPF.Modern;
|
|||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using System;
|
using System;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
|
using System.Windows.Threading;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
@@ -17,11 +18,16 @@ namespace Ink_Canvas.Windows
|
|||||||
{
|
{
|
||||||
private TimerControl parentControl;
|
private TimerControl parentControl;
|
||||||
private System.Timers.Timer updateTimer;
|
private System.Timers.Timer updateTimer;
|
||||||
|
private readonly Dispatcher uiDispatcher;
|
||||||
|
|
||||||
public MinimizedTimerControl()
|
public MinimizedTimerControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
// capture the UI dispatcher early so timer callbacks can use it even when
|
||||||
|
// Application.Current may become null during shutdown
|
||||||
|
uiDispatcher = this.Dispatcher;
|
||||||
|
|
||||||
updateTimer = new System.Timers.Timer(100);
|
updateTimer = new System.Timers.Timer(100);
|
||||||
updateTimer.Elapsed += UpdateTimer_Elapsed;
|
updateTimer.Elapsed += UpdateTimer_Elapsed;
|
||||||
updateTimer.Start();
|
updateTimer.Start();
|
||||||
@@ -46,18 +52,35 @@ namespace Ink_Canvas.Windows
|
|||||||
|
|
||||||
if (updateTimer != null)
|
if (updateTimer != null)
|
||||||
{
|
{
|
||||||
updateTimer.Stop();
|
// 先取消事件订阅,防止在停止/释放后仍有回调被触发
|
||||||
updateTimer.Dispose();
|
updateTimer.Elapsed -= UpdateTimer_Elapsed;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
updateTimer.Stop();
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
try
|
||||||
|
{
|
||||||
|
updateTimer.Dispose();
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
updateTimer = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SystemEvents_UserPreferenceChanged(object sender, UserPreferenceChangedEventArgs e)
|
private void SystemEvents_UserPreferenceChanged(object sender, UserPreferenceChangedEventArgs e)
|
||||||
{
|
{
|
||||||
// 当主题变化时,重新应用主题
|
// 当主题变化时,重新应用主题
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
var dispatcher = uiDispatcher ?? Application.Current?.Dispatcher;
|
||||||
|
if (dispatcher == null) return;
|
||||||
|
if (dispatcher.HasShutdownStarted || dispatcher.HasShutdownFinished) return;
|
||||||
|
|
||||||
|
// 使用异步调用,避免在关闭过程中同步等待导致异常
|
||||||
|
try
|
||||||
{
|
{
|
||||||
RefreshTheme();
|
dispatcher.InvokeAsync(() => RefreshTheme(), DispatcherPriority.Normal);
|
||||||
});
|
}
|
||||||
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -99,26 +122,35 @@ namespace Ink_Canvas.Windows
|
|||||||
{
|
{
|
||||||
if (parentControl != null)
|
if (parentControl != null)
|
||||||
{
|
{
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
var dispatcher = uiDispatcher ?? Application.Current?.Dispatcher;
|
||||||
|
if (dispatcher == null) return;
|
||||||
|
if (dispatcher.HasShutdownStarted || dispatcher.HasShutdownFinished) return;
|
||||||
|
|
||||||
|
// 使用异步派发,避免在 Dispatcher 关闭时同步等待导致 TaskCanceledException
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (this.Visibility != Visibility.Visible)
|
dispatcher.InvokeAsync(() =>
|
||||||
{
|
{
|
||||||
return;
|
if (this.Visibility != Visibility.Visible)
|
||||||
}
|
|
||||||
|
|
||||||
if (ShouldHide())
|
|
||||||
{
|
|
||||||
this.Visibility = Visibility.Collapsed;
|
|
||||||
var parent = this.Parent as FrameworkElement;
|
|
||||||
if (parent != null)
|
|
||||||
{
|
{
|
||||||
parent.Visibility = Visibility.Collapsed;
|
return;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
UpdateTimeDisplay();
|
if (ShouldHide())
|
||||||
});
|
{
|
||||||
|
this.Visibility = Visibility.Collapsed;
|
||||||
|
var parent = this.Parent as FrameworkElement;
|
||||||
|
if (parent != null)
|
||||||
|
{
|
||||||
|
parent.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateTimeDisplay();
|
||||||
|
}, DispatcherPriority.Normal);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,10 +246,15 @@ namespace Ink_Canvas.Windows
|
|||||||
|
|
||||||
private void ParentControl_TimerCompleted(object sender, EventArgs e)
|
private void ParentControl_TimerCompleted(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
var dispatcher = uiDispatcher ?? Application.Current?.Dispatcher;
|
||||||
|
if (dispatcher == null) return;
|
||||||
|
if (dispatcher.HasShutdownStarted || dispatcher.HasShutdownFinished) return;
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
Visibility = Visibility.Collapsed;
|
dispatcher.InvokeAsync(() => { Visibility = Visibility.Collapsed; }, DispatcherPriority.Normal);
|
||||||
});
|
}
|
||||||
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetDigitDisplay(string pathName, int digit, bool isRed = false)
|
private void SetDigitDisplay(string pathName, int digit, bool isRed = false)
|
||||||
@@ -391,7 +428,7 @@ namespace Ink_Canvas.Windows
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var mainWindow = Application.Current.MainWindow as MainWindow;
|
var mainWindow = Application.Current?.MainWindow as MainWindow;
|
||||||
if (mainWindow != null)
|
if (mainWindow != null)
|
||||||
{
|
{
|
||||||
var currentModeField = mainWindow.GetType().GetField("currentMode",
|
var currentModeField = mainWindow.GetType().GetField("currentMode",
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="欢迎使用 InkCanvasForClass"
|
Title="欢迎使用 InkCanvasForClass"
|
||||||
Height="460"
|
Height="480"
|
||||||
Width="780"
|
Width="800"
|
||||||
MinHeight="300"
|
MinHeight="300"
|
||||||
MinWidth="400"
|
MinWidth="400"
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ namespace Ink_Canvas.Windows
|
|||||||
private double originalCapsuleWidth = 0;
|
private double originalCapsuleWidth = 0;
|
||||||
private string lastCountdownText = ""; // 上次的倒计时文本,用于检测文本变化
|
private string lastCountdownText = ""; // 上次的倒计时文本,用于检测文本变化
|
||||||
private Storyboard currentWidthAnimation; // 当前正在运行的宽度动画
|
private Storyboard currentWidthAnimation; // 当前正在运行的宽度动画
|
||||||
|
private volatile bool isDisposed = false;
|
||||||
|
|
||||||
public PPTTimeCapsule()
|
public PPTTimeCapsule()
|
||||||
{
|
{
|
||||||
@@ -72,10 +73,43 @@ namespace Ink_Canvas.Windows
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
StopTimeUpdate();
|
if (isDisposed) return;
|
||||||
SystemEvents.UserPreferenceChanged -= SystemEvents_UserPreferenceChanged;
|
isDisposed = true;
|
||||||
timeUpdateTimer?.Dispose();
|
|
||||||
countdownUpdateTimer?.Dispose();
|
// 先取消系统事件订阅,防止在释放过程中再次触发
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SystemEvents.UserPreferenceChanged -= SystemEvents_UserPreferenceChanged;
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
// 停止并释放定时器,确保不再触发回调
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (timeUpdateTimer != null)
|
||||||
|
{
|
||||||
|
timeUpdateTimer.Elapsed -= TimeUpdateTimer_Elapsed;
|
||||||
|
try { timeUpdateTimer.Stop(); } catch { }
|
||||||
|
try { timeUpdateTimer.Dispose(); } catch { }
|
||||||
|
timeUpdateTimer = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (countdownUpdateTimer != null)
|
||||||
|
{
|
||||||
|
countdownUpdateTimer.Elapsed -= CountdownUpdateTimer_Elapsed;
|
||||||
|
try { countdownUpdateTimer.Stop(); } catch { }
|
||||||
|
try { countdownUpdateTimer.Dispose(); } catch { }
|
||||||
|
countdownUpdateTimer = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
// 停止动画
|
||||||
|
try { StopColonBlinkAnimation(); } catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeTimers()
|
private void InitializeTimers()
|
||||||
@@ -91,23 +125,39 @@ namespace Ink_Canvas.Windows
|
|||||||
|
|
||||||
private void TimeUpdateTimer_Elapsed(object sender, ElapsedEventArgs e)
|
private void TimeUpdateTimer_Elapsed(object sender, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
|
if (isDisposed) return;
|
||||||
|
|
||||||
|
var dispatcher = this.Dispatcher;
|
||||||
|
if (dispatcher == null || dispatcher.HasShutdownStarted || dispatcher.HasShutdownFinished) return;
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
UpdateTimeDisplay();
|
dispatcher.BeginInvoke(new Action(() =>
|
||||||
}), DispatcherPriority.Normal);
|
{
|
||||||
|
if (isDisposed) return;
|
||||||
|
UpdateTimeDisplay();
|
||||||
|
}), DispatcherPriority.Normal);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CountdownUpdateTimer_Elapsed(object sender, ElapsedEventArgs e)
|
private void CountdownUpdateTimer_Elapsed(object sender, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
|
if (isDisposed) return;
|
||||||
{
|
|
||||||
if (this.Visibility != Visibility.Visible)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
UpdateCountdownDisplay();
|
var dispatcher = this.Dispatcher;
|
||||||
}), DispatcherPriority.Normal);
|
if (dispatcher == null || dispatcher.HasShutdownStarted || dispatcher.HasShutdownFinished) return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dispatcher.BeginInvoke(new Action(() =>
|
||||||
|
{
|
||||||
|
if (isDisposed) return;
|
||||||
|
if (this.Visibility != Visibility.Visible) return;
|
||||||
|
UpdateCountdownDisplay();
|
||||||
|
}), DispatcherPriority.Normal);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StartTimeUpdate()
|
private void StartTimeUpdate()
|
||||||
@@ -724,10 +774,20 @@ namespace Ink_Canvas.Windows
|
|||||||
|
|
||||||
private void SystemEvents_UserPreferenceChanged(object sender, UserPreferenceChangedEventArgs e)
|
private void SystemEvents_UserPreferenceChanged(object sender, UserPreferenceChangedEventArgs e)
|
||||||
{
|
{
|
||||||
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
|
if (isDisposed) return;
|
||||||
|
|
||||||
|
var dispatcher = this.Dispatcher;
|
||||||
|
if (dispatcher == null || dispatcher.HasShutdownStarted || dispatcher.HasShutdownFinished) return;
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
ApplyTheme();
|
dispatcher.BeginInvoke(new Action(() =>
|
||||||
}), DispatcherPriority.Normal);
|
{
|
||||||
|
if (isDisposed) return;
|
||||||
|
ApplyTheme();
|
||||||
|
}), DispatcherPriority.Normal);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ApplyTheme()
|
private void ApplyTheme()
|
||||||
|
|||||||
Reference in New Issue
Block a user