Beispiel #1
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (window != null)
         {
             icon = null;
             text = "";
             UpdateNotifyIcon(false);
             window.DestroyHandle();
             window           = null;
             ContextMenu      = null;
             ContextMenuStrip = null;
         }
     }
     else
     {
         if (window != null && window.Handle != IntPtr.Zero)
         {
             NativeMethods.PostMessage(
                 new HandleRef(window, window.Handle), WM_CLOSE, 0, 0);
             window.ReleaseHandle();
         }
     }
     base.Dispose(disposing);
 }
Beispiel #2
0
 /// <include file='doc\TrayIcon.uex' path='docs/doc[@for="NotifyIcon.Dispose"]/*' />
 /// <devdoc>
 ///    <para>
 ///       Disposes of the resources (other than memory) used by the
 ///    <see cref='System.Windows.Forms.NotifyIcon'/>.
 ///    </para>
 /// </devdoc>
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (window != null)
         {
             this.icon = null;
             this.Text = String.Empty;
             UpdateIcon(false);
             window.DestroyHandle();
             window           = null;
             contextMenu      = null;
             contextMenuStrip = null;
         }
     }
     else
     {
         // This same post is done in ControlNativeWindow's finalize method, so if you change
         // it, change it there too.
         //
         if (window != null && window.Handle != IntPtr.Zero)
         {
             UnsafeNativeMethods.PostMessage(new HandleRef(window, window.Handle), NativeMethods.WM_CLOSE, 0, 0);
             window.ReleaseHandle();
         }
     }
     base.Dispose(disposing);
 }
 public NotifyIcon()
 {
     this.syncObj         = new object();
     this.text            = "";
     this.balloonTipText  = "";
     this.balloonTipTitle = "";
     this.id     = ++nextId;
     this.window = new NotifyIconNativeWindow(this);
     this.UpdateIcon(this.visible);
 }
Beispiel #4
0
            public NotifyIconWindowsImplementation()
            {
                BalloonTipText  = "";
                BalloonTipTitle = "";

                commandDispatch = typeof(Form).Assembly.
                                  GetType("System.Windows.Forms.Command").GetMethod("DispatchID",
                                                                                    BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public,
                                                                                    null, new Type[] { typeof(int) }, null);

                id     = ++NotifyIconWindowsImplementation.nextId;
                window = new NotifyIconNativeWindow(this);
                UpdateNotifyIcon(visible);
            }
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (this.window != null)
         {
             this.icon = null;
             this.Text = string.Empty;
             this.UpdateIcon(false);
             this.window.DestroyHandle();
             this.window           = null;
             this.contextMenu      = null;
             this.contextMenuStrip = null;
         }
     }
     else if ((this.window != null) && (this.window.Handle != IntPtr.Zero))
     {
         System.Windows.Forms.UnsafeNativeMethods.PostMessage(new HandleRef(this.window, this.window.Handle), 0x10, 0, 0);
         this.window.ReleaseHandle();
     }
     base.Dispose(disposing);
 }
Beispiel #6
0
 /// <summary>
 ///    <para>
 ///       Initializes a new instance of the <see cref='System.Windows.Forms.NotifyIcon'/> class.
 ///    </para>
 /// </summary>
 public NotifyIcon()
 {
     id     = ++nextId;
     window = new NotifyIconNativeWindow(this);
     UpdateIcon(visible);
 }
 /// <include file='doc\TrayIcon.uex' path='docs/doc[@for="NotifyIcon.NotifyIcon"]/*' />
 /// <devdoc>
 ///    <para>
 ///       Initializes a new instance of the <see cref='System.Windows.Forms.NotifyIcon'/> class.
 ///    </para>
 /// </devdoc>
 public NotifyIcon() {
     id = ++nextId;
     window = new NotifyIconNativeWindow(this);
     UpdateIcon(visible);
 }
 /// <include file='doc\TrayIcon.uex' path='docs/doc[@for="NotifyIcon.Dispose"]/*' />
 /// <devdoc>
 ///    <para>
 ///       Disposes of the resources (other than memory) used by the
 ///    <see cref='System.Windows.Forms.NotifyIcon'/>.
 ///    </para>
 /// </devdoc>
 protected override void Dispose(bool disposing) {
     if (disposing) {
         if (window != null) {
             this.icon = null;
             this.Text = String.Empty;
             UpdateIcon(false);
             window.DestroyHandle();
             window = null;
             contextMenu = null;
             contextMenuStrip = null;
         }
     }
     else {
         // This same post is done in ControlNativeWindow's finalize method, so if you change
         // it, change it there too.
         //
         if (window != null && window.Handle != IntPtr.Zero) {
             UnsafeNativeMethods.PostMessage(new HandleRef(window, window.Handle), NativeMethods.WM_CLOSE, 0, 0);
             window.ReleaseHandle();
         }
     }
     base.Dispose(disposing);
 }
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (this.window != null)
         {
             this.icon = null;
             this.Text = string.Empty;
             this.UpdateIcon(false);
             this.window.DestroyHandle();
             this.window = null;
             this.contextMenu = null;
             this.contextMenuStrip = null;
         }
     }
     else if ((this.window != null) && (this.window.Handle != IntPtr.Zero))
     {
         System.Windows.Forms.UnsafeNativeMethods.PostMessage(new HandleRef(this.window, this.window.Handle), 0x10, 0, 0);
         this.window.ReleaseHandle();
     }
     base.Dispose(disposing);
 }
 public NotifyIcon()
 {
     this.syncObj = new object();
     this.text = "";
     this.balloonTipText = "";
     this.balloonTipTitle = "";
     this.id = ++nextId;
     this.window = new NotifyIconNativeWindow(this);
     this.UpdateIcon(this.visible);
 }
 protected override void Dispose(bool disposing) {
   if (disposing) {
     if (window != null) {
       icon = null;
       text = "";
       UpdateNotifyIcon(false);
       window.DestroyHandle();
       window = null;
       ContextMenu = null;
       ContextMenuStrip = null;
     }
   } else {
     if (window != null && window.Handle != IntPtr.Zero) {
       NativeMethods.PostMessage(
         new HandleRef(window, window.Handle), WM_CLOSE, 0, 0);
       window.ReleaseHandle();
     }
   }
   base.Dispose(disposing);
 }
      public NotifyIconWindowsImplementation() {
        BalloonTipText = "";
        BalloonTipTitle = "";

        commandDispatch = typeof(Form).Assembly.
          GetType("System.Windows.Forms.Command").GetMethod("DispatchID",
          BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public,
          null, new Type[] { typeof(int) }, null);

        id = ++NotifyIconWindowsImplementation.nextId;
        window = new NotifyIconNativeWindow(this);
        UpdateNotifyIcon(visible);
      }
Beispiel #13
0
 /// <summary>
 ///  Initializes a new instance of the <see cref="NotifyIcon"/> class.
 /// </summary>
 public NotifyIcon()
 {
     _id     = ++s_nextId;
     _window = new NotifyIconNativeWindow(this);
     UpdateIcon(_visible);
 }