private void editIntermissionName_TextChanged(object sender, TextChangedEventArgs e) { try { GameViewModel.Instance.NameOfIntermission = ((TextBox)sender).Text; EditModeModel mode = new EditModeModel(); mode.EditModeType = EditModeEnum.IntermissionName; mode.additionalInformation = GameViewModel.Instance.NameOfIntermission; GameViewModel.Instance.EditModeItems.Add(mode); } catch (Exception exception) { ErrorViewModel.Save(exception, GetType(), additionalInformation: Logger.Instance.getLoggedMessages()); } }
/// <summary> /// the edit text box for period clock to replace the character in the box. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void editPeriodClockText_PreviewKeyUp(object sender, KeyEventArgs e) { try { if (e.Key == Key.Back || e.Key == Key.Delete) { e.Handled = true; return; } chooseCaretIndexPosition(e, editPeriodClockText); _currentTextBoxSelected = _TextBoxEnum.PeriodTime; if (IsEditTextKey(e)) { string text = string.Empty; Logger.Instance.logMessage("textbox Length:" + editPeriodClockText.Text, LoggerEnum.message); if (editPeriodClockText.Text.Length > 0 && _currentCursorPosition <= editPeriodClockText.Text.Length) text = editPeriodClockText.Text.Remove(_currentCursorPosition - 1, 1).Insert(_currentCursorPosition - 1, getKeyString(e.Key)); if (Clocks.CLOCK_CHECK.IsMatch(text) && GameViewModel.Instance.IsInEditMode) { EditModeModel mode = new EditModeModel(); mode.EditModeType = EditModeEnum.jamClockChanged; mode.additionalInformation = Clocks.CLOCK_CHECK.Match(text).Value; GameViewModel.Instance.EditModeItems.Add(mode); GameViewModel.Instance.PeriodClock.changeSecondsOfClock(Convert.ToInt32(Clocks.convertTimeDisplayToSeconds(Clocks.CLOCK_CHECK.Match(text).Value))); } } } catch (Exception exception) { ErrorViewModel.Save(exception, GetType(), additionalInformation: _currentCursorPosition + ":" + e.Key + ":" + editPeriodClockText.Text + ":" + Logger.Instance.getLoggedMessages()); } e.Handled = true; }
private void downIntermissionTime_Click(object sender, RoutedEventArgs e) { try { EditModeModel mode = new EditModeModel(); mode.EditModeType = EditModeEnum.downIntermissionTime; GameViewModel.Instance.EditModeItems.Add(mode); GameViewModel.Instance.IntermissionClock.AddSecondsToClock(-1); } catch (Exception exception) { ErrorViewModel.Save(exception, GetType(), additionalInformation: Logger.Instance.getLoggedMessages()); } }
private void editJamClockText_PreviewKeyUp(object sender, KeyEventArgs e) { try { if (e.Key == Key.Back || e.Key == Key.Delete) { e.Handled = true; return; } //positions the cursor chooseCaretIndexPosition(e, editJamClockText); _currentTextBoxSelected = _TextBoxEnum.JamTime; if (IsEditTextKey(e)) { string text = ""; //check length bedcause of this error //Index and count must refer to a location within the string. Parameter name: count Logger.Instance.logMessage("textbox Length:" + editJamClockText.Text, LoggerEnum.message); if (editJamClockText.Text.Length > 0 && _currentCursorPosition <= editJamClockText.Text.Length) text = editJamClockText.Text.Remove(_currentCursorPosition - 1, 1).Insert(_currentCursorPosition - 1, getKeyString(e.Key)); if (Clocks.CLOCK_CHECK.IsMatch(text) && GameViewModel.Instance.IsInEditMode) { EditModeModel mode = new EditModeModel(); mode.EditModeType = EditModeEnum.jamClockChanged; mode.additionalInformation = Clocks.CLOCK_CHECK.Match(text).Value; GameViewModel.Instance.EditModeItems.Add(mode); GameViewModel.Instance.CurrentJam.JamClock.changeSecondsOfClock(Convert.ToInt32(Clocks.convertTimeDisplayToSeconds(Clocks.CLOCK_CHECK.Match(text).Value))); } } } catch (Exception exception) { ErrorViewModel.Save(exception, GetType(), additionalInformation: Logger.Instance.getLoggedMessages()); } e.Handled = true; }
/// <summary> /// changes the jam number on user input. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void editJamNumberText_TextChanged(object sender, TextChangedEventArgs e) { try { string text = editJamNumberText.Text; if (StringExt.IsNumber(text) && GameViewModel.Instance.IsInEditMode) { EditModeModel mode = new EditModeModel(); mode.EditModeType = EditModeEnum.jamNumberChanged; if (GameViewModel.Instance.EditModeItems == null) GameViewModel.Instance.EditModeItems = new List<EditModeModel>(); GameViewModel.Instance.EditModeItems.Add(mode); GameViewModel.Instance.CurrentJam.JamNumber = Convert.ToInt32(StringExt.NumberRegex.Match(text).Value); } } catch (Exception exception) { ErrorViewModel.Save(exception, GetType(), additionalInformation: Logger.Instance.getLoggedMessages()); } }
/// <summary> /// user entered a number to change the team 2 time outs. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void editTimeOutsRemainingTeam2Text_TextChanged(object sender, TextChangedEventArgs e) { try { string text = editTimeOutsRemainingTeam2Text.Text; if (StringExt.IsNumber(text) && GameViewModel.Instance.IsInEditMode) { EditModeModel mode = new EditModeModel(); mode.EditModeType = EditModeEnum.Team2TimeOutChange; mode.additionalInformation = StringExt.NumberRegex.Match(text).Value; GameViewModel.Instance.EditModeItems.Add(mode); GameViewModel.Instance.Team2.TimeOutsLeft = Convert.ToInt32(StringExt.NumberRegex.Match(text).Value); TimeOutsRemainingTeam1.Text = GameViewModel.Instance.Team1.TimeOutsLeft.ToString(); editTimeOutsRemainingTeam1Text.Text = GameViewModel.Instance.Team1.TimeOutsLeft.ToString(); } } catch (Exception exception) { ErrorViewModel.Save(exception, GetType(), additionalInformation: Logger.Instance.getLoggedMessages()); } }
private void downTeam2TimeOut_Click(object sender, RoutedEventArgs e) { try { EditModeModel mode = new EditModeModel(); mode.EditModeType = EditModeEnum.downTeam2TimeOut; GameViewModel.Instance.EditModeItems.Add(mode); GameViewModel.Instance.Team2.TimeOutsLeft -= 1; TimeOutsRemainingTeam2.Text = GameViewModel.Instance.Team2.TimeOutsLeft.ToString(); editTimeOutsRemainingTeam2Text.Text = GameViewModel.Instance.Team2.TimeOutsLeft.ToString(); Logger.Instance.logMessage("time outs down team 2", LoggerEnum.message); } catch (Exception exception) { ErrorViewModel.Save(exception, GetType(), additionalInformation: Logger.Instance.getLoggedMessages()); } }
private void downJamNumber_Click(object sender, RoutedEventArgs e) { try { EditModeModel mode = new EditModeModel(); mode.EditModeType = EditModeEnum.downJamNumber; GameViewModel.Instance.EditModeItems.Add(mode); GameViewModel.Instance.CurrentJam.JamNumber -= 1; } catch (Exception exception) { ErrorViewModel.Save(exception, GetType(), additionalInformation: Logger.Instance.getLoggedMessages()); } }