-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add advanced option to start the window hidden
Resolves #50 Also will hide the window while it's loading in case the host is slow between instructions.
- Loading branch information
1 parent
fd639d4
commit 9df1417
Showing
4 changed files
with
41 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System.Windows; | ||
|
||
namespace DesktopClock; | ||
|
||
public static class WindowUtil | ||
{ | ||
/// <summary> | ||
/// Hides the window until the user opens it through the taskbar, tray, alt-tab, etc. | ||
/// </summary> | ||
public static void HideFromScreen(this Window window) | ||
{ | ||
// Minimize the window and update the ShowInTaskbar property to keep it hidden if needed. | ||
// https://stackoverflow.com/a/28239057. | ||
var wasShownInTaskbar = window.ShowInTaskbar; | ||
window.ShowInTaskbar = true; | ||
window.WindowState = WindowState.Minimized; | ||
window.ShowInTaskbar = wasShownInTaskbar; | ||
} | ||
} |