diff --git a/FrostyPlugin/Controls/FrostyHandledExceptionBox.cs b/FrostyPlugin/Controls/FrostyHandledExceptionBox.cs new file mode 100644 index 00000000..d2dbd0f4 --- /dev/null +++ b/FrostyPlugin/Controls/FrostyHandledExceptionBox.cs @@ -0,0 +1,48 @@ +using Frosty.Controls; +using System.Windows; + +namespace Frosty.Core.Controls +{ + public class FrostyHandledExceptionBox : FrostyDockableWindow + { + #region -- Properties -- + + #region -- WarningText -- + public static readonly DependencyProperty WarningTextProperty = DependencyProperty.Register("WarningText", typeof(string), typeof(FrostyHandledExceptionBox), new PropertyMetadata("")); + public string WarningText { + get => (string)GetValue(WarningTextProperty); + set => SetValue(WarningTextProperty, value); + } + #endregion + + #endregion + + public FrostyHandledExceptionBox() + { + Title = "Warning"; + Topmost = true; + ShowInTaskbar = false; + + Height = 180; + Width = 400; + + WindowStartupLocation = WindowStartupLocation.CenterOwner; + Window mainWin = Application.Current.MainWindow; + } + + public override void OnApplyTemplate() + { + base.OnApplyTemplate(); + } + + public static MessageBoxResult Show(string warning) + { + FrostyHandledExceptionBox window = new FrostyHandledExceptionBox + { + WarningText = warning + }; + + return (window.ShowDialog() == true) ? MessageBoxResult.OK : MessageBoxResult.Cancel; + } + } +} \ No newline at end of file diff --git a/FrostyPlugin/FrostyCore.csproj b/FrostyPlugin/FrostyCore.csproj index b6a6eb23..764bab64 100644 --- a/FrostyPlugin/FrostyCore.csproj +++ b/FrostyPlugin/FrostyCore.csproj @@ -136,6 +136,7 @@ + diff --git a/FrostyPlugin/Themes/Generic.xaml b/FrostyPlugin/Themes/Generic.xaml index b8a271e0..fcc4eab6 100644 --- a/FrostyPlugin/Themes/Generic.xaml +++ b/FrostyPlugin/Themes/Generic.xaml @@ -1419,4 +1419,37 @@ + + + diff --git a/FrostyPlugin/Windows/FrostyProfileSelectWindow.xaml.cs b/FrostyPlugin/Windows/FrostyProfileSelectWindow.xaml.cs index 2d35140d..333ce15e 100644 --- a/FrostyPlugin/Windows/FrostyProfileSelectWindow.xaml.cs +++ b/FrostyPlugin/Windows/FrostyProfileSelectWindow.xaml.cs @@ -7,6 +7,7 @@ using System.Windows.Input; using System.Windows.Threading; using Frosty.Controls; +using Frosty.Core.Controls; using FrostySdk; using Microsoft.Win32; @@ -26,8 +27,15 @@ private async void ProfileSelectWindow_Loaded(object sender, RoutedEventArgs e) { RefreshConfigurationList(); - // TODO: @techdebt only call this once or when needed - await ScanGames(); + try + { + // TODO: @techdebt only call this once or when needed + await ScanGames(); + } + catch + { + FrostyHandledExceptionBox.Show("An error occurred while scanning for games.\n\nPlease manually set the game executable(s)."); + } RefreshConfigurationList(); }