mirror of
https://github.com/Stone-Red-Code/DesktopMagic.git
synced 2026-09-04 00:46:12 +02:00
Update message box style to new style
This commit is contained in:
@@ -134,7 +134,7 @@ public partial class App : Application
|
|||||||
Logger.LogFatal(exception + (e.IsTerminating ? "\t Process terminating!" : ""), source: exception.Source ?? "Unknown");
|
Logger.LogFatal(exception + (e.IsTerminating ? "\t Process terminating!" : ""), source: exception.Source ?? "Unknown");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Setup(bool clearLogFile)
|
private static async void Setup(bool clearLogFile)
|
||||||
{
|
{
|
||||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||||
|
|
||||||
@@ -160,7 +160,13 @@ public partial class App : Application
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_ = MessageBox.Show(ex.ToString(), AppName, MessageBoxButton.OK, MessageBoxImage.Error);
|
Wpf.Ui.Controls.MessageBox messageBox = new Wpf.Ui.Controls.MessageBox
|
||||||
|
{
|
||||||
|
Title = AppName,
|
||||||
|
Content = ex.ToString(),
|
||||||
|
CloseButtonText = "Ok"
|
||||||
|
};
|
||||||
|
_ = await messageBox.ShowDialogAsync();
|
||||||
Logger.Log(ex.Message, "Setup", LogSeverity.Error);
|
Logger.Log(ex.Message, "Setup", LogSeverity.Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,10 +56,10 @@
|
|||||||
<ComboBox x:Name="fontComboBox" Grid.Column="1" Grid.Row="0" HorizontalAlignment="Stretch" VerticalAlignment="Top" SelectionChanged="FontComboBox_SelectionChanged" Margin="0,0,0,5" />
|
<ComboBox x:Name="fontComboBox" Grid.Column="1" Grid.Row="0" HorizontalAlignment="Stretch" VerticalAlignment="Top" SelectionChanged="FontComboBox_SelectionChanged" Margin="0,0,0,5" />
|
||||||
|
|
||||||
<TextBlock Text="Corner Radius: " Grid.Column="0" Grid.Row="1" VerticalAlignment="Center"></TextBlock>
|
<TextBlock Text="Corner Radius: " Grid.Column="0" Grid.Row="1" VerticalAlignment="Center"></TextBlock>
|
||||||
<ui:NumberBox x:Name="cornerRadiusTextBox" Grid.Column="1" Grid.Row="1" ValueChanged="CornerRadiusTextBox_ValueChanged" PlaceholderText="Enter a number" Margin="0,0,0,5" />
|
<ui:NumberBox x:Name="cornerRadiusTextBox" Minimum="0" Grid.Column="1" Grid.Row="1" ValueChanged="CornerRadiusTextBox_ValueChanged" PlaceholderText="Enter a number" Margin="0,0,0,5" />
|
||||||
|
|
||||||
<TextBlock Text="Margin: " Grid.Column="0" Grid.Row="3" VerticalAlignment="Center"></TextBlock>
|
<TextBlock Text="Margin: " Grid.Column="0" Grid.Row="3" VerticalAlignment="Center"></TextBlock>
|
||||||
<ui:NumberBox x:Name="marginTextBox" Grid.Column="1" Grid.Row="3" ValueChanged="MarginTextBox_ValueChanged" PlaceholderText="Enter a number"/>
|
<ui:NumberBox x:Name="marginTextBox" Minimum="0" Grid.Column="1" Grid.Row="3" ValueChanged="MarginTextBox_ValueChanged" PlaceholderText="Enter a number"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid Grid.Column="1" Margin="{StaticResource DefaultMargin}" HorizontalAlignment="Stretch">
|
<Grid Grid.Column="1" Margin="{StaticResource DefaultMargin}" HorizontalAlignment="Stretch">
|
||||||
|
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ public partial class ThemeDialog : Wpf.Ui.Controls.FluentWindow
|
|||||||
|
|
||||||
private void MarginTextBox_ValueChanged(object sender, Wpf.Ui.Controls.NumberBoxValueChangedEventArgs args)
|
private void MarginTextBox_ValueChanged(object sender, Wpf.Ui.Controls.NumberBoxValueChangedEventArgs args)
|
||||||
{
|
{
|
||||||
if (args.NewValue != null)
|
if (args.NewValue is >= 0)
|
||||||
{
|
{
|
||||||
theme.Margin = (int)args.NewValue;
|
theme.Margin = (int)args.NewValue;
|
||||||
}
|
}
|
||||||
@@ -123,9 +123,9 @@ public partial class ThemeDialog : Wpf.Ui.Controls.FluentWindow
|
|||||||
|
|
||||||
private void CornerRadiusTextBox_ValueChanged(object sender, Wpf.Ui.Controls.NumberBoxValueChangedEventArgs args)
|
private void CornerRadiusTextBox_ValueChanged(object sender, Wpf.Ui.Controls.NumberBoxValueChangedEventArgs args)
|
||||||
{
|
{
|
||||||
if (args.NewValue != null)
|
if (args.NewValue is >= 0)
|
||||||
{
|
{
|
||||||
theme.Margin = (int)args.NewValue;
|
theme.CornerRadius = (int)args.NewValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -219,10 +219,16 @@ internal class SettingElementGenerator(uint pluginId)
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DisplayException(string message)
|
private async void DisplayException(string message)
|
||||||
{
|
{
|
||||||
App.Logger.LogInfo(message, source: "PluginInput");
|
App.Logger.LogInfo(message, source: "PluginInput");
|
||||||
_ = System.Windows.MessageBox.Show("File execution error:\n" + message, "Error", System.Windows.MessageBoxButton.OK, MessageBoxImage.Error);
|
Wpf.Ui.Controls.MessageBox messageBox = new Wpf.Ui.Controls.MessageBox
|
||||||
|
{
|
||||||
|
Title = "Error",
|
||||||
|
Content = "File execution error:\n" + message,
|
||||||
|
CloseButtonText = "Ok"
|
||||||
|
};
|
||||||
|
_ = await messageBox.ShowDialogAsync();
|
||||||
int index = Manager.Instance.PluginWindows.FindIndex(p => p.PluginMetadata.Id == pluginId);
|
int index = Manager.Instance.PluginWindows.FindIndex(p => p.PluginMetadata.Id == pluginId);
|
||||||
|
|
||||||
if (index >= 0 && index < Manager.Instance.PluginWindows.Count)
|
if (index >= 0 && index < Manager.Instance.PluginWindows.Count)
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Windows;
|
|
||||||
|
|
||||||
namespace DesktopMagic.Helpers;
|
namespace DesktopMagic.Helpers;
|
||||||
|
|
||||||
@@ -67,16 +66,24 @@ public static class StartupManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ToggleAutoStart()
|
public static async void ToggleAutoStart()
|
||||||
{
|
{
|
||||||
AutoStartStatus status = IsAutoStartEnabled() ? DisableAutoStart() : EnableAutoStart();
|
AutoStartStatus status = IsAutoStartEnabled() ? DisableAutoStart() : EnableAutoStart();
|
||||||
|
|
||||||
_ = status switch
|
string message = status switch
|
||||||
{
|
{
|
||||||
AutoStartStatus.Success => MessageBox.Show("Auto-start setting changed successfully."),
|
AutoStartStatus.Success => "Auto-start setting changed successfully.",
|
||||||
AutoStartStatus.AlreadyEnabled => MessageBox.Show("Auto-start is already enabled."),
|
AutoStartStatus.AlreadyEnabled => "Auto-start is already enabled.",
|
||||||
AutoStartStatus.AlreadyDisabled => MessageBox.Show("Auto-start is already disabled."),
|
AutoStartStatus.AlreadyDisabled => "Auto-start is already disabled.",
|
||||||
_ => MessageBox.Show("Failed to change auto-start setting."),
|
_ => "Failed to change auto-start setting.",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Wpf.Ui.Controls.MessageBox messageBox = new Wpf.Ui.Controls.MessageBox
|
||||||
|
{
|
||||||
|
Title = App.AppName,
|
||||||
|
Content = message,
|
||||||
|
CloseButtonText = "Ok"
|
||||||
|
};
|
||||||
|
_ = await messageBox.ShowDialogAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -22,13 +22,12 @@ public partial class MainWindow : FluentWindow
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
DataContext = _mainWindowDataContext;
|
DataContext = _mainWindowDataContext;
|
||||||
_mainWindowDataContext.Settings = _manager.Settings;
|
|
||||||
|
|
||||||
Resources.MergedDictionaries.Add(App.LanguageDictionary);
|
Resources.MergedDictionaries.Add(App.LanguageDictionary);
|
||||||
App.DialogService.SetDialogHost(rootContentDialog);
|
App.DialogService.SetDialogHost(rootContentDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
private async void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -37,8 +36,9 @@ public partial class MainWindow : FluentWindow
|
|||||||
_mainWindowDataContext.IsLoading = true;
|
_mainWindowDataContext.IsLoading = true;
|
||||||
|
|
||||||
// Load plugins and settings through manager
|
// Load plugins and settings through manager
|
||||||
_manager.LoadPlugins();
|
|
||||||
_manager.LoadSettings();
|
_manager.LoadSettings();
|
||||||
|
_mainWindowDataContext.Settings = _manager.Settings;
|
||||||
|
_manager.LoadPlugins();
|
||||||
_manager.LoadLayout();
|
_manager.LoadLayout();
|
||||||
|
|
||||||
_manager.IsLoaded = true;
|
_manager.IsLoaded = true;
|
||||||
@@ -49,7 +49,13 @@ public partial class MainWindow : FluentWindow
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
App.Logger.LogError(ex.Message, source: "MainWindow");
|
App.Logger.LogError(ex.Message, source: "MainWindow");
|
||||||
_ = System.Windows.MessageBox.Show(ex.ToString(), App.AppName, System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error);
|
Wpf.Ui.Controls.MessageBox messageBox = new Wpf.Ui.Controls.MessageBox
|
||||||
|
{
|
||||||
|
Title = App.AppName,
|
||||||
|
Content = ex.ToString(),
|
||||||
|
CloseButtonText = "Ok"
|
||||||
|
};
|
||||||
|
_ = await messageBox.ShowDialogAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ public sealed class Manager
|
|||||||
_plugins.Clear();
|
_plugins.Clear();
|
||||||
|
|
||||||
// Load built-in plugins
|
// Load built-in plugins
|
||||||
foreach (var builtInPlugin in _builtInPlugins.Keys)
|
foreach (PluginMetadata builtInPlugin in _builtInPlugins.Keys)
|
||||||
{
|
{
|
||||||
_plugins.Add(builtInPlugin.Id, new(builtInPlugin, PluginType.DotNet, string.Empty));
|
_plugins.Add(builtInPlugin.Id, new(builtInPlugin, PluginType.DotNet, string.Empty));
|
||||||
}
|
}
|
||||||
@@ -318,7 +318,7 @@ public sealed class Manager
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove plugins that are not loaded anymore
|
// Remove plugins that are not loaded anymore
|
||||||
var pluginIdsToRemove = Settings.CurrentLayout.Plugins.Keys.Where(id => !_plugins.ContainsKey(id)).ToList();
|
List<uint> pluginIdsToRemove = Settings.CurrentLayout.Plugins.Keys.Where(id => !_plugins.ContainsKey(id)).ToList();
|
||||||
foreach (uint pluginId in pluginIdsToRemove)
|
foreach (uint pluginId in pluginIdsToRemove)
|
||||||
{
|
{
|
||||||
Settings.CurrentLayout.Plugins.Remove(pluginId);
|
Settings.CurrentLayout.Plugins.Remove(pluginId);
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ public partial class MainPage : Page
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NewLayoutButton_Click(object sender, RoutedEventArgs e)
|
private async void NewLayoutButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
InputDialog inputDialog = new((string)FindResource("enterLayoutName"))
|
InputDialog inputDialog = new((string)FindResource("enterLayoutName"))
|
||||||
{
|
{
|
||||||
@@ -150,7 +150,13 @@ public partial class MainPage : Page
|
|||||||
{
|
{
|
||||||
if (_manager.Settings.Layouts.Any(l => l.Name.Trim() == inputDialog.ResponseText.Trim()))
|
if (_manager.Settings.Layouts.Any(l => l.Name.Trim() == inputDialog.ResponseText.Trim()))
|
||||||
{
|
{
|
||||||
_ = System.Windows.MessageBox.Show((string)FindResource("layoutAlreadyExists"), App.AppName, MessageBoxButton.OK, MessageBoxImage.Warning);
|
Wpf.Ui.Controls.MessageBox messageBox = new Wpf.Ui.Controls.MessageBox
|
||||||
|
{
|
||||||
|
Title = App.AppName,
|
||||||
|
Content = (string)FindResource("layoutAlreadyExists"),
|
||||||
|
CloseButtonText = "Ok"
|
||||||
|
};
|
||||||
|
_ = await messageBox.ShowDialogAsync();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,16 +174,30 @@ public partial class MainPage : Page
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RemoveLayoutButton_Click(object sender, RoutedEventArgs e)
|
private async void RemoveLayoutButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (_manager.Settings.Layouts.Count <= 1)
|
if (_manager.Settings.Layouts.Count <= 1)
|
||||||
{
|
{
|
||||||
_ = System.Windows.MessageBox.Show((string)FindResource("cannotDeleteLastLayout"), App.AppName, MessageBoxButton.OK, MessageBoxImage.Warning);
|
Wpf.Ui.Controls.MessageBox cannotDeleteMessageBox = new Wpf.Ui.Controls.MessageBox
|
||||||
|
{
|
||||||
|
Title = App.AppName,
|
||||||
|
Content = (string)FindResource("cannotDeleteLastLayout"),
|
||||||
|
CloseButtonText = "Ok"
|
||||||
|
};
|
||||||
|
_ = await cannotDeleteMessageBox.ShowDialogAsync();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageBoxResult result = System.Windows.MessageBox.Show((string)FindResource("confirmDeleteLayout"), App.AppName, MessageBoxButton.YesNo, MessageBoxImage.Question);
|
var messageBox = new Wpf.Ui.Controls.MessageBox
|
||||||
if (result != MessageBoxResult.Yes)
|
{
|
||||||
|
Title = App.AppName,
|
||||||
|
Content = (string)FindResource("confirmDeleteLayout"),
|
||||||
|
PrimaryButtonText = "Yes",
|
||||||
|
SecondaryButtonText = "No",
|
||||||
|
IsCloseButtonEnabled = false
|
||||||
|
};
|
||||||
|
Wpf.Ui.Controls.MessageBoxResult result = await messageBox.ShowDialogAsync();
|
||||||
|
if (result != Wpf.Ui.Controls.MessageBoxResult.Primary) // Primary is "Yes"
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -217,7 +237,7 @@ public partial class MainPage : Page
|
|||||||
// s.Input being null means the plugins has not been loaded yet but the settings are present in the saved configuration.
|
// s.Input being null means the plugins has not been loaded yet but the settings are present in the saved configuration.
|
||||||
if (pluginSettings is null || pluginSettings.Settings.Count == 0 || pluginSettings.Settings.All(s => s.Input is null))
|
if (pluginSettings is null || pluginSettings.Settings.Count == 0 || pluginSettings.Settings.All(s => s.Input is null))
|
||||||
{
|
{
|
||||||
_ = optionsPanel.Children.Add(new TextBlock()
|
_ = optionsPanel.Children.Add(new System.Windows.Controls.TextBlock()
|
||||||
{
|
{
|
||||||
Text = (string)FindResource(pluginSettings?.Enabled == true ? "noOptions" : "enablePluginToConfigure")
|
Text = (string)FindResource(pluginSettings?.Enabled == true ? "noOptions" : "enablePluginToConfigure")
|
||||||
});
|
});
|
||||||
@@ -235,7 +255,7 @@ public partial class MainPage : Page
|
|||||||
Padding = new Thickness(5)
|
Padding = new Thickness(5)
|
||||||
};
|
};
|
||||||
|
|
||||||
TextBlock textBlock = new()
|
System.Windows.Controls.TextBlock textBlock = new()
|
||||||
{
|
{
|
||||||
Text = string.IsNullOrWhiteSpace(settingElement.Name) ? string.Empty : settingElement.Name,
|
Text = string.IsNullOrWhiteSpace(settingElement.Name) ? string.Empty : settingElement.Name,
|
||||||
Padding = new Thickness(0, 0, 3, 0),
|
Padding = new Thickness(0, 0, 3, 0),
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public partial class ThemePage : Page
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddThemeButton_Click(object sender, RoutedEventArgs e)
|
private async void AddThemeButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
InputDialog inputDialog = new((string)FindResource("enterThemeName"))
|
InputDialog inputDialog = new((string)FindResource("enterThemeName"))
|
||||||
{
|
{
|
||||||
@@ -58,7 +58,13 @@ public partial class ThemePage : Page
|
|||||||
{
|
{
|
||||||
if (_manager.Settings.Themes.Any(l => l.Name.Trim() == inputDialog.ResponseText.Trim()))
|
if (_manager.Settings.Themes.Any(l => l.Name.Trim() == inputDialog.ResponseText.Trim()))
|
||||||
{
|
{
|
||||||
_ = System.Windows.MessageBox.Show((string)FindResource("themeAlreadyExists"), App.AppName, MessageBoxButton.OK, MessageBoxImage.Warning);
|
Wpf.Ui.Controls.MessageBox messageBox = new Wpf.Ui.Controls.MessageBox
|
||||||
|
{
|
||||||
|
Title = App.AppName,
|
||||||
|
Content = (string)FindResource("themeAlreadyExists"),
|
||||||
|
CloseButtonText = "Ok"
|
||||||
|
};
|
||||||
|
_ = await messageBox.ShowDialogAsync();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,16 +74,30 @@ public partial class ThemePage : Page
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeleteThemeButton_Click(object sender, RoutedEventArgs e)
|
private async void DeleteThemeButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (_manager.Settings.Themes.Count <= 1)
|
if (_manager.Settings.Themes.Count <= 1)
|
||||||
{
|
{
|
||||||
_ = System.Windows.MessageBox.Show((string)FindResource("cannotDeleteLastTheme"), App.AppName, MessageBoxButton.OK, MessageBoxImage.Warning);
|
Wpf.Ui.Controls.MessageBox cannotDeleteMessageBox = new Wpf.Ui.Controls.MessageBox
|
||||||
|
{
|
||||||
|
Title = App.AppName,
|
||||||
|
Content = (string)FindResource("cannotDeleteLastTheme"),
|
||||||
|
CloseButtonText = "Ok"
|
||||||
|
};
|
||||||
|
_ = await cannotDeleteMessageBox.ShowDialogAsync();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageBoxResult result = System.Windows.MessageBox.Show((string)FindResource("confirmDeleteTheme"), App.AppName, MessageBoxButton.YesNo, MessageBoxImage.Question);
|
var messageBox = new Wpf.Ui.Controls.MessageBox
|
||||||
if (result != MessageBoxResult.Yes)
|
{
|
||||||
|
Title = App.AppName,
|
||||||
|
Content = (string)FindResource("confirmDeleteTheme"),
|
||||||
|
PrimaryButtonText = "Yes",
|
||||||
|
SecondaryButtonText = "No",
|
||||||
|
IsCloseButtonEnabled = false
|
||||||
|
};
|
||||||
|
Wpf.Ui.Controls.MessageBoxResult result = await messageBox.ShowDialogAsync();
|
||||||
|
if (result != Wpf.Ui.Controls.MessageBoxResult.Primary) // Primary is "Yes"
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -91,7 +111,7 @@ public partial class ThemePage : Page
|
|||||||
|
|
||||||
private void EditThemeButton_Click(object sender, RoutedEventArgs e)
|
private void EditThemeButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is not Button button || button.Tag is not Theme theme)
|
if (sender is not System.Windows.Controls.Button button || button.Tag is not Theme theme)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ using DesktopMagic.Settings;
|
|||||||
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
|
||||||
|
using Wpf.Ui.Controls;
|
||||||
|
|
||||||
namespace DesktopMagic.Plugins;
|
namespace DesktopMagic.Plugins;
|
||||||
|
|
||||||
internal class PluginData(PluginWindow window, PluginSettings pluginSettings) : IPluginData
|
internal class PluginData(PluginWindow window, PluginSettings pluginSettings) : IPluginData
|
||||||
@@ -38,7 +40,7 @@ internal class PluginData(PluginWindow window, PluginSettings pluginSettings) :
|
|||||||
{
|
{
|
||||||
title ??= PluginName;
|
title ??= PluginName;
|
||||||
|
|
||||||
window.Dispatcher.Invoke(() =>
|
_ = window.Dispatcher.Invoke(async () =>
|
||||||
{
|
{
|
||||||
System.Windows.Window temporaryOwner = new()
|
System.Windows.Window temporaryOwner = new()
|
||||||
{
|
{
|
||||||
@@ -51,7 +53,14 @@ internal class PluginData(PluginWindow window, PluginSettings pluginSettings) :
|
|||||||
|
|
||||||
temporaryOwner.Show();
|
temporaryOwner.Show();
|
||||||
|
|
||||||
_ = System.Windows.MessageBox.Show(temporaryOwner, message, $"{App.AppName} - {title}");
|
MessageBox messageBox = new Wpf.Ui.Controls.MessageBox
|
||||||
|
{
|
||||||
|
Owner = temporaryOwner,
|
||||||
|
Title = $"{App.AppName} - {title}",
|
||||||
|
Content = message,
|
||||||
|
CloseButtonText = "Ok"
|
||||||
|
};
|
||||||
|
_ = await messageBox.ShowDialogAsync();
|
||||||
|
|
||||||
temporaryOwner.Close();
|
temporaryOwner.Close();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -191,7 +191,13 @@ public partial class PluginManager : Page
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_ = MessageBox.Show(ex.Message, "Plugin Manager", MessageBoxButton.OK, MessageBoxImage.Error);
|
Wpf.Ui.Controls.MessageBox messageBox = new Wpf.Ui.Controls.MessageBox
|
||||||
|
{
|
||||||
|
Title = "Plugin Manager",
|
||||||
|
Content = ex.Message,
|
||||||
|
CloseButtonText = "Ok"
|
||||||
|
};
|
||||||
|
_ = await messageBox.ShowDialogAsync();
|
||||||
App.Logger.LogError(ex.Message, source: "PluginManager");
|
App.Logger.LogError(ex.Message, source: "PluginManager");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -261,9 +267,15 @@ public partial class PluginManager : Page
|
|||||||
if (!File.Exists(Path.Combine(pluginPath, "main.dll")) && !File.Exists(Path.Combine(pluginPath, "main.html")))
|
if (!File.Exists(Path.Combine(pluginPath, "main.dll")) && !File.Exists(Path.Combine(pluginPath, "main.html")))
|
||||||
{
|
{
|
||||||
App.Logger.LogError($"Plugin {mod.Id} does not contain main.dll or main.html", source: "PluginManager");
|
App.Logger.LogError($"Plugin {mod.Id} does not contain main.dll or main.html", source: "PluginManager");
|
||||||
_ = Remove(pluginPath, mod.Id);
|
await Remove(pluginPath, mod.Id);
|
||||||
pluginManagerDataContext.IsLoading = false;
|
pluginManagerDataContext.IsLoading = false;
|
||||||
_ = MessageBox.Show("The plugin you are trying to install does not contain a \"main.dll\" or \"main.html\" file. Please contact the plugin author.", "Plugin Manager", MessageBoxButton.OK, MessageBoxImage.Error);
|
Wpf.Ui.Controls.MessageBox messageBox = new Wpf.Ui.Controls.MessageBox
|
||||||
|
{
|
||||||
|
Title = "Plugin Manager",
|
||||||
|
Content = "The plugin you are trying to install does not contain a \"main.dll\" or \"main.html\" file. Please contact the plugin author.",
|
||||||
|
CloseButtonText = "Ok"
|
||||||
|
};
|
||||||
|
_ = await messageBox.ShowDialogAsync();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,7 +305,13 @@ public partial class PluginManager : Page
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
App.Logger.LogError($"Failed to install plugin {mod.Id}: {ex.Message}", source: "PluginManager");
|
App.Logger.LogError($"Failed to install plugin {mod.Id}: {ex.Message}", source: "PluginManager");
|
||||||
_ = MessageBox.Show($"Failed to install plugin: {ex.Message}", "Plugin Manager", MessageBoxButton.OK, MessageBoxImage.Error);
|
Wpf.Ui.Controls.MessageBox messageBox = new Wpf.Ui.Controls.MessageBox
|
||||||
|
{
|
||||||
|
Title = "Plugin Manager",
|
||||||
|
Content = $"Failed to install plugin: {ex.Message}",
|
||||||
|
CloseButtonText = "Ok"
|
||||||
|
};
|
||||||
|
_ = await messageBox.ShowDialogAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
pluginManagerDataContext.IsLoading = false;
|
pluginManagerDataContext.IsLoading = false;
|
||||||
@@ -370,27 +388,39 @@ public partial class PluginManager : Page
|
|||||||
pluginManagerDataContext.IsSearching = false;
|
pluginManagerDataContext.IsSearching = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreatePluginButton_Click(object sender, RoutedEventArgs e)
|
private async void CreatePluginButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
CreateNewPlugin();
|
await CreateNewPlugin();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
App.Logger.LogError(ex.Message, source: "PluginManager");
|
App.Logger.LogError(ex.Message, source: "PluginManager");
|
||||||
_ = MessageBox.Show(ex.Message, "Plugin Manager", MessageBoxButton.OK, MessageBoxImage.Error);
|
Wpf.Ui.Controls.MessageBox messageBox = new Wpf.Ui.Controls.MessageBox
|
||||||
|
{
|
||||||
|
Title = "Plugin Manager",
|
||||||
|
Content = ex.Message,
|
||||||
|
CloseButtonText = "Ok"
|
||||||
|
};
|
||||||
|
_ = await messageBox.ShowDialogAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreateNewPlugin()
|
private async Task CreateNewPlugin()
|
||||||
{
|
{
|
||||||
App.Logger.LogInfo("Creating new plugin", source: "PluginManager");
|
App.Logger.LogInfo("Creating new plugin", source: "PluginManager");
|
||||||
|
|
||||||
if (!FileUtilities.ExistsOnPath("dotnet.exe"))
|
if (!FileUtilities.ExistsOnPath("dotnet.exe"))
|
||||||
{
|
{
|
||||||
App.Logger.LogError(".NET SDK not found on PATH", source: "PluginManager");
|
App.Logger.LogError(".NET SDK not found on PATH", source: "PluginManager");
|
||||||
_ = MessageBox.Show("The .NET SDK is required to create a plugin. Please install it and try again.", "Plugin Manager", MessageBoxButton.OK, MessageBoxImage.Error);
|
Wpf.Ui.Controls.MessageBox messageBox = new Wpf.Ui.Controls.MessageBox
|
||||||
|
{
|
||||||
|
Title = "Plugin Manager",
|
||||||
|
Content = "The .NET SDK is required to create a plugin. Please install it and try again.",
|
||||||
|
CloseButtonText = "Ok"
|
||||||
|
};
|
||||||
|
_ = await messageBox.ShowDialogAsync();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -428,7 +458,13 @@ public partial class PluginManager : Page
|
|||||||
if (Directory.Exists(pluginProjectPath))
|
if (Directory.Exists(pluginProjectPath))
|
||||||
{
|
{
|
||||||
App.Logger.LogWarn($"Plugin project already exists: {pluginProjectPath}", source: "PluginManager");
|
App.Logger.LogWarn($"Plugin project already exists: {pluginProjectPath}", source: "PluginManager");
|
||||||
_ = MessageBox.Show("A plugin with the same name already exists. Please choose a different name.", "Plugin Manager", MessageBoxButton.OK, MessageBoxImage.Error);
|
Wpf.Ui.Controls.MessageBox messageBox = new Wpf.Ui.Controls.MessageBox
|
||||||
|
{
|
||||||
|
Title = "Plugin Manager",
|
||||||
|
Content = "A plugin with the same name already exists. Please choose a different name.",
|
||||||
|
CloseButtonText = "Ok"
|
||||||
|
};
|
||||||
|
_ = await messageBox.ShowDialogAsync();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -524,7 +560,13 @@ public class {pluginSafeName}Plugin : Plugin
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
App.Logger.LogError("PropertyGroup element not found in .csproj", source: "PluginManager");
|
App.Logger.LogError("PropertyGroup element not found in .csproj", source: "PluginManager");
|
||||||
_ = MessageBox.Show("PropertyGroup element not found in .csproj", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
Wpf.Ui.Controls.MessageBox messageBox = new Wpf.Ui.Controls.MessageBox
|
||||||
|
{
|
||||||
|
Title = "Error",
|
||||||
|
Content = "PropertyGroup element not found in .csproj",
|
||||||
|
CloseButtonText = "Ok"
|
||||||
|
};
|
||||||
|
_ = await messageBox.ShowDialogAsync();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -622,7 +664,13 @@ public class {pluginSafeName}Plugin : Plugin
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
App.Logger.LogError($"Authentication failed: {ex.Message}", source: "PluginManager");
|
App.Logger.LogError($"Authentication failed: {ex.Message}", source: "PluginManager");
|
||||||
_ = MessageBox.Show(ex.Message, "Plugin Manager", MessageBoxButton.OK, MessageBoxImage.Error);
|
Wpf.Ui.Controls.MessageBox messageBox = new Wpf.Ui.Controls.MessageBox
|
||||||
|
{
|
||||||
|
Title = "Plugin Manager",
|
||||||
|
Content = ex.Message,
|
||||||
|
CloseButtonText = "Ok"
|
||||||
|
};
|
||||||
|
_ = await messageBox.ShowDialogAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
pluginManagerDataContext.IsLoading = false;
|
pluginManagerDataContext.IsLoading = false;
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ using System.Reflection;
|
|||||||
using System.Runtime.Loader;
|
using System.Runtime.Loader;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
@@ -72,6 +73,11 @@ public partial class PluginWindow : Window, IPluginWindow
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
settings.Theme.PropertyChanged += (se, ev) =>
|
||||||
|
{
|
||||||
|
ThemeChanged();
|
||||||
|
};
|
||||||
|
|
||||||
PluginMetadata = pluginMetadata;
|
PluginMetadata = pluginMetadata;
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
|
|
||||||
@@ -183,18 +189,24 @@ public partial class PluginWindow : Window, IPluginWindow
|
|||||||
private void Window_ContentRendered(object? sender, EventArgs e)
|
private void Window_ContentRendered(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
App.Logger.LogInfo($"\"{PluginMetadata.Name}\" - Starting plugin thread", source: "Plugin");
|
App.Logger.LogInfo($"\"{PluginMetadata.Name}\" - Starting plugin thread", source: "Plugin");
|
||||||
pluginThread = new Thread(LoadPlugin);
|
pluginThread = new Thread(async () => await LoadPlugin());
|
||||||
pluginThread.Start();
|
pluginThread.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadPlugin()
|
private async Task LoadPlugin()
|
||||||
{
|
{
|
||||||
App.Logger.LogInfo($"\"{PluginMetadata.Name}\" - Loading plugin", source: "Plugin");
|
App.Logger.LogInfo($"\"{PluginMetadata.Name}\" - Loading plugin", source: "Plugin");
|
||||||
|
|
||||||
if (pluginClassInstance is null && !File.Exists($"{PluginFolderPath}\\main.dll"))
|
if (pluginClassInstance is null && !File.Exists($"{PluginFolderPath}\\main.dll"))
|
||||||
{
|
{
|
||||||
App.Logger.LogError($"\"{PluginMetadata.Name}\" - File \"main.dll\" does not exist", source: "Plugin");
|
App.Logger.LogError($"\"{PluginMetadata.Name}\" - File \"main.dll\" does not exist", source: "Plugin");
|
||||||
_ = MessageBox.Show("File \"main.dll\" does not exist!", $"Error \"{PluginMetadata.Name}\"", MessageBoxButton.OK, MessageBoxImage.Error);
|
Wpf.Ui.Controls.MessageBox messageBox = new Wpf.Ui.Controls.MessageBox
|
||||||
|
{
|
||||||
|
Title = $"Error \"{PluginMetadata.Name}\"",
|
||||||
|
Content = "File \"main.dll\" does not exist!",
|
||||||
|
CloseButtonText = "Ok"
|
||||||
|
};
|
||||||
|
_ = await messageBox.ShowDialogAsync();
|
||||||
|
|
||||||
Exit();
|
Exit();
|
||||||
return;
|
return;
|
||||||
@@ -202,18 +214,24 @@ public partial class PluginWindow : Window, IPluginWindow
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ExecuteSource();
|
await ExecuteSource();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
App.Logger.LogError($"\"{PluginMetadata.Name}\" - {ex}", source: "Plugin");
|
App.Logger.LogError($"\"{PluginMetadata.Name}\" - {ex}", source: "Plugin");
|
||||||
_ = MessageBox.Show("File execution error:\n" + ex, $"Error \"{PluginMetadata.Name}\"", MessageBoxButton.OK, MessageBoxImage.Error);
|
Wpf.Ui.Controls.MessageBox messageBox = new Wpf.Ui.Controls.MessageBox
|
||||||
|
{
|
||||||
|
Title = $"Error \"{PluginMetadata.Name}\"",
|
||||||
|
Content = "File execution error:\n" + ex,
|
||||||
|
CloseButtonText = "Ok"
|
||||||
|
};
|
||||||
|
_ = await messageBox.ShowDialogAsync();
|
||||||
Exit();
|
Exit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PluginLoaded?.Invoke();
|
PluginLoaded?.Invoke();
|
||||||
|
|
||||||
_ = Dispatcher.Invoke(() => busyMask.IsBusy = false);
|
_ = await Dispatcher.InvokeAsync(() => busyMask.IsBusy = false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ThemeChanged()
|
private void ThemeChanged()
|
||||||
@@ -230,7 +248,7 @@ public partial class PluginWindow : Window, IPluginWindow
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ExecuteSource()
|
private async Task ExecuteSource()
|
||||||
{
|
{
|
||||||
object? instance = pluginClassInstance;
|
object? instance = pluginClassInstance;
|
||||||
if (instance is null)
|
if (instance is null)
|
||||||
@@ -239,7 +257,7 @@ public partial class PluginWindow : Window, IPluginWindow
|
|||||||
|
|
||||||
if (PluginMetadata.SupportsUnloading)
|
if (PluginMetadata.SupportsUnloading)
|
||||||
{
|
{
|
||||||
byte[] assemblyData = File.ReadAllBytes($"{PluginFolderPath}\\main.dll");
|
byte[] assemblyData = await File.ReadAllBytesAsync($"{PluginFolderPath}\\main.dll");
|
||||||
using MemoryStream assemblyStream = new(assemblyData);
|
using MemoryStream assemblyStream = new(assemblyData);
|
||||||
|
|
||||||
dll = assemblyLoadContext.LoadFromStream(assemblyStream);
|
dll = assemblyLoadContext.LoadFromStream(assemblyStream);
|
||||||
@@ -254,8 +272,13 @@ public partial class PluginWindow : Window, IPluginWindow
|
|||||||
if (instanceType is null)
|
if (instanceType is null)
|
||||||
{
|
{
|
||||||
App.Logger.LogError($"\"{PluginMetadata.Name}\" - The \"Plugin\" class could not be found! It has to inherit from \"{typeof(Plugin).FullName}\"", source: "Plugin");
|
App.Logger.LogError($"\"{PluginMetadata.Name}\" - The \"Plugin\" class could not be found! It has to inherit from \"{typeof(Plugin).FullName}\"", source: "Plugin");
|
||||||
_ = MessageBox.Show($"The \"Plugin\" class could not be found! It has to inherit from \"{typeof(Plugin).FullName}\"", $"Error \"{PluginMetadata.Name}\"", MessageBoxButton.OK, MessageBoxImage.Error);
|
Wpf.Ui.Controls.MessageBox messageBox = new Wpf.Ui.Controls.MessageBox
|
||||||
|
{
|
||||||
|
Title = $"Error \"{PluginMetadata.Name}\"",
|
||||||
|
Content = $"The \"Plugin\" class could not be found! It has to inherit from \"{typeof(Plugin).FullName}\"",
|
||||||
|
CloseButtonText = "Ok"
|
||||||
|
};
|
||||||
|
_ = await messageBox.ShowDialogAsync();
|
||||||
Exit();
|
Exit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -270,13 +293,19 @@ public partial class PluginWindow : Window, IPluginWindow
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
App.Logger.LogError($"\"{PluginMetadata.Name}\" - The \"Plugin\" class could not be found! It has to inherit from \"{typeof(Plugin).FullName}\"", source: "Plugin");
|
App.Logger.LogError($"\"{PluginMetadata.Name}\" - The \"Plugin\" class could not be found! It has to inherit from \"{typeof(Plugin).FullName}\"", source: "Plugin");
|
||||||
_ = MessageBox.Show($"The \"Plugin\" class has to inherit from \"{typeof(Plugin).FullName}\"", $"Error \"{PluginMetadata.Name}\"", MessageBoxButton.OK, MessageBoxImage.Error);
|
Wpf.Ui.Controls.MessageBox messageBox = new Wpf.Ui.Controls.MessageBox
|
||||||
|
{
|
||||||
|
Title = $"Error \"{PluginMetadata.Name}\"",
|
||||||
|
Content = $"The \"Plugin\" class has to inherit from \"{typeof(Plugin).FullName}\"",
|
||||||
|
CloseButtonText = "Ok"
|
||||||
|
};
|
||||||
|
_ = await messageBox.ShowDialogAsync();
|
||||||
Exit();
|
Exit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadState(pluginClassInstance);
|
LoadState(pluginClassInstance);
|
||||||
LoadOptions(pluginClassInstance);
|
await LoadOptions(pluginClassInstance);
|
||||||
BindDefaultSettings(pluginClassInstance);
|
BindDefaultSettings(pluginClassInstance);
|
||||||
|
|
||||||
updateTimer = new System.Timers.Timer
|
updateTimer = new System.Timers.Timer
|
||||||
@@ -287,7 +316,7 @@ public partial class PluginWindow : Window, IPluginWindow
|
|||||||
|
|
||||||
pluginClassInstance.Start();
|
pluginClassInstance.Start();
|
||||||
UpdatePluginWindow();
|
UpdatePluginWindow();
|
||||||
Dispatcher.Invoke(ThemeChanged);
|
await Dispatcher.InvokeAsync(ThemeChanged);
|
||||||
|
|
||||||
if (pluginClassInstance.UpdateInterval > 0)
|
if (pluginClassInstance.UpdateInterval > 0)
|
||||||
{
|
{
|
||||||
@@ -367,7 +396,7 @@ public partial class PluginWindow : Window, IPluginWindow
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadOptions(object instance)
|
private async Task LoadOptions(object instance)
|
||||||
{
|
{
|
||||||
App.Logger.LogInfo($"\"{PluginMetadata.Name}\" - Loading plugin options", source: "Plugin");
|
App.Logger.LogInfo($"\"{PluginMetadata.Name}\" - Loading plugin options", source: "Plugin");
|
||||||
|
|
||||||
@@ -418,7 +447,13 @@ public partial class PluginWindow : Window, IPluginWindow
|
|||||||
{
|
{
|
||||||
IsRunning = false;
|
IsRunning = false;
|
||||||
App.Logger.LogError($"\"{PluginMetadata.Name}\" - {ex}", source: "Plugin");
|
App.Logger.LogError($"\"{PluginMetadata.Name}\" - {ex}", source: "Plugin");
|
||||||
_ = MessageBox.Show("File execution error:\n" + ex, $"Error \"{PluginMetadata.Name}\"", MessageBoxButton.OK, MessageBoxImage.Error);
|
Wpf.Ui.Controls.MessageBox messageBox = new Wpf.Ui.Controls.MessageBox
|
||||||
|
{
|
||||||
|
Title = $"Error \"{PluginMetadata.Name}\"",
|
||||||
|
Content = "File execution error:\n" + ex,
|
||||||
|
CloseButtonText = "Ok"
|
||||||
|
};
|
||||||
|
_ = await messageBox.ShowDialogAsync();
|
||||||
Exit();
|
Exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -608,7 +643,13 @@ public partial class PluginWindow : Window, IPluginWindow
|
|||||||
{
|
{
|
||||||
IsRunning = false;
|
IsRunning = false;
|
||||||
App.Logger.LogError($"\"{PluginMetadata.Name}\" - {ex}", source: "Plugin");
|
App.Logger.LogError($"\"{PluginMetadata.Name}\" - {ex}", source: "Plugin");
|
||||||
_ = MessageBox.Show("File execution error:\n" + ex, $"Error \"{PluginMetadata.Name}\"", MessageBoxButton.OK, MessageBoxImage.Error);
|
Wpf.Ui.Controls.MessageBox messageBox = new Wpf.Ui.Controls.MessageBox
|
||||||
|
{
|
||||||
|
Title = $"Error \"{PluginMetadata.Name}\"",
|
||||||
|
Content = "File execution error:\n" + ex,
|
||||||
|
CloseButtonText = "Ok"
|
||||||
|
};
|
||||||
|
_ = await messageBox.ShowDialogAsync();
|
||||||
Exit();
|
Exit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,6 +57,11 @@ public partial class WebPluginWindow : Window, IPluginWindow
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
settings.Theme.PropertyChanged += (se, ev) =>
|
||||||
|
{
|
||||||
|
ThemeChanged();
|
||||||
|
};
|
||||||
|
|
||||||
PluginMetadata = pluginMetadata;
|
PluginMetadata = pluginMetadata;
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
|
|
||||||
@@ -122,7 +127,13 @@ public partial class WebPluginWindow : Window, IPluginWindow
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
App.Logger.LogError($"\"{PluginMetadata.Name}\" - {ex}", source: "WebPlugin");
|
App.Logger.LogError($"\"{PluginMetadata.Name}\" - {ex}", source: "WebPlugin");
|
||||||
_ = MessageBox.Show("WebView2 initialization error:\n" + ex, $"Error \"{PluginMetadata.Name}\"", MessageBoxButton.OK, MessageBoxImage.Error);
|
Wpf.Ui.Controls.MessageBox messageBox = new Wpf.Ui.Controls.MessageBox
|
||||||
|
{
|
||||||
|
Title = $"Error \"{PluginMetadata.Name}\"",
|
||||||
|
Content = "WebView2 initialization error:\n" + ex,
|
||||||
|
CloseButtonText = "Ok"
|
||||||
|
};
|
||||||
|
_ = await messageBox.ShowDialogAsync();
|
||||||
Exit();
|
Exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -169,7 +180,13 @@ public partial class WebPluginWindow : Window, IPluginWindow
|
|||||||
if (!File.Exists(htmlPath))
|
if (!File.Exists(htmlPath))
|
||||||
{
|
{
|
||||||
App.Logger.LogError($"\"{PluginMetadata.Name}\" - File \"main.html\" does not exist", source: "WebPlugin");
|
App.Logger.LogError($"\"{PluginMetadata.Name}\" - File \"main.html\" does not exist", source: "WebPlugin");
|
||||||
_ = MessageBox.Show("File \"main.html\" does not exist!", $"Error \"{PluginMetadata.Name}\"", MessageBoxButton.OK, MessageBoxImage.Error);
|
Wpf.Ui.Controls.MessageBox messageBox = new Wpf.Ui.Controls.MessageBox
|
||||||
|
{
|
||||||
|
Title = $"Error \"{PluginMetadata.Name}\"",
|
||||||
|
Content = "File \"main.html\" does not exist!",
|
||||||
|
CloseButtonText = "Ok"
|
||||||
|
};
|
||||||
|
_ = await messageBox.ShowDialogAsync();
|
||||||
Exit();
|
Exit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user