/// <summary> /// Release resources /// </summary> /// <param name="sender">event sender</param> /// <param name="e">event args</param> private void form_FormClosing(object sender, FormClosingEventArgs e) { Log.Debug("setting _menushown to false "); _menuShown = false; _lectureMgrForm = null; }
public override bool Activate() { ExitCode = CompletionCode.None; LectureManagerMainForm form = new LectureManagerMainForm(); form.FormClosing += new FormClosingEventHandler(form_FormClosing); form.LoadFromFile = LoadFromFile; form.LectureFile = LectureFile; form.LectureText = LectureText; _lectureMgrForm = form; Windows.ShowForm(form); return(true); }
/// <summary> /// Invoked when the Functional agent is activated. This is /// the entry point. /// </summary> /// <returns>true on success</returns> public override bool Activate() { _menuShown = false; ExitCode = CompletionCode.None; _prevScannerPosition = Context.AppWindowPosition; Context.AppWindowPosition = Windows.WindowPosition.TopRight; var form = new LectureManagerMainForm { LoadFromFile = this.LoadFromFile, LectureFile = this.LectureFile, LectureText = this.LectureText }; form.FormClosing += form_FormClosing; _lectureMgrForm = form; Windows.ShowForm(form); return(true); }
/// <summary> /// Invoked when there is a request to run a command. This /// could as a result of the user activating a button on the /// scanner and there is a command associated with the button /// </summary> /// <param name="command">command to run</param> /// <param name="commandArg">any optional arguments</param> /// <param name="handled">was this handled?</param> public override void OnRunCommand(String command, object commandArg, ref bool handled) { handled = true; switch (command) { case "SpeakMenu": if (isMainFormActive()) { if (Confirm("Speak now?")) { PanelRequestEventArgs speakArg; if (_lectureMgrForm.Mode == LectureManagerMainForm.SpeechMode.All) { speakArg = new PanelRequestEventArgs( SpeakAllMenuPanel, Title, WindowActivityMonitor.GetForegroundWindowInfo()) { UseCurrentScreenAsParent = true }; showPanel(this, speakArg); } else { speakArg = new PanelRequestEventArgs( SpeakMenuPanel, Title, WindowActivityMonitor.GetForegroundWindowInfo()) { UseCurrentScreenAsParent = true }; showPanel(this, speakArg); } } } break; case "LMTopOfDoc": if (isMainFormActive()) { _lectureMgrForm.GoToTop(); } break; case "LMForward": if (isMainFormActive()) { _lectureMgrForm.NavigateForward(); } break; case "LMBackward": if (isMainFormActive()) { _lectureMgrForm.NavigateBackward(); } break; case "SpeechModeParagraph": if (isMainFormActive()) { if (Confirm("Set Paragraph Mode?")) { _lectureMgrForm.Mode = LectureManagerMainForm.SpeechMode.Paragraph; closeCurrentPanel(); } } break; case "SpeechModeSentence": if (isMainFormActive()) { if (Confirm("Set Sentence Mode?")) { _lectureMgrForm.Mode = LectureManagerMainForm.SpeechMode.Sentence; closeCurrentPanel(); } } break; case "SpeechModeAll": if (isMainFormActive()) { if (Confirm("Set All?")) { _lectureMgrForm.Mode = LectureManagerMainForm.SpeechMode.All; closeCurrentPanel(); } } break; case "SpeakNext": if (isMainFormActive()) { _lectureMgrForm.ProcessSpeakNext(); } break; case "SpeakAll": if (isMainFormActive()) { if (_lectureMgrForm.Speaking) { _lectureMgrForm.PauseSpeaking(); } else { _lectureMgrForm.ProcessReadAllSpeech(); } } break; case "leaveSpeak": if (Confirm("Speaking. Leave?")) { closeCurrentPanel(); if (isMainFormActive()) { _lectureMgrForm.StopIfSpeaking(); } } break; case "exitLectureManager": if (Confirm("Exit Lecture Manager?")) { closeCurrentPanel(); if (_lectureMgrForm != null) { Windows.CloseForm(_lectureMgrForm); _lectureMgrForm = null; } Context.AppWindowPosition = _prevScannerPosition; Close(); Log.Debug("setting _menushown to false "); _menuShown = false; } break; case "ToggleMode": var toggleModeArg = new PanelRequestEventArgs("LectureManagerToggleModeMenu", Title, WindowActivityMonitor.GetForegroundWindowInfo()) { UseCurrentScreenAsParent = true }; showPanel(this, toggleModeArg); break; case "NavigateMenu": var navigateMenuArg = new PanelRequestEventArgs("LectureManagerNavigationMenu", Title, WindowActivityMonitor.GetForegroundWindowInfo()) { UseCurrentScreenAsParent = true }; showPanel(this, navigateMenuArg); break; default: base.OnRunCommand(command, commandArg, ref handled); break; } }
/// <summary> /// Invoked when the Functional agent is activated. This is /// the entry point. /// </summary> /// <returns>true on success</returns> public override bool Activate() { _menuShown = false; ExitCode = CompletionCode.None; _prevScannerPosition = Context.AppWindowPosition; Context.AppWindowPosition = Windows.WindowPosition.TopRight; var form = new LectureManagerMainForm { LoadFromFile = this.LoadFromFile, LectureFile = this.LectureFile, LectureText = this.LectureText }; form.FormClosing += form_FormClosing; _lectureMgrForm = form; Windows.ShowForm(form); return true; }
private void form_FormClosing(object sender, FormClosingEventArgs e) { _menuShown = false; _lectureMgrForm = null; }
public override void OnRunCommand(String command, object commandArg, ref bool handled) { handled = true; switch (command) { case "SpeakMenu": if (isMainFormActive()) { if (Confirm("Speak now?")) { if (_lectureMgrForm.Mode == LectureManagerMainForm.SpeechMode.All) { var arg2 = new PanelRequestEventArgs(SpeakAllMenuPanel, _title, WindowActivityMonitor.GetForegroundWindowInfo()); arg2.UseCurrentScreenAsParent = true; showPanel(this, arg2); } else { var arg2 = new PanelRequestEventArgs(SpeakMenuPanel, _title, WindowActivityMonitor.GetForegroundWindowInfo()); arg2.UseCurrentScreenAsParent = true; showPanel(this, arg2); } } } break; case "LMTopOfDoc": if (isMainFormActive()) { _lectureMgrForm.GoToTop(); } break; case "LMForward": if (isMainFormActive()) { _lectureMgrForm.NavigateForward(); } break; case "LMBackward": if (isMainFormActive()) { _lectureMgrForm.NavigateBackward(); } break; case "SpeechModeParagraph": if (isMainFormActive()) { if (Confirm("Set Paragraph Mode?")) { _lectureMgrForm.Mode = LectureManagerMainForm.SpeechMode.Paragraph; closeCurrentPanel(); } } break; case "SpeechModeSentence": if (isMainFormActive()) { if (Confirm("Set Sentence Mode?")) { _lectureMgrForm.Mode = LectureManagerMainForm.SpeechMode.Sentence; closeCurrentPanel(); } } break; case "SpeechModeAll": if (isMainFormActive()) { if (Confirm("Set All?")) { _lectureMgrForm.Mode = LectureManagerMainForm.SpeechMode.All; closeCurrentPanel(); } } break; case "SpeakNext": if (isMainFormActive()) { _lectureMgrForm.ProcessSpeakNext(); } break; case "SpeakAll": if (isMainFormActive()) { if (_lectureMgrForm.Speaking) { _lectureMgrForm.PauseSpeaking(); } else { _lectureMgrForm.ProcessReadAllSpeech(); } } break; case "leaveSpeak": if (Confirm("Speaking. Leave?")) { closeCurrentPanel(); if (isMainFormActive()) { _lectureMgrForm.StopIfSpeaking(); } } break; case "exitLectureManager": if (Confirm("Exit Lecture Manager?")) { closeCurrentPanel(); if (_lectureMgrForm != null) { Windows.CloseForm(_lectureMgrForm); _lectureMgrForm = null; } Close(); } break; case "ToggleMode": PanelRequestEventArgs arg21 = new PanelRequestEventArgs("LectureManagerToggleModeMenu", _title, WindowActivityMonitor.GetForegroundWindowInfo()); arg21.UseCurrentScreenAsParent = true; showPanel(this, arg21); break; case "NavigateMenu": PanelRequestEventArgs arg1 = new PanelRequestEventArgs("LectureManagerNavigationMenu", _title, WindowActivityMonitor.GetForegroundWindowInfo()); arg1.UseCurrentScreenAsParent = true; showPanel(this, arg1); break; default: base.OnRunCommand(command, commandArg, ref handled); break; } }
public override bool Activate() { ExitCode = CompletionCode.None; LectureManagerMainForm form = new LectureManagerMainForm(); form.FormClosing += new FormClosingEventHandler(form_FormClosing); form.LoadFromFile = LoadFromFile; form.LectureFile = LectureFile; form.LectureText = LectureText; _lectureMgrForm = form; Windows.ShowForm(form); return true; }