private void ResetSession() { //reset _currentNoteType = 0; // The actual types are controlled by the Session class. _prevNoteType = 0; _nextNoteType = 0; // Used for the hints about the next note up or down. _screenshotName = ""; // Attached to a Session Note. PlainTextNoteName = ""; // Attached to a Session Note. Public because it is used *directly* by the RTFNote IsPlainTextDiagOpen = false; ResumeSession.IsEnabled = true; PauseSession.IsEnabled = false; _currentStage = Session.SessionStartingStage.Tester; _recurrenceTimer = new Timer(); _currentSession = new Session(); // The session managing class SMWidgetForm.Title = Application.ProductName; SetWorkingDir(_currentSession.WorkingDir); _recurrenceTimer.Tick += TimerEventProcessor; // this is the function called everytime the timer expires _recurrenceTimer.Interval = 90 * 1000; // 30 times 1 second (1000 milliseconds) _recurrenceTimer.Start(); }
// The function below will change the visuals of the application at the different stages (tester/charter/notes state based behavior) private void StateMove(Session.SessionStartingStage newStage, bool skipStartSession = false) { Logger.Record("[StateMove]: Session Stage now: " + _currentStage.ToString(), "SMWidget", "info"); _currentStage = newStage; switch (_currentStage) { case Session.SessionStartingStage.Tester: NoteType.Text = "Reporter:"; prevType.Text = ""; nextType.Text = ""; _prevNoteType = 1; _nextNoteType = _currentSession.NoteTypes.Length - 1; NoteType.FontSize = 23; Logger.Record("\t[StateMove]: Session Stage moving -> Tester", "SMWidget", "info"); break; case Session.SessionStartingStage.Charter: NoteType.Text = "Charter:"; Logger.Record("\t[StateMove]: Session Stage moving -> Charter", "SMWidget", "info"); break; case Session.SessionStartingStage.ScenarioId: NoteType.Text = "Scenario ID:"; Logger.Record("\t[StateMove]: Session Stage moving -> ScenarioId", "SMWidget", "info"); break; case Session.SessionStartingStage.Environment: NoteType.Text = "Environment:"; Logger.Record("\t[StateMove]: Session Stage moving -> Environment", "SMWidget", "info"); break; case Session.SessionStartingStage.Versions: NoteType.Text = "Versions:"; Logger.Record("\t[StateMove]: Session Stage moving -> Versions", "SMWidget", "info"); break; case Session.SessionStartingStage.Notes: try { NoteContent.ToolTip = (100 < _currentSession.Charter.Length) ? _currentSession.Charter.Remove(100) + "..." : _currentSession.Charter; NoteType.Text = _currentSession.NoteTypes[_currentNoteType] + ":"; prevType.Text = "? " + _currentSession.NoteTypes[_prevNoteType] + ":"; nextType.Text = "? " + _currentSession.NoteTypes[_nextNoteType] + ":"; NoteType.FontSize = 21; if (!skipStartSession) { _currentSession.StartSession(); } SetWorkingDir(_currentSession.WorkingDir); ProgressGo(90); t90.IsChecked = true; ScreenShot.IsEnabled = true; RTFNoteBtn.IsEnabled = true; ResumeSession.IsEnabled = false; PauseSession.IsEnabled = true; // Change the icon of the image of the buttons, to NOT appear disabled. CloseButton.ToolTip = "Save and Quit"; SaveAndQuitOption.Header = "Save and Quit"; SaveAndNewOption.IsEnabled = true; ScreenShotIcon.Source = new BitmapImage(new Uri("iconshot.png", UriKind.Relative)); RTFNoteBtnIcon.Source = new BitmapImage(new Uri("iconnotes.png", UriKind.Relative)); TimerMenu.IsEnabled = true; Logger.Record("\t\t[StateMove]: Session Stage moving -> Notes", "SMWidget", "info"); } catch (InvalidDirecotoryException e) { string msg = e.Message + " Application closed."; System.Windows.MessageBox.Show(msg, "Unable to Create a Folder", MessageBoxButton.OK, MessageBoxImage.Error); ExitApp(true); } break; default: Logger.Record("\t[StateMove]: Session Stage moving -> NULL", "SMWidget", "error"); break; } }