Răsfoiți Sursa

Hide the window by simply minimizing it

This also has the added benefit of losing focus so you can immediately open it back up again from the taskbar.
Daniel Chalmers 1 an în urmă
părinte
comite
d9e457d0ee
2 a modificat fișierele cu 3 adăugiri și 10 ștergeri
  1. 0 1
      DesktopClock/MainWindow.xaml
  2. 3 9
      DesktopClock/MainWindow.xaml.cs

+ 0 - 1
DesktopClock/MainWindow.xaml

@@ -23,7 +23,6 @@
         MouseDoubleClick="Window_MouseDoubleClick"
         MouseWheel="Window_MouseWheel"
         ContentRendered="Window_ContentRendered"
-		Activated="Window_Activated"
         Closed="Window_Closed"
         wp:WindowPlacementProperties.Placement="{Binding Placement, Source={x:Static p:Settings.Default}, Mode=TwoWay}">
 	<Window.Resources>

+ 3 - 9
DesktopClock/MainWindow.xaml.cs

@@ -63,19 +63,19 @@ public partial class MainWindow : Window
     public void CopyToClipboard() => Clipboard.SetText(CurrentTimeOrCountdownString);
 
     /// <summary>
-    /// Hides the window until it's activated again.
+    /// Minimizes the window.
     /// </summary>
     [RelayCommand]
     public void HideForNow()
     {
         if (!Settings.Default.TipsShown.HasFlag(TeachingTips.HideForNow))
         {
-            MessageBox.Show(this, "Clock will be hidden until you open it again from the taskbar or system tray.", Title);
+            MessageBox.Show(this, "Clock will be minimized and can be opened again from the taskbar or system tray (if enabled).", Title);
 
             Settings.Default.TipsShown |= TeachingTips.HideForNow;
         }
 
-        Opacity = 0;
+        WindowState = WindowState.Minimized;
     }
 
     /// <summary>
@@ -344,12 +344,6 @@ public partial class MainWindow : Window
         }
     }
 
-    private void Window_Activated(object sender, EventArgs e)
-    {
-        // Reverse "Hide for now".
-        Opacity = 1;
-    }
-
     private void Window_Closed(object sender, EventArgs e)
     {
         // Stop the file watcher before saving.