Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 41 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,37 @@ uninstall.bat
# Keep release documentation tracked
!docs/release/
!docs/release/*.md
!docs/releases/
!docs/releases/*.md

# Local worktrees and planning docs
.worktrees/
docs/superpowers/plans/
/FINAL_RELEASE_PLAN*.md
/RELEASE_PLAN*.md
/LOCAL_VALIDATION*.md
/VALIDATION_NOTES*.md
/PR*_VALIDATION*.md
/CHOCOLATEY_MODERATOR_NOTICE*.md

# Test and coverage
[Tt]est[Rr]esult*/
**/[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
*.VisualState.xml
TestResult.xml
nunit-*.xml
coverage/
coverage-report/
coverage-results/
lcov-report/
coverage*.json
coverage*.xml
coverage*.info
lcov.info
*.coverage
*.coveragexml
*.trx
FINAL_RELEASE_PLAN.md
RELEASE_PLAN.md
CHOCOLATEY_MODERATOR_NOTICE.md

# .NET / NuGet
*.deps.json
Expand Down Expand Up @@ -92,17 +103,37 @@ $RECYCLE.BIN/
*.log
logs/
Logs/
*.pid
*.trace
*.stackdump
.DS_Store
.fuse_hidden*
.directory
.Trash-*
/screenshots/
/validation-screenshots/
/threadpilot-menu-validation/
*-screenshot.png
*-screenshot.jpg
*-validation.png

# Installer / packaging artifacts
Installer/Output/
/release/
/release-build/
/package-stage/
/_stage*/
*.cab
*.msi
*.msm
*.msp
*.msix
*.msixbundle
*.appinstaller
*.blockmap
*.sha256
*.sha512
ThreadPilot-*.zip
*.lnk
*.exe.config
*.[Pp]ublish.xml
Expand Down Expand Up @@ -131,7 +162,14 @@ Configuration/ProcessProfiles.json
Configuration/*.local.json
Data/
AppData/
appdata/
%AppData%/ThreadPilot/
/settings.json
/core_masks.json
/persistent_rules.json
/Configuration/
/Profiles/
/PowerPlans/

# Project-specific extras
.claude/
Expand Down
38 changes: 27 additions & 11 deletions App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ protected override void OnStartup(StartupEventArgs e)
#if DEBUG
bool isTestMode = false;
#endif
bool effectiveStartMinimized = false;
ApplicationSettingsModel? loadedSettings = null;

foreach (var arg in e.Args)
{
Expand Down Expand Up @@ -103,6 +105,8 @@ protected override void OnStartup(StartupEventArgs e)
}
}

effectiveStartMinimized = startMinimized;

// Set up global exception handlers first
AppDomain.CurrentDomain.UnhandledException += this.OnUnhandledException;
this.DispatcherUnhandledException += this.OnDispatcherUnhandledException;
Expand Down Expand Up @@ -219,6 +223,8 @@ protected override void OnStartup(StartupEventArgs e)

Task.Run(async () => await settingsService.LoadSettingsAsync()).GetAwaiter().GetResult();
var settings = settingsService.Settings;
loadedSettings = settings;
effectiveStartMinimized = startMinimized || settings.StartMinimized;
var useDarkTheme = settings.HasUserThemePreference
? settings.UseDarkTheme
: themeService.GetSystemUsesDarkTheme();
Expand All @@ -237,6 +243,7 @@ protected override void OnStartup(StartupEventArgs e)
}

var mainWindow = this.ServiceProvider.GetRequiredService<MainWindow>();
this.MainWindow = mainWindow;

// Handle startup behavior with comprehensive error handling
try
Expand All @@ -249,23 +256,33 @@ protected override void OnStartup(StartupEventArgs e)
throw new InvalidOperationException("MainWindow could not be created");
}

var startupWindowBehavior = StartupWindowBehavior.Resolve(isAutostart, startMinimized);
var startupWindowBehavior = StartupWindowBehavior.Resolve(isAutostart, effectiveStartMinimized);
var showStartupSuggestion = loadedSettings != null
&& StartupMinimizedSuggestionPolicy.ShouldShow(loadedSettings, startupWindowBehavior);
mainWindow.ConfigureStartupMode(
isSilentStartupMode: !startupWindowBehavior.ShouldShowWindow,
showStartupMinimizedSuggestionOnReady: showStartupSuggestion);

mainWindow.ShowInTaskbar = startupWindowBehavior.ShowInTaskbar;
mainWindow.Visibility = startupWindowBehavior.Visibility;
mainWindow.WindowState = startupWindowBehavior.WindowState;
mainWindow.Show();

if (startupWindowBehavior.HideAfterShow)
if (startupWindowBehavior.ShouldShowWindow)
{
mainWindow.Hide();
}
else if (startupWindowBehavior.ActivateAfterShow)
{
mainWindow.EnsureDashboardVisibleOnScreen();
mainWindow.Activate();
mainWindow.Show();

if (startupWindowBehavior.HideAfterShow)
{
mainWindow.Hide();
}
else if (startupWindowBehavior.ActivateAfterShow)
{
mainWindow.EnsureDashboardVisibleOnScreen();
mainWindow.Activate();
}
}

logger.LogInformation("Main window displayed successfully");
logger.LogInformation("Startup window behavior applied successfully");
}
catch (Exception ex)
{
Expand Down Expand Up @@ -450,4 +467,3 @@ private void ReportUnhandledException(Exception exception, string source, LogLev
}
}
}

17 changes: 17 additions & 0 deletions Helpers/StartupMinimizedSuggestionPolicy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace ThreadPilot.Helpers
{
using System;
using ThreadPilot.Models;

public static class StartupMinimizedSuggestionPolicy
{
public static bool ShouldShow(ApplicationSettingsModel settings, StartupWindowBehavior behavior)
{
ArgumentNullException.ThrowIfNull(settings);

return behavior.ShouldShowWindow
&& !settings.StartMinimized
&& !settings.HasSeenStartupMinimizedSuggestion;
}
}
}
10 changes: 7 additions & 3 deletions Helpers/StartupWindowBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ namespace ThreadPilot.Helpers
using System.Windows;

public readonly record struct StartupWindowBehavior(
bool ShouldShowWindow,
bool ShowInTaskbar,
Visibility Visibility,
WindowState WindowState,
Expand All @@ -14,24 +15,27 @@ public static StartupWindowBehavior Resolve(bool isAutostart, bool startMinimize
if (isAutostart && startMinimized)
{
return new StartupWindowBehavior(
ShouldShowWindow: false,
ShowInTaskbar: false,
Visibility: Visibility.Hidden,
WindowState: WindowState.Minimized,
HideAfterShow: true,
HideAfterShow: false,
ActivateAfterShow: false);
}

if (startMinimized)
{
return new StartupWindowBehavior(
ShowInTaskbar: true,
Visibility: Visibility.Visible,
ShouldShowWindow: false,
ShowInTaskbar: false,
Visibility: Visibility.Hidden,
WindowState: WindowState.Minimized,
HideAfterShow: false,
ActivateAfterShow: false);
}

return new StartupWindowBehavior(
ShouldShowWindow: true,
ShowInTaskbar: true,
Visibility: Visibility.Visible,
WindowState: WindowState.Normal,
Expand Down
2 changes: 1 addition & 1 deletion Installer/Installer.iss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#define MyAppPublisher "ThreadPilot"
#define MyAppURL "https://github.com/"
#define MyAppExeName "ThreadPilot.exe"
#define MyAppVersion "0.1.0-beta"
#define MyAppVersion "1.2.0"

#ifndef MyWizardStyle
#define MyWizardStyle "modern dynamic windows11"
Expand Down
2 changes: 1 addition & 1 deletion Installer/ThreadPilot.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Package
Name="ThreadPilot"
Manufacturer="Prime Build"
Version="1.1.1.0"
Version="1.2.0.0"
UpgradeCode="PUT-GENERATED-UPGRADE-CODE-HERE"
Language="1033">
<SummaryInformation Description="ThreadPilot MSI template" />
Expand Down
2 changes: 1 addition & 1 deletion Installer/setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#endif

#ifndef MyAppVersion
#define MyAppVersion "1.1.3"
#define MyAppVersion "1.2.0"
#endif

#ifndef MyAppSourceDir
Expand Down
Loading
Loading