diff --git a/CollapseLauncher/Classes/EventsManagement/BackgroundActivityManager.cs b/CollapseLauncher/Classes/EventsManagement/BackgroundActivityManager.cs index 06f02eab5..fccba7acb 100644 --- a/CollapseLauncher/Classes/EventsManagement/BackgroundActivityManager.cs +++ b/CollapseLauncher/Classes/EventsManagement/BackgroundActivityManager.cs @@ -232,6 +232,18 @@ private static void AttachEventToNotification(int hashID, IBackgroundActivity ac settingsButton.Click += async (_, _) => await Dialogs.SimpleDialogs.Dialog_DownloadSettings(_parentContainer, CurrentGameProperty); + StackPanel controlButtons = new StackPanel + { + Orientation = Orientation.Horizontal, + HorizontalAlignment = HorizontalAlignment.Right, + Children = + { + settingsButton, + cancelButton + } + }; + _parentContainer.Children.Add(controlButtons); + EventHandler ProgressChangedEventHandler = (_, args) => activity?.Dispatch(() => { progressBar.Value = args!.ProgressTotalPercentage; @@ -247,7 +259,8 @@ private static void AttachEventToNotification(int hashID, IBackgroundActivity ac if (args.IsCanceled) { cancelButton.IsEnabled = false; - cancelButton.Visibility = Visibility.Collapsed; + settingsButton.IsEnabled = false; + controlButtons.Visibility = Visibility.Collapsed; _parentNotifUI.Severity = InfoBarSeverity.Error; _parentNotifUI.Title = string.Format(Lang._BackgroundNotification.NotifBadge_Error!, activityTitle); _parentNotifUI.IsClosable = true; @@ -256,7 +269,8 @@ private static void AttachEventToNotification(int hashID, IBackgroundActivity ac if (args.IsCompleted) { cancelButton.IsEnabled = false; - cancelButton.Visibility = Visibility.Collapsed; + settingsButton.IsEnabled = false; + controlButtons.Visibility = Visibility.Collapsed; _parentNotifUI.Severity = InfoBarSeverity.Success; _parentNotifUI.Title = string.Format(Lang._BackgroundNotification.NotifBadge_Completed!, activityTitle); _parentNotifUI.IsClosable = true; @@ -265,7 +279,8 @@ private static void AttachEventToNotification(int hashID, IBackgroundActivity ac if (args.IsRunning) { cancelButton.IsEnabled = true; - cancelButton.Visibility = Visibility.Visible; + settingsButton.IsEnabled = true; + controlButtons.Visibility = Visibility.Visible; _parentNotifUI.Severity = InfoBarSeverity.Informational; _parentNotifUI.Title = activityTitle; _parentNotifUI.IsClosable = false; @@ -289,17 +304,6 @@ private static void AttachEventToNotification(int hashID, IBackgroundActivity ac Detach(hashID); }; - _parentContainer.Children.Add(new StackPanel - { - Orientation = Orientation.Horizontal, - HorizontalAlignment = HorizontalAlignment.Right, - Children = - { - settingsButton, - cancelButton - } - }); - NotificationSender.SendCustomNotification(hashID, _parentNotifUI); } diff --git a/CollapseLauncher/Classes/InstallManagement/BaseClass/InstallManagerBase.cs b/CollapseLauncher/Classes/InstallManagement/BaseClass/InstallManagerBase.cs index aa40eb438..88b2be8cb 100644 --- a/CollapseLauncher/Classes/InstallManagement/BaseClass/InstallManagerBase.cs +++ b/CollapseLauncher/Classes/InstallManagement/BaseClass/InstallManagerBase.cs @@ -75,7 +75,7 @@ protected enum MigrateFromLauncherType { Official, BetterHi3Launcher, Steam, Unk #region Public Properties public bool IsRunning { get; protected set; } public event EventHandler FlushingTrigger; - public bool StartAfterInstall { get; set; } = false; + public bool StartAfterInstall { get; set; } #endregion public InstallManagerBase(UIElement parentUI, IGameVersionCheck GameVersionManager) diff --git a/CollapseLauncher/XAMLs/MainApp/Pages/Dialogs/SimpleDialogs.cs b/CollapseLauncher/XAMLs/MainApp/Pages/Dialogs/SimpleDialogs.cs index 474e94ed4..105a6295e 100644 --- a/CollapseLauncher/XAMLs/MainApp/Pages/Dialogs/SimpleDialogs.cs +++ b/CollapseLauncher/XAMLs/MainApp/Pages/Dialogs/SimpleDialogs.cs @@ -741,13 +741,13 @@ public static async Task> Dialog_ShortcutCreati { StackPanel panel = new StackPanel { Orientation = Orientation.Vertical, MaxWidth = 500 }; panel.Children.Add(new TextBlock { Text = Lang._Dialogs.ShortcutCreationConfirmSubtitle1, Margin = new Thickness(0, 2, 0, 4), HorizontalAlignment = HorizontalAlignment.Center }); - TextBlock pathText = new TextBlock { HorizontalAlignment = HorizontalAlignment.Center, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 4, 0, 4) }; + TextBlock pathText = new TextBlock { HorizontalAlignment = HorizontalAlignment.Center, TextWrapping = TextWrapping.WrapWholeWords, Margin = new Thickness(0, 4, 0, 4) }; pathText.Inlines.Add(new Run() { Text = path, FontWeight = FontWeights.Bold }); panel.Children.Add(pathText); - panel.Children.Add(new TextBlock { Text = Lang._Dialogs.ShortcutCreationConfirmSubtitle2, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 4, 0, 4), HorizontalAlignment = HorizontalAlignment.Center }); + panel.Children.Add(new TextBlock { Text = Lang._Dialogs.ShortcutCreationConfirmSubtitle2, TextWrapping = TextWrapping.WrapWholeWords, Margin = new Thickness(0, 4, 0, 4), HorizontalAlignment = HorizontalAlignment.Center }); CheckBox playOnLoad = new CheckBox() { - Content = new TextBlock { Text = Lang._Dialogs.ShortcutCreationConfirmCheckBox, TextWrapping = TextWrapping.Wrap }, + Content = new TextBlock { Text = Lang._Dialogs.ShortcutCreationConfirmCheckBox, TextWrapping = TextWrapping.WrapWholeWords }, Margin = new Thickness(0, 4, 0, -8), HorizontalAlignment = HorizontalAlignment.Center }; @@ -769,7 +769,7 @@ public static async Task Dialog_ShortcutCreationSuccess(UIE { StackPanel panel = new StackPanel { Orientation = Orientation.Vertical, MaxWidth = 500 }; panel.Children.Add(new TextBlock { Text = Lang._Dialogs.ShortcutCreationSuccessSubtitle1, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(0, 2, 0, 4) }); - TextBlock pathText = new TextBlock { HorizontalAlignment = HorizontalAlignment.Center, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 4, 0, 4) }; + TextBlock pathText = new TextBlock { HorizontalAlignment = HorizontalAlignment.Center, TextWrapping = TextWrapping.WrapWholeWords, Margin = new Thickness(0, 4, 0, 4) }; pathText.Inlines.Add(new Run() { Text = Lang._Dialogs.ShortcutCreationSuccessSubtitle2 }); pathText.Inlines.Add(new Run() { Text = path, FontWeight = FontWeights.Bold }); panel.Children.Add(pathText); @@ -777,8 +777,8 @@ public static async Task Dialog_ShortcutCreationSuccess(UIE if (play) { panel.Children.Add(new TextBlock { Text = Lang._Dialogs.ShortcutCreationSuccessSubtitle3, FontWeight = FontWeights.Bold, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 8, 0, 4) }); - panel.Children.Add(new TextBlock { Text = Lang._Dialogs.ShortcutCreationSuccessSubtitle4, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 2) }); - panel.Children.Add(new TextBlock { Text = Lang._Dialogs.ShortcutCreationSuccessSubtitle5, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 2) }); + panel.Children.Add(new TextBlock { Text = Lang._Dialogs.ShortcutCreationSuccessSubtitle4, TextWrapping = TextWrapping.WrapWholeWords, Margin = new Thickness(0, 2, 0, 2) }); + panel.Children.Add(new TextBlock { Text = Lang._Dialogs.ShortcutCreationSuccessSubtitle5, TextWrapping = TextWrapping.WrapWholeWords, Margin = new Thickness(0, 2, 0, 2) }); } return await SpawnDialog( @@ -794,8 +794,8 @@ public static async Task> Dialog_SteamShortcutC { StackPanel panel = new StackPanel { Orientation = Orientation.Vertical, MaxWidth = 500 }; - panel.Children.Add(new TextBlock { Text = Lang._Dialogs.SteamShortcutCreationConfirmSubtitle1, HorizontalAlignment = HorizontalAlignment.Center, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 4, 0, 2) }); - panel.Children.Add(new TextBlock { Text = Lang._Dialogs.SteamShortcutCreationConfirmSubtitle2, HorizontalAlignment = HorizontalAlignment.Center, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 4) }); + panel.Children.Add(new TextBlock { Text = Lang._Dialogs.SteamShortcutCreationConfirmSubtitle1, HorizontalAlignment = HorizontalAlignment.Center, TextWrapping = TextWrapping.WrapWholeWords, Margin = new Thickness(0, 4, 0, 2) }); + panel.Children.Add(new TextBlock { Text = Lang._Dialogs.SteamShortcutCreationConfirmSubtitle2, HorizontalAlignment = HorizontalAlignment.Center, TextWrapping = TextWrapping.WrapWholeWords, Margin = new Thickness(0, 2, 0, 4) }); CheckBox playOnLoad = new CheckBox() { @@ -820,16 +820,16 @@ public static async Task> Dialog_SteamShortcutC public static async Task Dialog_SteamShortcutCreationSuccess(UIElement Content, bool play = false) { StackPanel panel = new StackPanel { Orientation = Orientation.Vertical, MaxWidth = 500 }; - panel.Children.Add(new TextBlock { Text = Lang._Dialogs.SteamShortcutCreationSuccessSubtitle1, HorizontalAlignment = HorizontalAlignment.Center, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 4) }); - panel.Children.Add(new TextBlock { Text = Lang._Dialogs.SteamShortcutCreationSuccessSubtitle2, FontWeight = FontWeights.Bold, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 8, 0, 4) }); + panel.Children.Add(new TextBlock { Text = Lang._Dialogs.SteamShortcutCreationSuccessSubtitle1, HorizontalAlignment = HorizontalAlignment.Center, TextWrapping = TextWrapping.WrapWholeWords, Margin = new Thickness(0, 2, 0, 4) }); + panel.Children.Add(new TextBlock { Text = Lang._Dialogs.SteamShortcutCreationSuccessSubtitle2, FontWeight = FontWeights.Bold, TextWrapping = TextWrapping.WrapWholeWords, Margin = new Thickness(0, 8, 0, 4) }); if (play) { - panel.Children.Add(new TextBlock { Text = Lang._Dialogs.SteamShortcutCreationSuccessSubtitle3, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 2) }); - panel.Children.Add(new TextBlock { Text = Lang._Dialogs.SteamShortcutCreationSuccessSubtitle7, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 2) }); + panel.Children.Add(new TextBlock { Text = Lang._Dialogs.SteamShortcutCreationSuccessSubtitle3, TextWrapping = TextWrapping.WrapWholeWords, Margin = new Thickness(0, 2, 0, 2) }); + panel.Children.Add(new TextBlock { Text = Lang._Dialogs.SteamShortcutCreationSuccessSubtitle7, TextWrapping = TextWrapping.WrapWholeWords, Margin = new Thickness(0, 2, 0, 2) }); } - panel.Children.Add(new TextBlock { Text = Lang._Dialogs.SteamShortcutCreationSuccessSubtitle5, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 2) }); - panel.Children.Add(new TextBlock { Text = Lang._Dialogs.SteamShortcutCreationSuccessSubtitle4, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 2) }); - panel.Children.Add(new TextBlock { Text = Lang._Dialogs.SteamShortcutCreationSuccessSubtitle6, TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 4) }); + panel.Children.Add(new TextBlock { Text = Lang._Dialogs.SteamShortcutCreationSuccessSubtitle5, TextWrapping = TextWrapping.WrapWholeWords, Margin = new Thickness(0, 2, 0, 2) }); + panel.Children.Add(new TextBlock { Text = Lang._Dialogs.SteamShortcutCreationSuccessSubtitle4, TextWrapping = TextWrapping.WrapWholeWords, Margin = new Thickness(0, 2, 0, 2) }); + panel.Children.Add(new TextBlock { Text = Lang._Dialogs.SteamShortcutCreationSuccessSubtitle6, TextWrapping = TextWrapping.WrapWholeWords, Margin = new Thickness(0, 2, 0, 4) }); return await SpawnDialog( Lang._Dialogs.SteamShortcutCreationSuccessTitle, diff --git a/CollapseLauncher/XAMLs/MainApp/Pages/HomePage.xaml.cs b/CollapseLauncher/XAMLs/MainApp/Pages/HomePage.xaml.cs index df91d8cf5..62b06d8f7 100644 --- a/CollapseLauncher/XAMLs/MainApp/Pages/HomePage.xaml.cs +++ b/CollapseLauncher/XAMLs/MainApp/Pages/HomePage.xaml.cs @@ -1129,7 +1129,7 @@ private async void InstallGameDialog(object sender, RoutedEventArgs e) await CurrentGameProperty._GameInstall.StartPackageInstallation(); CurrentGameProperty._GameInstall.ApplyGameConfig(true); - if (CurrentGameProperty._GameInstall.StartAfterInstall) + if (CurrentGameProperty._GameInstall.StartAfterInstall && CurrentGameProperty._GameVersion.IsGameInstalled()) StartGame(null, null); } catch (TaskCanceledException) @@ -1159,6 +1159,7 @@ private async void InstallGameDialog(object sender, RoutedEventArgs e) CurrentGameProperty._GameInstall.StartAfterInstall = false; CurrentGameProperty._GameInstall.ProgressChanged -= GameInstall_ProgressChanged; CurrentGameProperty._GameInstall.StatusChanged -= GameInstall_StatusChanged; + await Task.Delay(200); CurrentGameProperty._GameInstall.Flush(); ReturnToHomePage(); } @@ -1969,7 +1970,7 @@ private async void UpdateGameDialog(object sender, RoutedEventArgs e) await CurrentGameProperty._GameInstall.StartPackageInstallation(); CurrentGameProperty._GameInstall.ApplyGameConfig(true); - if (CurrentGameProperty._GameInstall.StartAfterInstall) + if (CurrentGameProperty._GameInstall.StartAfterInstall && CurrentGameProperty._GameVersion.IsGameInstalled()) StartGame(null, null); } catch (TaskCanceledException) @@ -1998,6 +1999,7 @@ private async void UpdateGameDialog(object sender, RoutedEventArgs e) CurrentGameProperty._GameInstall.StartAfterInstall = false; CurrentGameProperty._GameInstall.ProgressChanged -= GameInstall_ProgressChanged; CurrentGameProperty._GameInstall.StatusChanged -= GameInstall_StatusChanged; + await Task.Delay(200); CurrentGameProperty._GameInstall.Flush(); ReturnToHomePage(); }