예제 #1
0
 /// <summary>
 /// Disables "minimize to tray" behavior for the specified Window.
 /// </summary>
 /// <param name="window">Window to enable the behavior for.</param>
 public static void DisableMinimizeToTray(Window window)
 {
     if (!MinimizeInstances.ContainsKey(window))
     {
         Console.WriteLine(string.Format("Minimization not enabled for '{0}'", window.Title));
     }
     else
     {
         var instance = MinimizeInstances[window];
         instance.Disable();
         MinimizeInstances.Remove(window);
     }
 }
예제 #2
0
 /// <summary>
 /// Enables "minimize to tray" behavior for the specified Window.
 /// </summary>
 /// <param name="window">Window to enable the behavior for.</param>
 public static void EnableMinimizeToTray(Window window)
 {
     if (MinimizeInstances.ContainsKey(window))
     {
         Console.WriteLine(string.Format("Minimization already enabled for '{0}'", window.Title));
     }
     else
     {
         var instance = new MinimizeToTrayInstance(window);
         instance.Enable();
         MinimizeInstances.Add(window, instance);
     }
 }
예제 #3
0
 public static void Disable(Window window)
 {
     UIHelpers.RevertHideFromAltTab(window);
     if (!MinimizeInstances.ContainsKey(window))
     {
         Console.WriteLine(string.Format("Minimization not enabled for '{0}'", window.Title));
     }
     else
     {
         var instance = MinimizeInstances[window];
         instance.Disable();
         MinimizeInstances.Remove(window);
     }
 }
예제 #4
0
    /// <summary>
    /// Enables "minimize to tray" behavior for the specified Window.
    /// </summary>
    /// <param name="window">Window to enable the behavior for.</param>
    public static void Enable(Window window, bool minimizeNow)
    {
        UIHelpers.HideFromAltTab(window);
        if (MinimizeInstances.ContainsKey(window))
        {
            Console.WriteLine(string.Format("Minimization already enabled for '{0}'", window.Title));
            if (minimizeNow)
            {
                MinimizeInstances[window].MinimizeNow();
            }
        }
        else
        {
            var instance = new MinimizeToTrayInstance(window);
            instance.Enable();
            MinimizeInstances.Add(window, instance);

            if (minimizeNow)
            {
                instance.MinimizeNow();
            }
        }
    }