Esempio n. 1
0
        private void modifyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                frmProfile modProfileFrm = new frmProfile();

                //
                //  VI_Profile takes care of tracking changes and the saved/unsaved state of the current Profile.
                //  We can act on this knowledge to update the status in the UI and also inform the user of those
                //  unsaved changes should they choose a potentially destructive act (exiting the program, opening
                //  an existing Profile).
                //

                modProfileFrm.ShowDialog();

                btmStripStatus.Text = "NOT LISTENING: " + (GAVPI.vi_profile.IsEdited() ? "[UNSAVED] " : " ") +
                                      Path.GetFileNameWithoutExtension(GAVPI.vi_profile.ProfileFilename);

                //  Allow the user to start issuing voice commands if we have an actual Profile...

                btnMainListen.Enabled = !GAVPI.vi_profile.IsEmpty();

                modProfileFrm.Dispose();
            }
            catch (Exception profile_exception)
            {
                MessageBox.Show("Profile Editor Crashed.\n" + profile_exception.Message, "Error",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1);
            }
            finally
            {
            }
        }
Esempio n. 2
0
        }  //  static public void OpenProfileEditor

        //
        //  static public void CloseProfileEditor()
        //
        //  CloseProfileEditor is the sanity-checking prefered way of closing the Profile editor form
        //  (frmProfile) when opened via OpenProfileEditor().
        //

        static public void CloseProfileEditor()
        {
            if (ProfileEditor == null)
            {
                return;
            }

            ProfileEditor.Dispose();

            ProfileEditor = null;

            //  Let's allow the user to open the Profile editor from within the system tray's menu once more.

            sysTrayMenu.MenuItems[MODIFY_PROFILE_MENU_ITEM].Enabled = true;

            //  And let's also allow the user to commence listening on voice recognition commands.

            sysTrayMenu.MenuItems[LISTEN_MENU_ITEM].Enabled = true;
        }  //  static public void CloseProfileEditor()