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"
|
||||
MinWidth="940"
|
||||
ExtendsContentIntoTitleBar="True"
|
||||
WindowState="Minimized"
|
||||
WindowState="Normal"
|
||||
Loaded="Window_Loaded">
|
||||
|
||||
<Grid>
|
||||
|
||||
@@ -47,6 +47,18 @@ public partial class MainWindow : FluentWindow
|
||||
_manager.LoadPlugins();
|
||||
_manager.LoadLayout();
|
||||
|
||||
if (_manager.Settings.IsFirstRun)
|
||||
{
|
||||
_manager.Settings.IsFirstRun = false;
|
||||
_ = Activate();
|
||||
}
|
||||
else
|
||||
{
|
||||
WindowState = WindowState.Minimized;
|
||||
Visibility = Visibility.Collapsed;
|
||||
ShowInTaskbar = false;
|
||||
}
|
||||
|
||||
_manager.IsLoaded = true;
|
||||
_mainWindowDataContext.IsLoading = false;
|
||||
await ShowLatestReleaseInfoAfterUpdateAsync();
|
||||
|
||||
@@ -226,7 +226,7 @@ public sealed class Manager
|
||||
App.Logger.LogInfo("Reloading plugins", source: "PluginManager");
|
||||
|
||||
LoadPlugins();
|
||||
LoadLayout(false);
|
||||
LoadLayout();
|
||||
}
|
||||
|
||||
public void SetEditMode(bool editMode)
|
||||
@@ -292,7 +292,7 @@ public sealed class Manager
|
||||
|
||||
#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");
|
||||
BlockWindowsClosing = false;
|
||||
@@ -305,8 +305,6 @@ public sealed class Manager
|
||||
BlockWindowsClosing = true;
|
||||
PluginWindows.Clear();
|
||||
|
||||
bool showWindow = true;
|
||||
|
||||
// Load plugins
|
||||
foreach (uint pluginId in _plugins.Keys)
|
||||
{
|
||||
@@ -325,11 +323,6 @@ public sealed class Manager
|
||||
{
|
||||
LoadPlugin(pluginId);
|
||||
}
|
||||
|
||||
if (showWindow && pluginSettings.Enabled)
|
||||
{
|
||||
showWindow = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove plugins that are not loaded anymore
|
||||
@@ -341,12 +334,6 @@ public sealed class Manager
|
||||
|
||||
Settings.CurrentLayout.UpdatePlugins();
|
||||
|
||||
if (minimize && !showWindow)
|
||||
{
|
||||
Application.Current.MainWindow.WindowState = WindowState.Minimized;
|
||||
Application.Current.MainWindow.ShowInTaskbar = false;
|
||||
}
|
||||
|
||||
onComplete?.Invoke();
|
||||
App.Logger.LogInfo("Layout loaded", source: "Manager");
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ public partial class MainPage : Page
|
||||
{
|
||||
_isLoadingLayout = true;
|
||||
_manager.SaveSettings();
|
||||
_manager.LoadLayout(false);
|
||||
_manager.LoadLayout();
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -200,7 +200,7 @@ public partial class MainPage : Page
|
||||
_manager.Settings.Layouts.Add(new Layout(inputDialog.ResponseText.Trim()));
|
||||
_manager.Settings.CurrentLayoutName = inputDialog.ResponseText.Trim();
|
||||
_manager.SaveSettings();
|
||||
_manager.LoadLayout(false);
|
||||
_manager.LoadLayout();
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -242,7 +242,7 @@ public partial class MainPage : Page
|
||||
_isLoadingLayout = true;
|
||||
_ = _manager.Settings.Layouts.Remove(_manager.Settings.CurrentLayout);
|
||||
_manager.SaveSettings();
|
||||
_manager.LoadLayout(false);
|
||||
_manager.LoadLayout();
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -66,6 +66,8 @@ public class DesktopMagicSettings : INotifyPropertyChanged
|
||||
|
||||
public string? ReleaseInfoLastAppVersion { get; set; }
|
||||
|
||||
public bool IsFirstRun { get; set; } = true;
|
||||
|
||||
public DesktopMagicSettings()
|
||||
{
|
||||
themes.CollectionChanged += (s, e) => CurrentLayout.UpdateTheme();
|
||||
|
||||
Reference in New Issue
Block a user