Skip to content

Commit

Permalink
PermaTop starts minimized on start (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
lpeyr committed Jan 6, 2024
1 parent d518f96 commit 0435019
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion PermaTop/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ private void Application_Startup(object sender, StartupEventArgs e)

if (!Global.Settings.IsFirstRun)
{
new MainWindow().Show();
var mw = new MainWindow();
if (Global.Settings.LaunchAtStart == false) mw.Show();
}
else
{
Expand Down
12 changes: 10 additions & 2 deletions PermaTop/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ public MainWindow()
{
InitializeComponent();
InitUI();
if (Global.Settings.LaunchAtStart ?? false)
{
HideMenu_Click(this, null);
}
}

private void InitUI()
Expand All @@ -50,7 +54,7 @@ private void InitUI()
CheckButton(SettingsPageBtn);
};

WindowsMenu.Loaded += (o, e) => { GenerateMenu(); };
WindowsMenu.Loaded += (o, e) => { GenerateMenu(); };
}

private void CheckButton(Button btn)
Expand All @@ -73,6 +77,11 @@ private void MinimizeBtn_Click(object sender, RoutedEventArgs e)

private void CloseBtn_Click(object sender, RoutedEventArgs e)
{
if (Global.Settings.LaunchAtStart ?? false)
{
HideMenu_Click(sender, e);
return;
}
Application.Current.Shutdown();
}

Expand Down Expand Up @@ -105,7 +114,6 @@ private void SettingsPageBtn_Click(object sender, RoutedEventArgs e)
bool isHidden = false;
private void HideMenu_Click(object sender, RoutedEventArgs e)
{

isHidden = !isHidden;
if (isHidden)
{
Expand Down

0 comments on commit 0435019

Please sign in to comment.