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); }
/* doesn't seem to work... the 'value' member isn't updated until *after* * keyPress is executed. I could use event.keyCode to get the latest key * pressed, but that's not what I want. So have to use onKeyUp * public bool TextareaOnKeyPress(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]; * System.Diagnostics.Debug.WriteLine(String.Format("Was: {0}, now: {1}", * aCI, strText)); * aCI.SetValue(strText); * * // indicate that the document has changed * theSE.Modified = true; * return true; * } */ public void CopyScriptureReference(string strId) { int nVerseIndex, nConversationIndex; if (!GetIndicesFromId(strId, out nVerseIndex, out nConversationIndex)) { return; } ConsultNoteDataConverter theCNDC = DataConverter(nVerseIndex, nConversationIndex); System.Diagnostics.Debug.Assert((theCNDC != null) && (theCNDC.Count > 0)); CommInstance aCI = theCNDC[theCNDC.Count - 1]; if (Document != null) { HtmlDocument doc = Document; HtmlElement elem = doc.GetElementById(strId); if (elem != null) { System.Diagnostics.Debug.Assert(elem.InnerText == aCI.ToString()); elem.InnerText += TheSE.GetNetBibleScriptureReference; aCI.SetValue(elem.InnerText); elem.Focus(); } } }
public CommInstance(CommInstance rhs) : base(rhs.ToString()) { Direction = rhs.Direction; // the guid shouldn't be replicated Guid = System.Guid.NewGuid().ToString(); // rhs.Guid; TimeStamp = rhs.TimeStamp; }
static void DoConsultData(string[] astrFile, ref int nIndexLine, bool bUsingStoryProject, ConsultNotesDataConverter theCNsD, string strMentorSfm, string strMentorInitials, List <string> astrMenteeSfms, ConsultNoteDataConverter.CommunicationDirections eMentorToMentee, ConsultNoteDataConverter.CommunicationDirections eMenteeToMentor) { if (++nIndexLine >= astrFile.Length) { return; } int nConvNumber = 0, nNoteNumber = 0; string strMarker, strData; ParseLine(astrFile[nIndexLine], out strMarker, out strData); if (strMarker == @"\ln") { return; } while ((strMarker != @"\ln") && (strMarker != @"\c")) { ConsultNoteDataConverter con = null; if (theCNsD.Count > nConvNumber) { con = theCNsD[nConvNumber]; } int nRound = 1; if (strMarker == strMentorSfm) { try { char chRound = (strData.Substring(0, 2) == strMentorInitials) ? strData[2] : '1'; nRound = Convert.ToInt32(chRound.ToString()); } catch { } if (con == null) { con = theCNsD.AddEmpty(nRound); } if (con.Count > nNoteNumber) { CommInstance aCI = con[nNoteNumber]; System.Diagnostics.Debug.Assert((aCI.ToString() == strData) && (aCI.Direction == eMentorToMentee)); aCI.SetValue(strData); aCI.Direction = eMentorToMentee; } else { con.Add(new CommInstance(strData, eMentorToMentee, Guid.NewGuid().ToString())); } nNoteNumber++; } else if (astrMenteeSfms.Contains(strMarker)) { // sometimes the CIT has a comment for the coach if (con == null) { con = theCNsD.AddEmpty(nRound); } if (con.Count > nNoteNumber) { CommInstance aCI = con[nNoteNumber]; System.Diagnostics.Debug.Assert((aCI.ToString() == strData) && (aCI.Direction == eMenteeToMentor)); aCI.SetValue(strData); aCI.Direction = eMenteeToMentor; } else { con.Add(new CommInstance(strData, eMenteeToMentor, Guid.NewGuid().ToString())); } // for now, we just do two per conversation (or maybe 3 if the mentee started the conversation) if (++nNoteNumber >= 2) { nConvNumber++; nNoteNumber = 0; } } else if (lstSfmsToIgnore.Contains(strMarker)) { Console.WriteLine("Found, but don't care about marker:" + strMarker); } else if (!String.IsNullOrEmpty(strMarker) && !String.IsNullOrEmpty(strData)) { System.Diagnostics.Debug.Assert(false, String.Format("not handling the '{0}' marker", strMarker)); } if (++nIndexLine < astrFile.Length) { ParseLine(astrFile[nIndexLine], out strMarker, out strData); } else { break; } } }