Small fixes

This commit is contained in:
Stone_Red
2024-12-28 16:40:06 +01:00
parent c2474e6425
commit 793dcbad38
2 changed files with 16 additions and 16 deletions
+8 -10
View File
@@ -73,24 +73,22 @@ public partial class App : Application
// Setup global event handler
eventWaitHandle = new EventWaitHandle(false, EventResetMode.AutoReset, AppGuid, out bool createdNew);
//check if creating new was successful
// Check if creating new was successful
if (!createdNew)
{
Setup(false);
Logger.LogWarn("Shutting down because other instance already running.", source: "Setup");
//Shutdown Application
// Shutdown Application
_ = eventWaitHandle.Set();
Current.Shutdown();
}
else
{
eventThread = new Thread(
() =>
eventThread = new Thread(() =>
{
while (eventWaitHandle.WaitOne())
{
_ = Current.Dispatcher.BeginInvoke(
() => ((MainWindow)Current.MainWindow).RestoreWindow());
_ = Current.Dispatcher.BeginInvoke(() => ((MainWindow)Current.MainWindow).RestoreWindow());
}
});
eventThread.Start();
@@ -118,22 +116,22 @@ public partial class App : Application
try
{
if (Directory.Exists(PreviousApplicationDataPath))
if (Directory.Exists(PreviousApplicationDataPath) && !Directory.Exists(ApplicationDataPath))
{
Directory.Move(PreviousApplicationDataPath, ApplicationDataPath);
Logger.LogInfo("Migrated ApplicationData Folder", source: "Setup");
Logger.LogInfo("Migrated ApplicationData folder", source: "Setup");
}
if (!Directory.Exists(ApplicationDataPath))
{
_ = Directory.CreateDirectory(ApplicationDataPath);
Logger.LogInfo("Created ApplicationData Folder", source: "Setup");
Logger.LogInfo("Created ApplicationData folder", source: "Setup");
}
if (!Directory.Exists(PluginsPath))
{
_ = Directory.CreateDirectory(PluginsPath);
Logger.LogInfo("Created Plugins Folder", source: "Setup");
Logger.LogInfo("Created Plugins folder", source: "Setup");
}
}
catch (Exception ex)
@@ -50,9 +50,11 @@ public partial class PluginWindow : Window
WindowStyle = WindowStyle.ToolWindow,
ShowInTaskbar = false
};
w.Show();
WindowInteropHelper helper = new WindowInteropHelper(w);
_ = helper.EnsureHandle();
Owner = w;
w.Hide();
settings.Theme.PropertyChanged += (e, s) => ThemeChanged();