Ejemplo n.º 1
0
        protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
        {
            // close Spotify first
            if (SettingsXml.Current.CloseSpotifyWithToastify)
            {
                Spotify.KillSpotify();
            }

            // Ensure trayicon is removed on exit. (Thx Linus)
            trayIcon.Visible = false;
            trayIcon.Dispose();
            trayIcon = null;

            // Let the plugins now we're closing up.
            // we do this last since it's transparent to the user
            foreach (var p in this.Plugins)
            {
                try
                {
                    p.Closing();
                    p.Dispose();
                }
                catch (Exception)
                {
                    //For now we swallow any plugin errors.
                }
            }

            this.Plugins.Clear();

            base.OnClosing(e);
        }