internal override void ApplyPromptsFromRecordingList(PromptRecordingList recordingList) { Table table = GetPrompts(); bool didOne = false; for (int r = 0; r < table.GetNumRows(); r++) { string wording = table.GetData(r, (int)TableColumns.Prompts.Wording); string id = table.GetData(r, (int)TableColumns.Prompts.Id); string newWording = recordingList.getWording(id); if (newWording != null && newWording != wording) { table.SetData(r, (int)TableColumns.Prompts.Wording, newWording); //table.SetData(r, (int)TableColumns.Prompts.WordingDateStamp, DateTime.Now.ToString(Strings.DateColumnFormatString)); table.SetData(r, (int)TableColumns.Prompts.WordingDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion()); //JDK added table.SetData(r, (int)TableColumns.Prompts.IdDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion()); //JDK added didOne = true; } } if (didOne) { SetPrompts(table); } }
//JDK this was added to help with highlight colors with multiple versions on the same day internal static String MaxVersionWithDateColumn(string version, Table table, int column) { String maxVersion = version; String tempVersionStampFix = ""; //double decimalValue = 0; for (int r = 0; r < table.GetNumRows(); r++) { String lastVersionStamp = table.GetData(r, column); //NEW CODE STARTS HERE //if (lastVersionStamp.Trim().IndexOf("/")>=0 || lastVersionStamp.Trim().Equals("")) String tempCleanedVerLabel = CleanupVersionLabel(lastVersionStamp); if (!tempCleanedVerLabel.Equals(lastVersionStamp)) { DateTime tempDTStamp; if (DateTime.TryParse(lastVersionStamp, out tempDTStamp)) { tempVersionStampFix = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(tempDTStamp); lastVersionStamp = tempVersionStampFix; //lastVersionStamp = PathMaker.LookupChangeLogShadow().GetValidVersionString(PathMaker.LookupChangeLogShadow().GetChangeLog(), tempVersionStampFix); table.SetData(r, column, lastVersionStamp);//JDK temporarily removed for testing } } if (Common.ForcedStringVersionToDouble(lastVersionStamp) > Common.ForcedStringVersionToDouble(maxVersion)) { maxVersion = lastVersionStamp; } //NEW CODE ENDS HERE } return(maxVersion); }
/** * Utility method to return the highlight color given a change version label */ internal string GetColorStringForChange(string versionLabel) { Table table = GetChangeLog(); string color = Strings.HighlightColorNone; string tempVersionStampFix; //string pattern = "[a-zA-Z-]+"; //string replacement = ""; //Regex rgx = new Regex(pattern); //DateTime revisionDate;//from old style highlight fomratting DateTime date; if (versionLabel == null || versionLabel == "") { return(color); } versionLabel = Common.CleanupVersionLabel(versionLabel);//JDK ORIG //versionLabel = GetValidVersionString(table, Common.CleanupVersionLabel(versionLabel));//JDK added some extra validation; if (Common.ForcedStringVersionToDouble(versionLabel) > Common.ForcedStringVersionToDouble(GetLastChangeVersion())) { return(color); } //JDK This check will catch any fields with dates still in the hidden stamp fields if (versionLabel.Contains("/") && DateTime.TryParse(versionLabel, out date)) { tempVersionStampFix = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(date); //versionLabel = tempVersionStampFix; versionLabel = GetValidVersionString(table, tempVersionStampFix);//JDK added some extra validation //versionLabel = rgx.Replace(tempVersionStampFix, replacement); //return GetColorStringForChange(date);//will only do this for backward compatibility support } for (int r = 0; r < table.GetNumRows(); r++) { double decimalVal = 0; String revisionVersion = table.GetData(r, (int)TableColumns.ChangeLog.Version); decimalVal = Common.ForcedStringVersionToDouble(revisionVersion); if (decimalVal != 0) { if (decimalVal > Common.ForcedStringVersionToDouble(versionLabel)) { return(color); } else { color = table.GetData(r, (int)TableColumns.ChangeLog.Highlight); } } } return(color); }
internal override void AddPromptsToRecordingListVer(PromptRecordingList recordingList, String onOrAfterVersion) { Table table = GetPrompts(); //double number; for (int r = 0; r < table.GetNumRows(); r++) { string wording = table.GetData(r, (int)TableColumns.Prompts.Wording); string id = table.GetData(r, (int)TableColumns.Prompts.Id); string wordingDateString = table.GetData(r, (int)TableColumns.Prompts.WordingDateStamp); string idDateString = table.GetData(r, (int)TableColumns.Prompts.IdDateStamp); if (wordingDateString.Contains("/")) { DateTime tempDTStamp; if (DateTime.TryParse(onOrAfterVersion, out tempDTStamp)) { string tempVersionStampFix = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(tempDTStamp); wordingDateString = tempVersionStampFix; } } if (idDateString.Contains("/")) { DateTime tempDTStamp; if (DateTime.TryParse(onOrAfterVersion, out tempDTStamp)) { string tempVersionStampFix = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(tempDTStamp); idDateString = tempVersionStampFix; } } if (onOrAfterVersion != null) { if (!wordingDateString.Contains("/") && !idDateString.Contains("/")) { if (Common.ForcedStringVersionToDouble(wordingDateString) >= Common.ForcedStringVersionToDouble(onOrAfterVersion) || Common.ForcedStringVersionToDouble(idDateString) >= Common.ForcedStringVersionToDouble(onOrAfterVersion)) { if (id != null && id.Length > 0) { recordingList.AddPromptRecording(id, wording); } } } } else if (id != null && id.Length > 0) { recordingList.AddPromptRecording(id, wording); } } }
//JDK killed this one for the highlight fixes /*public static System.Drawing.Color? GetHighlightColor(string dateString) { * DateTime date; * if (DateTime.TryParse(dateString, out date)) * return GetHighlightColor(date); * else * return null; * } * */ /** * Returns the highlight color to be used given a change date. * If no highlight is needed, it will return the DefaultHighlightColor */ public static System.Drawing.Color?GetHighlightColor(DateTime date) { ChangeLogShadow shadow = PathMaker.LookupChangeLogShadow(); if (shadow == null) { return(null); } string color = shadow.GetColorStringForChange(date); return(ConvertColorStringToColor(color)); }
public override void OnConnectorChangeTarget(ConnectorShadow shadow) { Table table = GetTransitions(); for (int r = 0; r < table.GetNumRows(); r++) { if (table.GetData(r, (int)TableColumns.Transitions.Goto).Equals(shadow.GetUniqueId())) { //table.SetData(r, (int)TableColumns.Transitions.GotoDateStamp, DateTime.Now.ToString(Strings.DateColumnFormatString)); table.SetData(r, (int)TableColumns.Transitions.GotoDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion());//JDK added SetTransitionsWithoutRemovingOutputsForDeletedTransitions(table); break; } } }
internal static void SetTableDataAndDateIfNecessary(Table table, int row, string newValue, TableColumns.NameValuePairs valueColumn, TableColumns.NameValuePairs dateColumn) { string oldValue = table.GetData(row, (int)valueColumn); if (oldValue.Equals(newValue)) { return; } table.SetData(row, (int)valueColumn, newValue); //table.SetData(row, (int)dateColumn, DateTime.Today.ToString(Strings.DateColumnFormatString)); if (table.GetData(0, 0) != "Mode") { table.SetData(row, (int)dateColumn, PathMaker.LookupChangeLogShadow().GetLastChangeVersion());//JDK added this to fix highlighting by version } }
/** * Returns the highlight color to be used given a change version stamp. * If no highlight is needed, it will return the DefaultHighlightColor */ public static System.Drawing.Color?GetHighlightColor(string versionLabel) { ChangeLogShadow shadow = PathMaker.LookupChangeLogShadow(); if (shadow == null) { return(null); } String color = Strings.HighlightColorNone; if (versionLabel == null || versionLabel == "") { versionLabel = Strings.DefaultVersionStamp; } else { color = shadow.GetColorStringForChange(versionLabel); } return(ConvertColorStringToColor(color)); }
internal void SetSpecialSettings(Table table) { Table tmp = GetSpecialSettings(); if ((table.GetData(0, 0) == null || table.GetData(0, 0).Length == 0) && tmp.IsEmpty()) { return; } if (tmp.IsEmpty()) { //table.SetData(0, (int)TableColumns.SpecialSettings.TextDateStamp, DateTime.Now.ToString(Strings.DateColumnFormatString)); table.SetData(0, (int)TableColumns.SpecialSettings.TextDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion());//JDK added Common.SetCellTable(shape, ShapeProperties.Play.SpecialSettings, table); } else if (!tmp.GetData(0, (int)TableColumns.SpecialSettings.Text).Equals(table.GetData(0, (int)TableColumns.SpecialSettings.Text))) { //table.SetData(0, (int)TableColumns.SpecialSettings.TextDateStamp, DateTime.Now.ToString(Strings.DateColumnFormatString)); table.SetData(0, (int)TableColumns.SpecialSettings.TextDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion());//JDK added Common.SetCellTable(shape, ShapeProperties.Play.SpecialSettings, table); } }
internal override void RedoHiddenDateMarkers(StateShadow stateShadow) { //use this to force hidden date fields to be version numbers //Common.WarningMessage("PLAY SHADOW: Starting to loop thru table records"); Table table = GetPrompts(); String lastVersionStamp = base.GetLastChangeVersion(); String tempVersionStamp = ""; Boolean labelsUpdated = false; for (int r = 0; r < table.GetNumRows(); r++) { string wordingDateString = table.GetData(r, (int)TableColumns.Prompts.WordingDateStamp); string idDateString = table.GetData(r, (int)TableColumns.Prompts.IdDateStamp); if (!wordingDateString.Equals("") && wordingDateString.Contains("/")) { DateTime revisionDate; if (DateTime.TryParse(wordingDateString, out revisionDate)) { tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate); //Common.WarningMessage("PLAY: Wording Date was: " + wordingDateString + " and label update is: " + tempVersionStamp); table.SetData(r, (int)TableColumns.Prompts.WordingDateStamp, tempVersionStamp); labelsUpdated = true; } } if (!idDateString.Equals("") && idDateString.Contains("/")) { DateTime revisionDate; if (DateTime.TryParse(idDateString, out revisionDate)) { tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate); //Common.WarningMessage("PLAY: ID Date was: " + idDateString + " and label update is: " + tempVersionStamp); table.SetData(r, (int)TableColumns.Prompts.IdDateStamp, tempVersionStamp); labelsUpdated = true; } } } if (labelsUpdated) { SetPrompts(table); } table = GetTransitions(); for (int r = 0; r < table.GetNumRows(); r++) { string actionDateString = table.GetData(r, (int)TableColumns.Transitions.ActionDateStamp); string conditionDateString = table.GetData(r, (int)TableColumns.Transitions.ConditionDateStamp); string gotoDateString = table.GetData(r, (int)TableColumns.Transitions.GotoDateStamp); if (!actionDateString.Equals("") && actionDateString.Contains("/")) { DateTime revisionDate; if (DateTime.TryParse(actionDateString, out revisionDate)) { tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate); //Common.WarningMessage("PLAY: Wording Date was: " + actionDateString + " and label update is: " + tempVersionStamp); table.SetData(r, (int)TableColumns.Transitions.ActionDateStamp, tempVersionStamp); labelsUpdated = true; } } if (!conditionDateString.Equals("") && conditionDateString.Contains("/")) { DateTime revisionDate; if (DateTime.TryParse(conditionDateString, out revisionDate)) { tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate); //Common.WarningMessage("PLAY: ID Date was: " + idDateString + " and label update is: " + tempVersionStamp); table.SetData(r, (int)TableColumns.Transitions.ConditionDateStamp, tempVersionStamp); labelsUpdated = true; } } if (!gotoDateString.Equals("") && gotoDateString.Contains("/")) { DateTime revisionDate; if (DateTime.TryParse(gotoDateString, out revisionDate)) { tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate); //Common.WarningMessage("PLAY: ID Date was: " + idDateString + " and label update is: " + tempVersionStamp); table.SetData(r, (int)TableColumns.Transitions.GotoDateStamp, tempVersionStamp); labelsUpdated = true; } } } if (labelsUpdated) { SetTransitions(table); } labelsUpdated = false; table = GetDeveloperNotes(); for (int r = 0; r < table.GetNumRows(); r++) { string textDateStamp = table.GetData(r, (int)TableColumns.DeveloperNotes.TextDateStamp); if (textDateStamp.Contains("/")) { DateTime revisionDate; if (DateTime.TryParse(textDateStamp, out revisionDate)) { tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate); //.WarningMessage("INTERACTION: Conf Wording Date was: " + wordingDateString + " and label update is: " + tempVersionStamp); table.SetData(r, (int)TableColumns.DeveloperNotes.TextDateStamp, tempVersionStamp); labelsUpdated = true; } } } if (labelsUpdated) { SetDeveloperNotes(table); } labelsUpdated = false; table = GetSpecialSettings(); for (int r = 0; r < table.GetNumRows(); r++) { string textDateStamp = table.GetData(r, (int)TableColumns.SpecialSettings.TextDateStamp); if (textDateStamp.Contains("/")) { DateTime revisionDate; if (DateTime.TryParse(textDateStamp, out revisionDate)) { tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate); //.WarningMessage("INTERACTION: Conf Wording Date was: " + wordingDateString + " and label update is: " + tempVersionStamp); table.SetData(r, (int)TableColumns.SpecialSettings.TextDateStamp, tempVersionStamp); labelsUpdated = true; } } } if (labelsUpdated) { SetSpecialSettings(table); } }
internal override void RedoHiddenDateMarkers(StateShadow stateShadow) { //use this to force hidden date fields to be version numbers Table table = GetTransitions(); String lastVersionStamp = base.GetLastChangeVersion(); String tempVersionStamp = ""; Boolean labelsUpdated = false; for (int r = 0; r < table.GetNumRows(); r++) { string actionDateString = table.GetData(r, (int)TableColumns.Transitions.ActionDateStamp); string conditionDateString = table.GetData(r, (int)TableColumns.Transitions.ConditionDateStamp); string gotoDateString = table.GetData(r, (int)TableColumns.Transitions.GotoDateStamp); if (!actionDateString.Equals("") && actionDateString.Contains("/")) { DateTime revisionDate; if (DateTime.TryParse(actionDateString, out revisionDate)) { tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate); table.SetData(r, (int)TableColumns.Transitions.ActionDateStamp, tempVersionStamp); labelsUpdated = true; } } if (!conditionDateString.Equals("") && conditionDateString.Contains("/")) { DateTime revisionDate; if (DateTime.TryParse(conditionDateString, out revisionDate)) { tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate); table.SetData(r, (int)TableColumns.Transitions.ConditionDateStamp, tempVersionStamp); labelsUpdated = true; } } if (!gotoDateString.Equals("") && gotoDateString.Contains("/")) { DateTime revisionDate; if (DateTime.TryParse(gotoDateString, out revisionDate)) { tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate); table.SetData(r, (int)TableColumns.Transitions.GotoDateStamp, tempVersionStamp); labelsUpdated = true; } } } if (labelsUpdated) { SetTransitions(table); } labelsUpdated = false; table = GetDeveloperNotes(); for (int r = 0; r < table.GetNumRows(); r++) { string textDateStamp = table.GetData(r, (int)TableColumns.DeveloperNotes.TextDateStamp); if (textDateStamp.Contains("/")) { DateTime revisionDate; if (DateTime.TryParse(textDateStamp, out revisionDate)) { tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate); table.SetData(r, (int)TableColumns.DeveloperNotes.TextDateStamp, tempVersionStamp); labelsUpdated = true; } } } if (labelsUpdated) { SetDeveloperNotes(table); } }
internal override void RedoHiddenDateMarkers() { //use this to force hidden date fields to be version numbers //Common.WarningMessage("START SHAPE: Starting to loop thru table records"); Table table = GetPromptTypes(); String lastVersionStamp = Strings.DefaultVersionStamp; String tempVersionStamp = ""; Boolean labelsUpdated = false; for (int r = 0; r < table.GetNumRows(); r++) { string wordingDateString = table.GetData(r, (int)TableColumns.PromptTypes.WordingDateStamp); string idDateString = table.GetData(r, (int)TableColumns.PromptTypes.IdDateStamp); if (wordingDateString != "" && wordingDateString.Contains("/")) { DateTime revisionDate; if (DateTime.TryParse(wordingDateString, out revisionDate)) { tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate); //Common.WarningMessage("START SHAPE: Wording Date was: " + wordingDateString + " and label update is: " + tempVersionStamp); table.SetData(r, (int)TableColumns.PromptTypes.WordingDateStamp, tempVersionStamp); labelsUpdated = true; } } if (idDateString != "" && idDateString.Contains("/")) { DateTime revisionDate; if (DateTime.TryParse(idDateString, out revisionDate)) { tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate); //Common.WarningMessage("START SHAPE: ID Date was: " + idDateString + " and label update is: " + tempVersionStamp); table.SetData(r, (int)TableColumns.PromptTypes.IdDateStamp, tempVersionStamp); labelsUpdated = true; } } } if (labelsUpdated) { SetPromptTypes(table);//JDK Uncomment later } labelsUpdated = false; table = GetConfirmationPrompts(); for (int r = 0; r < table.GetNumRows(); r++) { string wordingDateString = table.GetData(r, (int)TableColumns.ConfirmationPrompts.WordingDateStamp); string idDateString = table.GetData(r, (int)TableColumns.ConfirmationPrompts.IdDateStamp); if (wordingDateString != "" && wordingDateString.Contains("/")) { DateTime revisionDate; if (DateTime.TryParse(wordingDateString, out revisionDate)) { tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate); //Common.WarningMessage("START SHAPE: Conf Wording Date was: " + wordingDateString + " and label update is: " + tempVersionStamp); table.SetData(r, (int)TableColumns.ConfirmationPrompts.WordingDateStamp, tempVersionStamp); labelsUpdated = true; } } if (idDateString != "" && idDateString.Contains("/")) { DateTime revisionDate; if (DateTime.TryParse(idDateString, out revisionDate)) { tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate); //Common.WarningMessage("START SHAPE: Conf ID Date was: " + idDateString + " and label update is: " + tempVersionStamp); table.SetData(r, (int)TableColumns.ConfirmationPrompts.IdDateStamp, tempVersionStamp); labelsUpdated = true; } } } //Common.WarningMessage("START SHAPE: Completed process for this Interaction state"); if (labelsUpdated) { SetConfirmationPrompts(table); } labelsUpdated = false; table = GetInitialization(); for (int r = 0; r < table.GetNumRows(); r++) { string nameDateString = table.GetData(r, (int)TableColumns.NameValuePairs.NameDateStamp); string notesDateString = table.GetData(r, (int)TableColumns.NameValuePairs.NotesDateStamp); string valueDateString = table.GetData(r, (int)TableColumns.NameValuePairs.ValueDateStamp); if (nameDateString != "" && nameDateString.Contains("/")) { DateTime revisionDate; if (DateTime.TryParse(nameDateString, out revisionDate)) { tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate); //Common.WarningMessage("START SHAPE: Conf Wording Date was: " + wordingDateString + " and label update is: " + tempVersionStamp); table.SetData(r, (int)TableColumns.NameValuePairs.NameDateStamp, tempVersionStamp); labelsUpdated = true; } } if (notesDateString != "" && notesDateString.Contains("/")) { DateTime revisionDate; if (DateTime.TryParse(notesDateString, out revisionDate)) { tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate); //Common.WarningMessage("START SHAPE: Conf ID Date was: " + idDateString + " and label update is: " + tempVersionStamp); table.SetData(r, (int)TableColumns.NameValuePairs.NotesDateStamp, tempVersionStamp); labelsUpdated = true; } } if (valueDateString != "" && valueDateString.Contains("/")) { DateTime revisionDate; if (DateTime.TryParse(valueDateString, out revisionDate)) { tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate); //Common.WarningMessage("START SHAPE: Conf ID Date was: " + idDateString + " and label update is: " + tempVersionStamp); table.SetData(r, (int)TableColumns.NameValuePairs.ValueDateStamp, tempVersionStamp); labelsUpdated = true; } } } //Common.WarningMessage("START SHAPE: Completed process for this Interaction state"); if (labelsUpdated) { SetInitialization(table); } }
// returns true if something was changed internal override bool RemoveGotosThatDontUseConnectors(string uidBeingRemoved) { Table table = GetMaxHandling(); bool changed = false; if (!table.IsEmpty()) { for (int r = 0; r < table.GetNumRows(); r++) { if (table.GetData(r, (int)TableColumns.MaxHandling.Goto).Equals(uidBeingRemoved)) { table.SetData(r, (int)TableColumns.MaxHandling.Goto, Strings.HangUpKeyword); //table.SetData(r, (int)TableColumns.MaxHandling.GotoDateStamp, DateTime.Now.ToString(Strings.DateColumnFormatString)); table.SetData(r, (int)TableColumns.MaxHandling.GotoDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion());//JDK added changed = true; } } if (changed) { SetMaxHandling(table); } } table = GetCommandTransitions(); if (!table.IsEmpty()) { for (int r = 0; r < table.GetNumRows(); r++) { if (table.GetData(r, (int)TableColumns.CommandTransitions.Goto).Equals(uidBeingRemoved)) { table.SetData(r, (int)TableColumns.CommandTransitions.Goto, Strings.HangUpKeyword); //table.SetData(r, (int)TableColumns.CommandTransitions.GotoDateStamp, DateTime.Now.ToString(Strings.DateColumnFormatString)); table.SetData(r, (int)TableColumns.CommandTransitions.GotoDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion());//JDK added changed = true; } } if (changed) { SetCommandTransitions(table); } } return(changed); }
internal static void ExportPromptListVer(String onOrAfterVersion, bool hyperLinks, AxMicrosoft.Office.Interop.VisOcx.AxDrawingControl visioControl) { string targetFilename; string currentFileName; if (saveFileDialog == null) { saveFileDialog = new SaveFileDialog(); saveFileDialog.Title = Common.GetResourceString(Strings.SavePromptsTitleRes); saveFileDialog.Filter = Common.GetResourceString(Strings.SavePromptsFilterRes); saveFileDialog.FilterIndex = 1; // Excel will ask about overwriting and I can't find a way to bypass that - so // skip it here and let excel do it on wb.close saveFileDialog.OverwritePrompt = false; } saveFileDialog.InitialDirectory = PathMaker.getCurrentFileDirectory(visioControl); targetFilename = visioControl.Src; currentFileName = System.IO.Path.GetFileName(targetFilename); saveFileDialog.FileName = Common.StripExtensionFileName(currentFileName) + "_Prompts.xlsx"; if (saveFileDialog.ShowDialog() == DialogResult.OK) { targetFilename = saveFileDialog.FileName; } else { return; } Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application(); if (excelApp == null) { Common.ErrorMessage("Couldn't start Excel - make sure it's installed"); return; } excelApp.Visible = false; Workbook wb = excelApp.Workbooks.Add(XlWBATemplate.xlWBATWorksheet); Worksheet ws = (Worksheet)wb.Worksheets[1]; if (ws == null) { Common.ErrorMessage("Excel worksheet couldn't be created."); return; } DocTitleShadow shadow = PathMaker.LookupDocTitleShadow(); string client = ""; string project = ""; if (shadow != null) { client = shadow.GetClientName(); project = shadow.GetProjectName(); } ws.Cells[1, 1].Value = "Client: " + client; ws.Cells[2, 1].Value = "Project: " + project; ws.Cells[3, 1].Value = "Date: " + DateTime.Now.ToString(Strings.DateColumnFormatString); ws.Columns["A:A"].ColumnWidth = 8; ws.Columns["B:C"].ColumnWidth = 30; ws.Columns["D:E"].ColumnWidth = 50; ((Range)ws.Columns["C:E"]).EntireColumn.WrapText = true; ws.Cells[5, 1].Value = "Count"; ws.Cells[5, 2].Value = "Prompt ID"; ws.Cells[5, 3].Value = "Duplicate IDs"; ws.Cells[5, 4].Value = "Prompt Wording"; ws.Cells[5, 5].Value = "Notes"; ws.Cells[5, 1].Font.Bold = true; ws.Cells[5, 2].Font.Bold = true; ws.Cells[5, 3].Font.Bold = true; ws.Cells[5, 4].Font.Bold = true; ws.Cells[5, 5].Font.Bold = true; if (onOrAfterVersion.Contains("/")) { DateTime tempDTStamp; if (DateTime.TryParse(onOrAfterVersion, out tempDTStamp)) { string tempVersionStampFix = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(tempDTStamp); onOrAfterVersion = tempVersionStampFix; } } PromptRecordingList recordingList = Common.GetPromptRecordingListVer(onOrAfterVersion); List <string> duplicateIdList = recordingList.GetDuplicatePromptIds(); if (duplicateIdList.Count > 0) { string list = String.Empty; int lineCounter = 1; foreach (string s in duplicateIdList) { list += s; list += ", "; if (list.Length > (lineCounter * 60)) { list += "\n"; lineCounter++; } } list = list.Substring(0, list.Length - 2); Common.ErrorMessage("Warning: multiple copies of prompt ids in the design.\n" + "Management and testing of each is NOT handled by the tools.\n" + "You are responsible for reviewing and testing that each is correct.\n" + "Recommended that you fix the prompt numbers and let the tools handle it.\n" + "\n" + "Duplicates:\n" + list); } int row = 7; int count = 1; foreach (PromptRecordingList.PromptRecording recording in recordingList.GetPromptRecordings()) { ws.Cells[row, 1] = count; ws.Cells[row, 2] = recording.PromptId; ws.Cells[row, 3] = MakeDuplicateString(recording.GetDuplicateIds()); string wording = Common.StripBracketLabels(recording.Wording); ws.Cells[row, 4] = wording; // if the whole wording is the label, there are no []s string label = Common.MakeLabelName(recording.Wording); if (label.Length != wording.Length) { ws.Cells[row, 5] = Common.MakeLabelName(recording.Wording); } if (hyperLinks) { string recordingFile = Common.GetResourceString(Strings.PromptRecordingLocationRes); recordingFile += "\\" + recording.PromptId + ".wav"; ws.Hyperlinks.Add(ws.Cells[row, 2], recordingFile); } row++; count++; } try { wb.SaveAs(targetFilename); } catch { } excelApp.Quit();; System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp); excelApp = null; }
internal static string ExportFastPathXML(AxMicrosoft.Office.Interop.VisOcx.AxDrawingControl visioControl, bool useTmpFile) { DocTitleShadow docTitleShadow = PathMaker.LookupDocTitleShadow(); if (docTitleShadow == null) { Common.ErrorMessage("Missing Document Title shape"); return(null); } StartShadow startShadow = PathMaker.LookupStartShadow(); if (startShadow == null) { Common.ErrorMessage("Missing Start shape"); return(null); } changeLogShadow = PathMaker.LookupChangeLogShadow(); if (changeLogShadow == null) { Common.ErrorMessage("Missing Change Log shape"); return(null); } if (saveFileDialog == null) { saveFileDialog = new SaveFileDialog(); saveFileDialog.Title = Common.GetResourceString(Strings.SaveFastPathXMLTitleRes); saveFileDialog.Filter = Common.GetResourceString(Strings.SaveFastPathXMLFilterRes); saveFileDialog.FilterIndex = 1; } saveFileDialog.InitialDirectory = PathMaker.getCurrentFileDirectory(visioControl); saveFileDialog.RestoreDirectory = true; targetFilename = visioControl.Src; currentFileName = System.IO.Path.GetFileName(targetFilename); saveFileDialog.FileName = Common.StripExtensionFileName(currentFileName) + ".xml"; if (!useTmpFile) { if (saveFileDialog.ShowDialog() == DialogResult.OK) { targetFilename = saveFileDialog.FileName; } else { return(null); } } else { targetFilename = saveFileDialog.FileName + ".tmp"; } XmlDocument xmlDoc = new XmlDocument(); xmlDoc.XmlResolver = null; xmlDoc.LoadXml(xmlStrings.Header); xmlDoc.DocumentElement.SetAttribute(xmlStrings.Project, docTitleShadow.GetProjectName()); xmlDoc.DocumentElement.SetAttribute(xmlStrings.Client, docTitleShadow.GetClientName()); xmlDoc.DocumentElement.SetAttribute(xmlStrings.LastModified, changeLogShadow.GetLastLogChangeDate()); xmlDoc.DocumentElement.SetAttribute(xmlStrings.Version, changeLogShadow.GetLastChangeVersion()); AddStartElement(xmlDoc, startShadow); List <Shadow> shadowList = PathMaker.LookupAllShadows(); // sorting them here helps the Missed statements in PathRunner come out in order string stateSortOrder = startShadow.GetDefaultSetting(Strings.DefaultSettingsStateSortOrder); if (stateSortOrder.Equals(Strings.StateSortOrderAlphaNumerical)) { shadowList.Sort(Common.StateIdShadowSorterAlphaNumerical); } else if (stateSortOrder.Equals(Strings.StateSortOrderNumericalOnly)) { shadowList.Sort(Common.StateIdShadowSorterNumericalAlpha); } else { Common.StateIdShadowSorterVisioHeuristic(shadowList, visioControl.Document, startShadow); } foreach (Shadow shadow in shadowList) { switch (shadow.GetShapeType()) { case ShapeTypes.Interaction: AddInteractionElement(xmlDoc, shadow as InteractionShadow); break; case ShapeTypes.Play: AddPlayElement(xmlDoc, shadow as PlayShadow); break; case ShapeTypes.Decision: AddDecisionElement(xmlDoc, shadow as DecisionShadow); break; case ShapeTypes.Data: AddDataElement(xmlDoc, shadow as DataShadow); break; case ShapeTypes.SubDialog: AddSubDialogElement(xmlDoc, shadow as SubDialogShadow); break; default: break; } } xmlDoc.Save(targetFilename); return(targetFilename); }
public static int RedoPromptTypeIds(ref Table table, string stateId, int startNumber, string promptIdFormat) { if (promptIdFormat.Equals(Strings.PromptIdFormatFull) || promptIdFormat.Equals(Strings.PromptIdFormatPartial)) { string statePrefix = ""; string stateNumber = ""; string stateName = ""; if (stateId != null) { StateShadow.DisectStateIdIntoParts(stateId, out statePrefix, out stateNumber, out stateName); } int added = 0; int[] nextNumArray = new int[26]; for (int i = 0; i < 26; i++) { nextNumArray[i] = 1; } char letter = Strings.DefaultPromptType.ToLower().Substring(0, 1)[0]; for (int row = 0; row < table.GetNumRows(); row++) { string type = table.GetData(row, (int)TableColumns.PromptTypes.Type); if (type != null && type.Trim().Length > 0) { letter = type.Trim().ToLower().Substring(0, 1)[0]; } if (letter - 'a' < 0 || letter - 'a' > 25) { letter = Strings.DefaultPromptType.ToLower().Substring(0, 1)[0]; } if (letter == Strings.DefaultConfirmationPromptLetter) { letter = Strings.DefaultExitBridgePromptLetter;//JDK 08-27-14 added this to prevent stepping on confirm prompting with special exit prompting } string wording = table.GetData(row, (int)TableColumns.PromptTypes.Wording); if (wording == null || wording.Length == 0 || wording.Trim().StartsWith(Strings.CalculatedPromptStartString) || wording.Trim().StartsWith(Strings.PromptTypeMacroStartString)) { continue; } string newPromptId; if (stateId != null) { if (promptIdFormat.Equals(Strings.PromptIdFormatFull)) { newPromptId = stateId + Strings.PromptIdSeparationChar + letter + Strings.PromptIdSeparationChar + nextNumArray[letter - 'a'].ToString(); } else { newPromptId = statePrefix + stateNumber + Strings.PromptIdSeparationChar + letter + Strings.PromptIdSeparationChar + nextNumArray[letter - 'a'].ToString(); } } else { newPromptId = Strings.GlobalPromptPrefix + Strings.PromptIdSeparationChar + letter + Strings.PromptIdSeparationChar + nextNumArray[letter - 'a'].ToString(); } if (!table.GetData(row, (int)TableColumns.PromptTypes.Id).Equals(newPromptId)) { table.SetData(row, (int)TableColumns.PromptTypes.Id, newPromptId); //table.SetData(row, (int)TableColumns.PromptTypes.IdDateStamp, DateTime.Now.ToString(Strings.DateColumnFormatString)); table.SetData(row, (int)TableColumns.PromptTypes.IdDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion());//JDK added } nextNumArray[letter - 'a']++; added++; } return(added); } else if (promptIdFormat.Equals(Strings.PromptIdFormatNumeric)) { int nextNum = startNumber; for (int row = 0; row < table.GetNumRows(); row++) { string wording = table.GetData(row, (int)TableColumns.PromptTypes.Wording); if (wording == null || wording.Length == 0 || wording.Trim().StartsWith(Strings.CalculatedPromptStartString) || wording.Trim().StartsWith(Strings.PromptTypeMacroStartString)) { continue; } table.SetData(row, (int)TableColumns.PromptTypes.Id, nextNum.ToString()); //table.SetData(row, (int)TableColumns.PromptTypes.IdDateStamp, DateTime.Now.ToString(Strings.DateColumnFormatString)); table.SetData(row, (int)TableColumns.PromptTypes.IdDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion());//JDK added nextNum++; } return(nextNum - startNumber); } else { return(0); } }
public static void RedoAllHiddenPromptMarkers() { //the start step has globals and default confirmation prompts that must be modified as well Shadow startStep = PathMaker.LookupStartShadow(); ChangeLogShadow changeLogShadow = PathMaker.LookupChangeLogShadow(); DateTime triggerDate; DateTime.TryParse(Strings.StampFormatChangeDate, out triggerDate); //Common.WarningMessage("changeLogShadow.GetLastChangeDate() = " + changeLogShadow.GetLastChangeDate()); if ((startStep != null) && (changeLogShadow.GetLastChangeDate() <= triggerDate)) { string tmpAlertMsg = "* * * ALERT - CHANGE TRACKING FORMATS WILL BE UPDATED! * * *" + "\r\n\r\nHidden date stamps will now use version numbers instead." + "\r\n\r\nThis makes it INCOMPATIBLE with older versions of PathMaker." + "\r\n\r\nAdd a new Revision History line for this file update process with NO HIGHLIGHT COLOR." + " Then select SAVE AS and create a new .VUI file once the table update is complete." + " You may then add a new Revision Histroy record to begin documenting your design changes with highlights." + " Old colors should be fine if left on during this update process."; Common.WarningMessage(tmpAlertMsg); //scrub the version stamps in the ChangeLogShadow before any other processing takes place - we do not want any aplhas in the version strings for float comparisons later Table table = changeLogShadow.GetChangeLog(); String lastVersionStamp = ""; string tempScrubbedVer = ""; Boolean versionStampsUpdated = false; for (int r = 0; r < table.GetNumRows(); r++) { lastVersionStamp = table.GetData(r, (int)TableColumns.ChangeLog.Version); tempScrubbedVer = Common.CleanupVersionLabel(lastVersionStamp); if (!tempScrubbedVer.Equals(lastVersionStamp)) { table.SetData(r, (int)TableColumns.ChangeLog.Version, tempScrubbedVer); versionStampsUpdated = true; } } if (versionStampsUpdated) { changeLogShadow.SetChangeLog(table); } startStep.RedoHiddenDateMarkers(); List <Shadow> shadowList = PathMaker.LookupAllShadows(); //JDK added this to update old diagrams with hidden date stamps to new version stamp format foreach (Shadow s in shadowList) { StateShadow stateShadow = s as StateShadow; if (stateShadow != null && (stateShadow.GetShapeType().Equals(ShapeTypes.Play) || stateShadow.GetShapeType().Equals(ShapeTypes.Interaction))) { stateShadow.RedoHiddenDateMarkers(stateShadow); //Common.WarningMessage("Skipping RedoHiddenDateMarkers"); } if (stateShadow != null && (stateShadow.GetShapeType().Equals(ShapeTypes.Decision) || stateShadow.GetShapeType().Equals(ShapeTypes.Data))) { StateWithTransitionShadow stateTranShadow = s as StateWithTransitionShadow; //Common.WarningMessage("Starting RedoHiddenDateMarkers for Decision or Data State:" + stateTranShadow.GetStateId()); stateTranShadow.RedoHiddenDateMarkers(stateTranShadow); } } } }
public override void OnConnectorLabelChange(ConnectorShadow shadow) { Table table = GetTransitions(); for (int r = 0; r < table.GetNumRows(); r++) { if (table.GetData(r, (int)TableColumns.Transitions.Goto).Equals(shadow.GetUniqueId())) { string condition = table.GetData(r, (int)TableColumns.Transitions.Condition); string newCondition = CommonShadow.GetStringWithNewConnectorLabel(condition, shadow.GetLabelName()); if (!condition.Equals(newCondition)) { table.SetData(r, (int)TableColumns.Transitions.Condition, newCondition); //table.SetData(r, (int)TableColumns.Transitions.ConditionDateStamp, DateTime.Now.ToString(Strings.DateColumnFormatString)); table.SetData(r, (int)TableColumns.Transitions.ConditionDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion());//JDK added SetTransitionsWithoutRemovingOutputsForDeletedTransitions(table); } break; } } }
internal Table GetDefaultSettings() { Table table = Common.GetCellTable(shape, ShapeProperties.Start.DefaultSettings); if (table.IsEmpty()) { table = new Table(DefaultSettingsLabels.Length, Enum.GetNames(typeof(TableColumns.NameValuePairs)).Length); for (int row = 0; row < DefaultSettingsLabels.Length; row++) { table.SetData(row, (int)TableColumns.NameValuePairs.Name, DefaultSettingsLabels[row]); table.SetData(row, (int)TableColumns.NameValuePairs.Value, DefaultSettingsValues[row]); table.SetData(row, (int)TableColumns.NameValuePairs.Notes, DefaultSettingsValues[row]); table.SetData(row, (int)TableColumns.NameValuePairs.NameDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion()); table.SetData(row, (int)TableColumns.NameValuePairs.ValueDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion()); table.SetData(row, (int)TableColumns.NameValuePairs.NotesDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion()); } } return(table); }
private int RedoPromptIds(int startNumber, string promptIdFormat, Table table) { if (promptIdFormat.Equals(Strings.PromptIdFormatFull) || promptIdFormat.Equals(Strings.PromptIdFormatPartial)) { string stateId = GetStateId(); string statePrefix, stateNumber, stateName; DisectStateIdIntoParts(stateId, out statePrefix, out stateNumber, out stateName); int nextNum = 1; for (int row = 0; row < table.GetNumRows(); row++) { string wording = table.GetData(row, (int)TableColumns.Prompts.Wording); if (wording == null || wording.Length == 0 || wording.Trim().StartsWith(Strings.CalculatedPromptStartString) || wording.Trim().StartsWith(Strings.PromptTypeMacroStartString)) { continue; } string newPromptId; if (stateId != null) { if (promptIdFormat.Equals(Strings.PromptIdFormatFull)) { newPromptId = stateId + Strings.PromptIdSeparationChar + Strings.DefaultPromptLetter + Strings.PromptIdSeparationChar + nextNum.ToString(); } else { newPromptId = statePrefix + stateNumber + Strings.PromptIdSeparationChar + Strings.DefaultPromptLetter + Strings.PromptIdSeparationChar + nextNum.ToString(); } } else { newPromptId = Strings.DefaultPromptLetter.ToString() + Strings.PromptIdSeparationChar + nextNum; } if (!table.GetData(row, (int)TableColumns.Prompts.Id).Equals(newPromptId)) { table.SetData(row, (int)TableColumns.Prompts.Id, newPromptId); //table.SetData(row, (int)TableColumns.Prompts.IdDateStamp, DateTime.Now.ToString(Strings.DateColumnFormatString)); table.SetData(row, (int)TableColumns.Prompts.IdDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion());//JDK added } nextNum++; } if (nextNum - 1 > 0) { SetPrompts(table); } return(nextNum - 1); } else if (promptIdFormat.Equals(Strings.PromptIdFormatNumeric)) { int nextNum = startNumber; for (int row = 0; row < table.GetNumRows(); row++) { string wording = table.GetData(row, (int)TableColumns.Prompts.Wording); if (wording == null || wording.Length == 0 || wording.Trim().StartsWith(Strings.CalculatedPromptStartString) || wording.Trim().StartsWith(Strings.PromptTypeMacroStartString)) { continue; } table.SetData(row, (int)TableColumns.Prompts.Id, nextNum.ToString()); //table.SetData(row, (int)TableColumns.Prompts.IdDateStamp, DateTime.Now.ToString(Strings.DateColumnFormatString)); table.SetData(row, (int)TableColumns.Prompts.IdDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion());//JDK added nextNum++; } if (nextNum - startNumber > 0) { SetPrompts(table); } return(nextNum - startNumber); } else { return(0); } }
public override void OnConnectAddOutput(Shadow shadow) { base.OnConnectAddOutput(shadow); Table table = GetTransitions(); // make sure it's not already in there - this can happen with undo/redo for (int r = 0; r < table.GetNumRows(); r++) { if (table.GetData(r, (int)TableColumns.Transitions.Goto).Equals(shadow.GetUniqueId())) { return; } } if (table.IsEmpty()) { table = new Table(1, Enum.GetNames(typeof(TableColumns.Transitions)).Length); } else { table.AddRow(); } ConnectorShadow connector = shadow as ConnectorShadow; if (connector != null) { string label = connector.GetLabelName(); if (label.Length > 0) { table.SetData(table.GetNumRows() - 1, (int)TableColumns.Transitions.Condition, CommonShadow.GetStringWithNewConnectorLabel("", label)); //table.SetData(table.GetNumRows() - 1, (int)TableColumns.Transitions.ConditionDateStamp, DateTime.Today.ToString(Strings.DateColumnFormatString)); table.SetData(table.GetNumRows() - 1, (int)TableColumns.Transitions.ConditionDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion()); } } table.SetData(table.GetNumRows() - 1, (int)TableColumns.Transitions.Goto, shadow.GetUniqueId()); //table.SetData(table.GetNumRows() - 1, (int)TableColumns.Transitions.GotoDateStamp, DateTime.Today.ToString(Strings.DateColumnFormatString)); table.SetData(table.GetNumRows() - 1, (int)TableColumns.Transitions.GotoDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion()); SetTransitionsWithoutRemovingOutputsForDeletedTransitions(table); }