mirror of
https://github.com/Stone-Red-Code/DesktopMagic.git
synced 2026-09-04 08:56:15 +02:00
Small fixes
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user