示例#1
0
 /// <summary>
 /// Removes the specified <code>TrayIcon</code> from the
 /// <code>SystemTray</code>.
 ///
 /// <para> All icons added by the application are automatically
 /// removed from the <code>SystemTray</code> upon application exit
 /// and also when the desktop system tray becomes unavailable.
 ///
 /// </para>
 /// <para> If <code>trayIcon</code> is <code>null</code> or was not
 /// added to the system tray, no exception is thrown and no action
 /// is performed.
 ///
 /// </para>
 /// </summary>
 /// <param name="trayIcon"> the <code>TrayIcon</code> to be removed </param>
 /// <seealso cref= #add(TrayIcon) </seealso>
 /// <seealso cref= TrayIcon </seealso>
 public virtual void Remove(TrayIcon trayIcon)
 {
     if (trayIcon == null)
     {
         return;
     }
     TrayIcon[] oldArray = null, newArray = null;
     lock (this)
     {
         oldArray = SystemTray_Renamed.TrayIcons;
         List <TrayIcon> icons = (List <TrayIcon>)AppContext.AppContext.get(typeof(TrayIcon));
         // TrayIcon with no peer is not contained in the array.
         if (icons == null || !icons.Remove(trayIcon))
         {
             return;
         }
         trayIcon.RemoveNotify();
         newArray = SystemTray_Renamed.TrayIcons;
     }
     FirePropertyChange("trayIcons", oldArray, newArray);
 }
示例#2
0
 public virtual void RemoveNotify(TrayIcon trayIcon)
 {
     trayIcon.RemoveNotify();
 }