} // static public void CloseMainForm() // // static public void OpenProfileEditor // // This method is the prefered way of instantiating the Profile editing form, frmProfile. // static public void OpenProfileEditor(object SelectedMenuItem, EventArgs e) { ProfileEditor = new frmProfile(); if (ProfileEditor == null) { return; } // For now, at least, stop listening if the Profile is in danger of being edited. StopListening(null, null); // We don't want the user to be able to open two instances of the Profile editing form, so let's // disable the system tray menu item. sysTrayMenu.MenuItems[MODIFY_PROFILE_MENU_ITEM].Enabled = false; // And we don't want the user to be able to listen on commands while we're editing the Profile (at // least yet)... sysTrayMenu.MenuItems[LISTEN_MENU_ITEM].Enabled = false; ProfileEditor.ShowDialog(); CloseProfileEditor(); return; } // static public void OpenProfileEditor
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 { } }
} // 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()
// // static public void OpenProfileEditor // // This method is the prefered way of instantiating the Profile editing form, frmProfile. // public static void OpenProfileEditor( object SelectedMenuItem, EventArgs e ) { ProfileEditor = new frmProfile(); if( ProfileEditor == null ) return; // For now, at least, stop listening if the Profile is in danger of being edited. StopListening( null, null ); // We don't want the user to be able to open two instances of the Profile editing form, so let's // disable the system tray menu item. sysTrayMenu.MenuItems[ MODIFY_PROFILE_MENU_ITEM ].Enabled = false; // And we don't want the user to be able to listen on commands while we're editing the Profile (at // least yet)... sysTrayMenu.MenuItems[ LISTEN_MENU_ITEM ].Enabled = false; ProfileEditor.ShowDialog(); CloseProfileEditor(); return; }
// // static public void CloseProfileEditor() // // CloseProfileEditor is the sanity-checking prefered way of closing the Profile editor form // (frmProfile) when opened via OpenProfileEditor(). // public static 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; }