public bool TextareaOnKeyUp(string strId, string strText) { StoryEditor theSE; if (!CheckForProperEditToken(out theSE)) { return(false); } int nVerseIndex, nConversationIndex; if (!GetIndicesFromId(strId, out nVerseIndex, out nConversationIndex)) { return(false); } ConsultNoteDataConverter theCNDC = DataConverter(nVerseIndex, nConversationIndex); System.Diagnostics.Debug.Assert((theCNDC != null) && (theCNDC.Count > 0)); CommInstance aCI = theCNDC[theCNDC.Count - 1]; aCI.SetValue(strText); // indicate that the document has changed theSE.Modified = true; // update the status bar (in case we previously put an error there StoryStageLogic.StateTransition st = StoryStageLogic.stateTransitions[theSE.theCurrentStory.ProjStage.ProjectStage]; theSE.SetStatusBar(String.Format("{0} Press F1 for instructions", st.StageDisplayString)); return(true); }
protected void InitGrid() { dataGridViewPanorama.Rows.Clear(); foreach (StoryData aSD in _stories) { TimeSpan ts = DateTime.Now - aSD.StageTimeStamp; string strTimeInState = ""; if (ts.Days > 0) { strTimeInState += String.Format("{0} days, ", ts.Days); } if (ts.Hours > 0) { strTimeInState += String.Format("{0} hours, ", ts.Hours); } strTimeInState += String.Format("{0} minutes", ts.Minutes); StoryStageLogic.StateTransition st = StoryStageLogic.stateTransitions[aSD.ProjStage.ProjectStage]; object[] aObs = new object[] { aSD.Name, aSD.CraftingInfo.StoryPurpose, TeamMemberData.GetMemberTypeAsDisplayString(aSD.ProjStage.MemberTypeWithEditToken), st.StageDisplayString, strTimeInState }; int nRowIndex = dataGridViewPanorama.Rows.Add(aObs); DataGridViewRow aRow = dataGridViewPanorama.Rows[nRowIndex]; aRow.Tag = st; aRow.Height = _fontForDev.Height + 4; } }
protected void InitComboBox(StoryStageLogic.StateTransition stateTransition, string strColumnName) { int nIndex = dataGridViewStates.Rows.Add(); var dgcb = (DataGridViewComboBoxCell) dataGridViewStates.Rows[nIndex].Cells[strColumnName]; dgcb.Items.Add(stateTransition.StageDisplayString); dgcb.Items.Add(CstrEditState); dgcb.Items.Add(CstrDeleteState); dgcb.Items.Add(CstrAddState); dgcb.Value = stateTransition.StageDisplayString; }
public StateEditorForm(StoryStageLogic.StateTransition stateTransition) { InitializeComponent(); _stateTransition = stateTransition; textBoxStateName.Text = stateTransition.StageDisplayString; textBoxInstructions.Text = stateTransition.StageInstructions; checkBoxVernacular.Checked = stateTransition.IsVernacularVisible; checkBoxNationalBT.Checked = stateTransition.IsNationalBTVisible; checkBoxEnglishBT.Checked = stateTransition.IsEnglishBTVisible; checkBoxAnchors.Checked = stateTransition.IsAnchorVisible; checkBoxStoryTestingQuestions.Checked = stateTransition.IsStoryTestingQuestion; checkBoxRetelling.Checked = stateTransition.IsRetellingVisible; checkBoxConsultantNotes.Checked = stateTransition.IsConsultantNotesVisible; checkBoxCoachNotes.Checked = stateTransition.IsCoachNotesVisible; checkBoxBiblePane.Checked = stateTransition.IsNetBibleVisible; }
public bool TextareaOnKeyUp(string strId, string strText) { StoryEditor theSE; if (!CheckForProperEditToken(out theSE)) { return(false); } int nVerseIndex; string strTextElement; if (!GetIndicesFromId(strId, out nVerseIndex, out strTextElement)) { return(false); } if (strTextElement == CstrFieldNameVernacular) { StoryData.Verses[nVerseIndex].VernacularText.SetValue(strText); } else if (strTextElement == CstrFieldNameNationalBt) { StoryData.Verses[nVerseIndex].NationalBTText.SetValue(strText); } else if (strTextElement == CstrFieldNameInternationalBt) { StoryData.Verses[nVerseIndex].InternationalBTText.SetValue(strText); } // indicate that the document has changed theSE.Modified = true; // update the status bar (in case we previously put an error there StoryStageLogic.StateTransition st = StoryStageLogic.stateTransitions[theSE.theCurrentStory.ProjStage.ProjectStage]; theSE.SetStatusBar(String.Format("{0} Press F1 for instructions", st.StageDisplayString)); return(true); }
protected override void OnKeyDown(KeyEventArgs e) { Console.WriteLine(String.Format("KeyCode: {0}; KeyData: {1}, KeyValue: {2}", e.KeyCode, e.KeyData, e.KeyValue)); StoryEditor theSE = (StoryEditor)_ctrlVerseParent.FindForm(); try { if (theSE == null) { throw new ApplicationException( "Unable to edit the file! Try rebooting and if it persists, contact [email protected]"); } // certain keys (like arrow keys), we just want to allow in any case. if (!IsKeyAutomaticallyAllowed(theSE, e)) { if (!theSE.IsInStoriesSet) { throw theSE.CantEditOldStoriesEx; } // if the creator has defined a particular required editor (e.g. for consultant notes, // the *mentor* must be a *consultant*), then throw if we don't have one and always // allow the edit otherwise (since no one else can, we don't have to worry about conflicts). if (_delegateRequiredEditorCheck != null) // ... i.e. a req. editor checking delegate is defined { // throws if failure _delegateRequiredEditorCheck(theSE.LoggedOnMember.MemberType, _eRequiredEditor); } // finally, the last possible blockage is if the currently logged on member isn't the // right editor for the state we are in (which has to do with who has the edit token) if (!_stageLogic.IsEditAllowed(theSE.LoggedOnMember.MemberType)) { throw _stageLogic.WrongMemberTypeEx; } } // if we get here, we're all good! base.OnKeyDown(e); theSE.Modified = true; // to trigger save if exit. // update the status bar (in case we previously put an error there StoryStageLogic.StateTransition st = StoryStageLogic.stateTransitions[_stageLogic.ProjectStage]; theSE.SetStatusBar(String.Format("{0} Press F1 for instructions", st.StageDisplayString)); } catch (Exception ex) { Console.Beep(); if (theSE != null) { theSE.SetStatusBar(String.Format("Error: {0}", ex.Message)); } e.Handled = true; e.SuppressKeyPress = true; } }