diff --git a/CollapseLauncher.sln.DotSettings b/CollapseLauncher.sln.DotSettings index 4ba2fcc4e..b3ba5aa89 100644 --- a/CollapseLauncher.sln.DotSettings +++ b/CollapseLauncher.sln.DotSettings @@ -42,6 +42,7 @@ CDNURL FX FXAA + GLC HD HDR ID diff --git a/CollapseLauncher/Classes/Helper/WindowUtility.cs b/CollapseLauncher/Classes/Helper/WindowUtility.cs index 8b8405d03..25c26de6c 100644 --- a/CollapseLauncher/Classes/Helper/WindowUtility.cs +++ b/CollapseLauncher/Classes/Helper/WindowUtility.cs @@ -362,6 +362,7 @@ private static IntPtr MainWndProc(IntPtr hwnd, uint msg, UIntPtr wParam, IntPtr { mainWindow._TrayIcon.ToggleAllVisibility(); } + else TrayNullHandler("WindowUtility.MainWndProc"); return 0; } @@ -661,10 +662,10 @@ internal static bool IsCurrentWindowInFocus() /// public static void ToggleToTray_MainWindow() { - if (CurrentWindow is MainWindow window) - { - window._TrayIcon.ToggleMainVisibility(); - } + if (CurrentWindow is not MainWindow window) return; + + if (window._TrayIcon != null) window._TrayIcon.ToggleMainVisibility(); + else TrayNullHandler(nameof(Tray_ShowNotification)); } /// @@ -672,10 +673,10 @@ public static void ToggleToTray_MainWindow() /// public static void ToggleToTray_AllWindow() { - if (CurrentWindow is MainWindow window) - { - window._TrayIcon.ToggleAllVisibility(); - } + if (CurrentWindow is not MainWindow window) return; + + if (window._TrayIcon != null) window._TrayIcon.ToggleAllVisibility(); + else TrayNullHandler(nameof(Tray_ShowNotification)); } /// @@ -722,10 +723,17 @@ public static void Tray_ShowNotification(string title, bool respectQuietTime = true, bool realtime = false) { - if (CurrentWindow is MainWindow window) - { - window._TrayIcon.ShowNotification(title, message, icon, customIconHandle, largeIcon, sound, respectQuietTime, realtime); - } + if (CurrentWindow is not MainWindow window) return; + + if (window._TrayIcon != null) + window._TrayIcon.ShowNotification(title, message, icon, customIconHandle, largeIcon, sound, + respectQuietTime, realtime); + else TrayNullHandler(nameof(Tray_ShowNotification)); + } + + private static void TrayNullHandler(string caller) + { + Logger.LogWriteLine($"TrayIcon is null/not initialized!\r\n\tCalled by: {caller}"); } #endregion diff --git a/CollapseLauncher/Classes/InstallManagement/BaseClass/InstallManagerBase.cs b/CollapseLauncher/Classes/InstallManagement/BaseClass/InstallManagerBase.cs index 014cf8bba..2d6b9e91a 100644 --- a/CollapseLauncher/Classes/InstallManagement/BaseClass/InstallManagerBase.cs +++ b/CollapseLauncher/Classes/InstallManagement/BaseClass/InstallManagerBase.cs @@ -2776,7 +2776,10 @@ private async Task StartSteamMigration(string gamePath) try { + #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed + // This is intentional as the dialog is only to cancel the routine, not waiting for user input. SimpleDialogs.QueueAndSpawnDialog(contentDialog); + #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed await gameRepairInstance.StartCheckRoutine(); statusActivity.Text = Lang._InstallMigrateSteam.Step4Title; await gameRepairInstance.StartRepairRoutine(false); diff --git a/CollapseLauncher/CollapseLauncher.csproj b/CollapseLauncher/CollapseLauncher.csproj index 3343f1c26..5fdf064a0 100644 --- a/CollapseLauncher/CollapseLauncher.csproj +++ b/CollapseLauncher/CollapseLauncher.csproj @@ -74,14 +74,14 @@ - - - - - - - - + + + + + + + +