mirror of
https://github.com/Stone-Red-Code/DesktopMagic.git
synced 2026-09-04 08:56:15 +02:00
Only show main window on first run, regardless of if plugins are enabled
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
MinHeight="600"
|
MinHeight="600"
|
||||||
MinWidth="940"
|
MinWidth="940"
|
||||||
ExtendsContentIntoTitleBar="True"
|
ExtendsContentIntoTitleBar="True"
|
||||||
WindowState="Minimized"
|
WindowState="Normal"
|
||||||
Loaded="Window_Loaded">
|
Loaded="Window_Loaded">
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
|
|||||||
@@ -47,6 +47,18 @@ public partial class MainWindow : FluentWindow
|
|||||||
_manager.LoadPlugins();
|
_manager.LoadPlugins();
|
||||||
_manager.LoadLayout();
|
_manager.LoadLayout();
|
||||||
|
|
||||||
|
if (_manager.Settings.IsFirstRun)
|
||||||
|
{
|
||||||
|
_manager.Settings.IsFirstRun = false;
|
||||||
|
_ = Activate();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WindowState = WindowState.Minimized;
|
||||||
|
Visibility = Visibility.Collapsed;
|
||||||
|
ShowInTaskbar = false;
|
||||||
|
}
|
||||||
|
|
||||||
_manager.IsLoaded = true;
|
_manager.IsLoaded = true;
|
||||||
_mainWindowDataContext.IsLoading = false;
|
_mainWindowDataContext.IsLoading = false;
|
||||||
await ShowLatestReleaseInfoAfterUpdateAsync();
|
await ShowLatestReleaseInfoAfterUpdateAsync();
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ public sealed class Manager
|
|||||||
App.Logger.LogInfo("Reloading plugins", source: "PluginManager");
|
App.Logger.LogInfo("Reloading plugins", source: "PluginManager");
|
||||||
|
|
||||||
LoadPlugins();
|
LoadPlugins();
|
||||||
LoadLayout(false);
|
LoadLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetEditMode(bool editMode)
|
public void SetEditMode(bool editMode)
|
||||||
@@ -292,7 +292,7 @@ public sealed class Manager
|
|||||||
|
|
||||||
#region Layout Management
|
#region Layout Management
|
||||||
|
|
||||||
public void LoadLayout(bool minimize = true, Action? onComplete = null)
|
public void LoadLayout(Action? onComplete = null)
|
||||||
{
|
{
|
||||||
App.Logger.LogInfo("Loading layout", source: "Manager");
|
App.Logger.LogInfo("Loading layout", source: "Manager");
|
||||||
BlockWindowsClosing = false;
|
BlockWindowsClosing = false;
|
||||||
@@ -305,8 +305,6 @@ public sealed class Manager
|
|||||||
BlockWindowsClosing = true;
|
BlockWindowsClosing = true;
|
||||||
PluginWindows.Clear();
|
PluginWindows.Clear();
|
||||||
|
|
||||||
bool showWindow = true;
|
|
||||||
|
|
||||||
// Load plugins
|
// Load plugins
|
||||||
foreach (uint pluginId in _plugins.Keys)
|
foreach (uint pluginId in _plugins.Keys)
|
||||||
{
|
{
|
||||||
@@ -325,11 +323,6 @@ public sealed class Manager
|
|||||||
{
|
{
|
||||||
LoadPlugin(pluginId);
|
LoadPlugin(pluginId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showWindow && pluginSettings.Enabled)
|
|
||||||
{
|
|
||||||
showWindow = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove plugins that are not loaded anymore
|
// Remove plugins that are not loaded anymore
|
||||||
@@ -341,12 +334,6 @@ public sealed class Manager
|
|||||||
|
|
||||||
Settings.CurrentLayout.UpdatePlugins();
|
Settings.CurrentLayout.UpdatePlugins();
|
||||||
|
|
||||||
if (minimize && !showWindow)
|
|
||||||
{
|
|
||||||
Application.Current.MainWindow.WindowState = WindowState.Minimized;
|
|
||||||
Application.Current.MainWindow.ShowInTaskbar = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
onComplete?.Invoke();
|
onComplete?.Invoke();
|
||||||
App.Logger.LogInfo("Layout loaded", source: "Manager");
|
App.Logger.LogInfo("Layout loaded", source: "Manager");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ public partial class MainPage : Page
|
|||||||
{
|
{
|
||||||
_isLoadingLayout = true;
|
_isLoadingLayout = true;
|
||||||
_manager.SaveSettings();
|
_manager.SaveSettings();
|
||||||
_manager.LoadLayout(false);
|
_manager.LoadLayout();
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@@ -200,7 +200,7 @@ public partial class MainPage : Page
|
|||||||
_manager.Settings.Layouts.Add(new Layout(inputDialog.ResponseText.Trim()));
|
_manager.Settings.Layouts.Add(new Layout(inputDialog.ResponseText.Trim()));
|
||||||
_manager.Settings.CurrentLayoutName = inputDialog.ResponseText.Trim();
|
_manager.Settings.CurrentLayoutName = inputDialog.ResponseText.Trim();
|
||||||
_manager.SaveSettings();
|
_manager.SaveSettings();
|
||||||
_manager.LoadLayout(false);
|
_manager.LoadLayout();
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@@ -242,7 +242,7 @@ public partial class MainPage : Page
|
|||||||
_isLoadingLayout = true;
|
_isLoadingLayout = true;
|
||||||
_ = _manager.Settings.Layouts.Remove(_manager.Settings.CurrentLayout);
|
_ = _manager.Settings.Layouts.Remove(_manager.Settings.CurrentLayout);
|
||||||
_manager.SaveSettings();
|
_manager.SaveSettings();
|
||||||
_manager.LoadLayout(false);
|
_manager.LoadLayout();
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -66,6 +66,8 @@ public class DesktopMagicSettings : INotifyPropertyChanged
|
|||||||
|
|
||||||
public string? ReleaseInfoLastAppVersion { get; set; }
|
public string? ReleaseInfoLastAppVersion { get; set; }
|
||||||
|
|
||||||
|
public bool IsFirstRun { get; set; } = true;
|
||||||
|
|
||||||
public DesktopMagicSettings()
|
public DesktopMagicSettings()
|
||||||
{
|
{
|
||||||
themes.CollectionChanged += (s, e) => CurrentLayout.UpdateTheme();
|
themes.CollectionChanged += (s, e) => CurrentLayout.UpdateTheme();
|
||||||
|
|||||||
Reference in New Issue
Block a user