コード例 #1
0
        }  //  static void Main()

        //
        //  static private void Exit( object, EventArgs )
        //
        //  Our application exit routine, conveniently wrapped up in an event handler object (making it idea
        //  for calling from a UI element).
        //

        static private void Exit(object SelectedMenuItem, EventArgs e)
        {
            if (Profile.IsEdited())
            {
                NotifyUnsavedChanges();
            }

            //  Let's serialise the MRU before oblivion.

            ProfileMRU.Serialize();

            //  If we're monitoring process startup, let's stop doing so.

            if (Properties.Settings.Default.EnableAutoOpenProfile)
            {
                DisableAutoOpenProfile(null, null);
            }

            //  And persist any of the settings.

            Properties.Settings.Default.Save();

            //  And get rid of the system tray icon.
            if (sysTrayIcon != null)
            {
                // strackoverflow tip:
                // trayicon must be set to null in order to keep it from lingering in the tray.
                // Robert (04.23.15)
                sysTrayIcon.Visible = false;
                sysTrayIcon.Dispose();
                sysTrayIcon = null;
            }

            Application.Exit();
        }  //  static private void Exit( object, EventArgs )
コード例 #2
0
ファイル: GAVPI.cs プロジェクト: RampantArcana/AVPI
        }  //  static void Main()

        //
        //  static private void Exit( object, EventArgs )
        //
        //  Our application exit routine, conveniently wrapped up in an event handler object (making it idea
        //  for calling from a UI element).
        //

        static private void Exit(object SelectedMenuItem, EventArgs e)
        {
            if (vi_profile.IsEdited())
            {
                NotifyUnsavedChanges();
            }

            //  Let's serialise the MRU before oblivion.

            ProfileMRU.Serialize();

            //  If we're monitoring process startup, let's stop doing so.

            if (Properties.Settings.Default.EnableAutoOpenProfile)
            {
                DisableAutoOpenProfile(null, null);
            }

            //  And persist any of the settings.

            Properties.Settings.Default.Save();

            //  And get rid of the system tray icon.

            sysTrayIcon.Dispose();

            Application.Exit();
        }  //  static private void Exit( object, EventArgs )