Example #1
0
 /// <summary>
 /// Initializes a new instance of the MinimizeToTrayInstance class.
 /// </summary>
 /// <param name="window">Window instance to attach to.</param>
 public MinimizeToTrayInstance(Window1 window)
 {
     Debug.Assert(window != null, "window parameter is null.");
     _window = window;
     _window.StateChanged += new EventHandler(HandleStateChanged);
     // Initialize menuItem1 this.menuItem1.Index = 0;
     this.menuItem1 = new MenuItem();
     this.menuItem2 = new MenuItem();
     this.menuItem1.Text = "E&xit";
     this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
     this.menuItem2.Text = "Settings";
     this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
 }
Example #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 Enable(Window1 window)
 {
     // No need to track this instance; its event handlers will keep it alive
     new MinimizeToTrayInstance(window);
 }