Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
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);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public static int RedoConfirmationPromptIds(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 nextNum = 1;

                for (int row = 0; row < table.GetNumRows(); row++)
                {
                    string wording = table.GetData(row, (int)TableColumns.ConfirmationPrompts.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.DefaultConfirmationPromptLetter + Strings.PromptIdSeparationChar + nextNum.ToString();
                        }
                        else
                        {
                            newPromptId = statePrefix + stateNumber + Strings.PromptIdSeparationChar + Strings.DefaultConfirmationPromptLetter + Strings.PromptIdSeparationChar + nextNum.ToString();
                        }
                    }
                    else
                    {
                        newPromptId = Strings.GlobalPromptPrefix.ToString() + Strings.PromptIdSeparationChar +
                                      Strings.DefaultConfirmationPromptLetter.ToString() + Strings.PromptIdSeparationChar + nextNum;
                    }

                    if (!table.GetData(row, (int)TableColumns.ConfirmationPrompts.Id).Equals(newPromptId))
                    {
                        table.SetData(row, (int)TableColumns.ConfirmationPrompts.Id, newPromptId);
                        //table.SetData(row, (int)TableColumns.ConfirmationPrompts.IdDateStamp, DateTime.Now.ToString(Strings.DateColumnFormatString));
                        table.SetData(row, (int)TableColumns.ConfirmationPrompts.IdDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion());//JDK added
                    }
                    nextNum++;
                }

                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.ConfirmationPrompts.Wording);
                    if (wording == null || wording.Length == 0 || wording.Trim().StartsWith(Strings.CalculatedPromptStartString) || wording.Trim().StartsWith(Strings.PromptTypeMacroStartString))
                    {
                        continue;
                    }

                    table.SetData(row, (int)TableColumns.ConfirmationPrompts.Id, nextNum.ToString());
                    //table.SetData(row, (int)TableColumns.ConfirmationPrompts.IdDateStamp, DateTime.Now.ToString(Strings.DateColumnFormatString));
                    table.SetData(row, (int)TableColumns.ConfirmationPrompts.IdDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion());//JDK added

                    nextNum++;
                }

                return(nextNum - startNumber);
            }
            else
            {
                return(0);
            }
        }
Ejemplo n.º 5
0
        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;
                }
            }
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        internal override void AddPromptsToRecordingListVer(PromptRecordingList recordingList, String onOrAfterVersion)
        {
            Table table = GetPromptTypes();

            //double number;

            for (int r = 0; r < table.GetNumRows(); r++)
            {
                string wording           = table.GetData(r, (int)TableColumns.PromptTypes.Wording);
                string id                = table.GetData(r, (int)TableColumns.PromptTypes.Id);
                string wordingDateString = table.GetData(r, (int)TableColumns.PromptTypes.WordingDateStamp);
                string idDateString      = table.GetData(r, (int)TableColumns.PromptTypes.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);
                }
            }

            table = GetConfirmationPrompts();
            for (int r = 0; r < table.GetNumRows(); r++)
            {
                string wording           = table.GetData(r, (int)TableColumns.ConfirmationPrompts.Wording);
                string id                = table.GetData(r, (int)TableColumns.ConfirmationPrompts.Id);
                string wordingDateString = table.GetData(r, (int)TableColumns.ConfirmationPrompts.WordingDateStamp);
                string idDateString      = table.GetData(r, (int)TableColumns.ConfirmationPrompts.IdDateStamp);
                if (idDateString == "" && wordingDateString != "")
                {
                    idDateString = wordingDateString;
                }
                else if (wordingDateString == "" && idDateString != "")
                {
                    wordingDateString = idDateString;
                }

                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);
                }
            }
        }
Ejemplo n.º 8
0
        protected override void OnRunWorkerCompleted(RunWorkerCompletedEventArgs e)
        {
            base.OnRunWorkerCompleted(e);

            // Check to see if the background process was cancelled.
            if (e.Cancelled || cancelUIRun)
            {
                DeleteTmpFile();
                HttpWebRequest cancelRequest = HttpWebRequest.Create(PathMaker.GetValidationServer() + "PathRunnerRequestHandler.jsp?Action=StopWalkingClientTag&ClientTag=" + guid) as HttpWebRequest;
                //HttpWebRequest cancelRequest = HttpWebRequest.Create(Strings.SERVERNAME + "PathRunnerRequestHandler.jsp?Action=StopWalkingClientTag&ClientTag=" + guid) as HttpWebRequest;
                HttpWebResponse cancelResponse = null;

                try {
                    cancelResponse = cancelRequest.GetResponse() as HttpWebResponse;
                }
                catch (WebException) {
                    // usually because we aren't connected which has already been reported on the original request, ignore
                }
                finally {
                    if (cancelResponse != null)
                    {
                        cancelResponse.Close();
                    }
                }

                guid        = Guid.Empty;
                cancelUIRun = false;
            }
            else
            {
                guid = Guid.Empty;
                //Change html special characters
                htmlResults = WebUtility.HtmlDecode(htmlResults);
                htmlResults = htmlResults.Replace("<br>", "\n");
                htmlResults = htmlResults.TrimStart('\r', '\n');
                if (htmlResults.Length > 0)
                {
                    if (htmlResults.Contains("SaveFile.jsp?filename="))
                    {
                        string[] splitLine = Regex.Split(htmlResults, "\r\n\n");
                        string   tmpline   = splitLine.Last();
                        int      start     = tmpline.LastIndexOf("SaveFile.jsp?filename=") + 21;
                        int      end       = tmpline.LastIndexOf("debug.zip") + 9;
                        if (end == -1)
                        {
                            end = tmpline.Length;
                        }
                        filename = tmpline.Substring(start + 1, end - start - 1);
                        GetSaveFile();
                        //Remove last line that has zip file information so it doesn't show up in output
                        string newhtml = string.Empty;
                        for (int x = 0; x < splitLine.Length - 1; x++)
                        {
                            if (x < splitLine.Length - 2)
                            {
                                newhtml += splitLine[x] + "\r\n\n";
                            }
                            else
                            {
                                //don't add line return for last line, it causes a blank line in grid
                                newhtml += splitLine[x];
                            }
                        }
                        htmlResults = newhtml;
                    }
                    DeleteTmpFile();
                }
                else
                {
                    htmlResults = "No results returned from PathMaker";
                }
            }
            if (htmlResults.Length > 0)
            {
                ValidateResultsForm UISpecResults = new ValidateResultsForm(htmlResults, validationData.visioControl, Strings.UISPECRESULTSFORM);
                UISpecResults.Show();
            }
        }
Ejemplo n.º 9
0
 private void fastPathClassroomToolStripMenuItem_Click(object sender, EventArgs e)
 {
     System.Diagnostics.Process.Start(PathMaker.GetValidationServer() + "Classroom.jsp");
 }
Ejemplo n.º 10
0
        internal override void ApplyPromptsFromRecordingList(PromptRecordingList recordingList)
        {
            Table table  = GetPromptTypes();
            bool  didOne = false;

            for (int r = 0; r < table.GetNumRows(); r++)
            {
                string wording = table.GetData(r, (int)TableColumns.PromptTypes.Wording);
                string id      = table.GetData(r, (int)TableColumns.PromptTypes.Id);

                string newWording = recordingList.getWording(id);
                if (newWording != null && newWording != wording)
                {
                    table.SetData(r, (int)TableColumns.PromptTypes.Wording, newWording);
                    //table.SetData(r, (int)TableColumns.PromptTypes.WordingDateStamp, DateTime.Now.ToString(Strings.DateColumnFormatString));
                    table.SetData(r, (int)TableColumns.PromptTypes.WordingDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion()); //JDK added
                    table.SetData(r, (int)TableColumns.PromptTypes.IdDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion());      //JDK added

                    didOne = true;
                }
            }
            if (didOne)
            {
                SetPromptTypes(table);
            }

            didOne = false;
            table  = GetConfirmationPrompts();
            for (int r = 0; r < table.GetNumRows(); r++)
            {
                string wording = table.GetData(r, (int)TableColumns.ConfirmationPrompts.Wording);
                string id      = table.GetData(r, (int)TableColumns.ConfirmationPrompts.Id);

                string newWording = recordingList.getWording(id);
                if (newWording != null && newWording != wording)
                {
                    table.SetData(r, (int)TableColumns.ConfirmationPrompts.Wording, newWording);
                    //table.SetData(r, (int)TableColumns.ConfirmationPrompts.WordingDateStamp, DateTime.Now.ToString(Strings.DateColumnFormatString));
                    table.SetData(r, (int)TableColumns.ConfirmationPrompts.WordingDateStamp, PathMaker.LookupChangeLogShadow().GetLastChangeVersion());//JDK added

                    didOne = true;
                }
            }
            if (didOne)
            {
                SetConfirmationPrompts(table);
            }
        }
Ejemplo n.º 11
0
        public static void LoadCommandTransitionDataGridView(DataGridView gridView, Table table)
        {
            BindingList <CommandTransitionRow> ctList = CommandTransitionRow.GetRowsFromTable(table);
            string myDefaultConfirmValue = PathMaker.LookupStartShadow().GetDefaultConfirmMode();

            if (gridView.Columns.Count == 0)
            {
                gridView.AutoGenerateColumns = false;
                AddTextBoxColumn(gridView, CommandTransitionRow.OptionColumnName);
                AddTextBoxColumn(gridView, CommandTransitionRow.VocabColumnName);
                AddTextBoxColumn(gridView, CommandTransitionRow.DTMFColumnName);
                AddTextBoxColumn(gridView, CommandTransitionRow.ConditionColumnName);
                AddTextBoxColumn(gridView, CommandTransitionRow.ActionColumnName);
                AddTextBoxColumn(gridView, CommandTransitionRow.GotoColumnName);
                AddStringComboBoxColumn(gridView, CommandTransitionRow.ConfirmColumnName);
                //LoadComboBoxColumn(gridView, CommandTransitionRow.ConfirmColumnName, confirmValues);
                LoadComboBoxColumn(gridView, CommandTransitionRow.ConfirmColumnName, confirmValues, PathMaker.LookupStartShadow().GetDefaultConfirmMode());//JDK - need to find a way to set display default here - it DOES NOT work with Never as the default value
                AddTextBoxColumn(gridView, CommandTransitionRow.OptionDateStampColumnName);
                AddTextBoxColumn(gridView, CommandTransitionRow.VocabDateStampColumnName);
                AddTextBoxColumn(gridView, CommandTransitionRow.DTMFDateStampColumnName);
                AddTextBoxColumn(gridView, CommandTransitionRow.ConditionDateStampColumnName);
                AddTextBoxColumn(gridView, CommandTransitionRow.ActionDateStampColumnName);
                AddTextBoxColumn(gridView, CommandTransitionRow.GotoDateStampColumnName);
                AddTextBoxColumn(gridView, CommandTransitionRow.ConfirmDateStampColumnName);

                gridView.DefaultValuesNeeded -= new DataGridViewRowEventHandler(OnCommandTransitionDefaultValuesNeeded);
                gridView.DefaultValuesNeeded += new DataGridViewRowEventHandler(OnCommandTransitionDefaultValuesNeeded);
                //gridView.RowsAdded - new DataGridViewCellFormattingEventHandler(OnCellDropBoxCellSettingDefault);//JDK
                //gridView.RowsAdded -= new DataGridViewRowsAddedEventHandler(OnCellDropBoxCellSettingDefault);//JDK
                //gridView.DefaultValuesNeeded += new DataGridViewRowEventHandler(OnCellDropBoxCellSettingDefault);//JDK

                ApplyCommonDataGridViewSettings <CommandTransitionRow>(gridView, false);
                HideDateStampColumns(gridView);
                gridView.Columns[CommandTransitionRow.GotoColumnName].ReadOnly = true;
            }

            gridView.DataSource = ctList;
        }
Ejemplo n.º 12
0
        public static void LoadStartCommandTransitionDataGridView(DataGridView gridView, Table table)
        {
            BindingList <StartCommandTransitionRow> ctList = StartCommandTransitionRow.GetRowsFromTable(table);

            if (gridView.Columns.Count == 0)
            {
                gridView.AutoGenerateColumns = false;
                AddTextBoxColumn(gridView, CommandTransitionRow.OptionColumnName);
                AddTextBoxColumn(gridView, CommandTransitionRow.VocabColumnName);
                AddTextBoxColumn(gridView, CommandTransitionRow.DTMFColumnName);
                AddTextBoxColumn(gridView, CommandTransitionRow.ConditionColumnName);
                AddTextBoxColumn(gridView, CommandTransitionRow.ActionColumnName);
                AddItemComboBoxColumn(gridView, CommandTransitionRow.GotoColumnName);
                AddStringComboBoxColumn(gridView, CommandTransitionRow.ConfirmColumnName);
                //LoadComboBoxColumn(gridView, CommandTransitionRow.ConfirmColumnName, confirmValues);
                LoadComboBoxColumn(gridView, CommandTransitionRow.ConfirmColumnName, confirmValues, PathMaker.LookupStartShadow().GetDefaultConfirmMode());//JDK Added this - it works with Never as the default value
                AddTextBoxColumn(gridView, CommandTransitionRow.OptionDateStampColumnName);
                AddTextBoxColumn(gridView, CommandTransitionRow.VocabDateStampColumnName);
                AddTextBoxColumn(gridView, CommandTransitionRow.DTMFDateStampColumnName);
                AddTextBoxColumn(gridView, CommandTransitionRow.ConditionDateStampColumnName);
                AddTextBoxColumn(gridView, CommandTransitionRow.ActionDateStampColumnName);
                AddTextBoxColumn(gridView, CommandTransitionRow.GotoDateStampColumnName);
                AddTextBoxColumn(gridView, CommandTransitionRow.ConfirmDateStampColumnName);

                gridView.DefaultValuesNeeded -= new DataGridViewRowEventHandler(OnCommandTransitionDefaultValuesNeeded);
                gridView.DefaultValuesNeeded += new DataGridViewRowEventHandler(OnCommandTransitionDefaultValuesNeeded);

                ApplyCommonDataGridViewSettings <StartCommandTransitionRow>(gridView, true);
                HideDateStampColumns(gridView);
            }

            // loaded each time to make sure there's a full list of state names
            LoadItemComboBoxColumn(gridView, CommandTransitionRow.GotoColumnName, GetAllPossibleGotos());

            gridView.DataSource = ctList;
        }
Ejemplo n.º 13
0
        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);
            }
        }
Ejemplo n.º 14
0
        internal static void ExportPromptList(DateTime?onOrAfterDate, 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;

            PromptRecordingList recordingList = Common.GetPromptRecordingList(onOrAfterDate);

            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;
        }
Ejemplo n.º 15
0
        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);
            }
        }
Ejemplo n.º 16
0
        internal static void ExportDesignNotes(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) + "_DesignNotes.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.Cells[1, 1].Font.Bold = true;
            ws.Cells[2, 1].Font.Bold = true;
            ws.Cells[3, 1].Font.Bold = true;

            ws.Columns["A:A"].ColumnWidth = 6;
            ws.Columns["B:B"].ColumnWidth = 40;
            ws.Columns["C:C"].ColumnWidth = 100;
            ws.Columns["D:D"].ColumnWidth = 16;

            ((Range)ws.Columns["C:C"]).EntireColumn.WrapText = true;

            ws.Cells[5, 1].Value = "Count";
            ws.Cells[5, 2].Value = "State Name";
            ws.Cells[5, 3].Value = "Design Notes";
            ws.Cells[5, 4].Value = "Last Updated";

            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, 4].HorizontalAlignment    = XlHAlign.xlHAlignLeft;
            ws.Columns["D:D"].HorizontalAlignment = XlHAlign.xlHAlignLeft;

            DesignNotesList designNotesList = Common.GetDesignNotesList();

            char[] delimiterChars = { '@' };
            //raw text looks like this... "design notes have been updated again@@02/18/2014"
            //splitting inot two parts for XLS writing

            int row   = 6;
            int count = 1;

            if (designNotesList.GetDesignNotes().Count >= 1)
            {
                foreach (DesignNotesList.DesignNoteContent designNote in designNotesList.GetDesignNotes())
                {
                    ws.Cells[row, 1] = count;
                    ws.Cells[row, 2] = designNote.StateId;

                    //string wording = Common.StripBracketLabels(designNote.Wording);
                    string[] notes = Common.StripBracketLabels(designNote.Wording).Split(delimiterChars);

                    if (notes[0].Length > 0)
                    {
                        ws.Cells[row, 3] = notes[0];
                        string lastUpdated = notes[2];
                        ws.Cells[row, 4] = lastUpdated;
                        ws.Rows[row].VerticalAlignment       = XlVAlign.xlVAlignCenter;
                        ws.Cells[row, 1].HorizontalAlignment = XlHAlign.xlHAlignCenter;
                    }
                    row++;
                    count++;
                }

                try
                {
                    wb.SaveAs(targetFilename);
                }
                catch
                {
                    Common.ErrorMessage("Excel worksheet couldn't be created.");
                }
            }
            else
            {
                Common.ErrorMessage("Excel worksheet generation skipped - no Design Notes found in VUI file.");
            }
            excelApp.Quit();
            System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp);
            excelApp = null;
        }
Ejemplo n.º 17
0
        // 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);
        }
Ejemplo n.º 18
0
        public void CallValidateSpecWorkerJSP(ValidationData validationData)
        {
            this.validationData = validationData;

            HttpWebResponse httpWebResponse = null;
            string          xmlFileName     = Common.StripExtensionFileName(validationData.vuiFileName) + ".xml";

            try {
                //Creating the Web Request.
                guid = Guid.NewGuid();
                //string tempServerName = Shadow.validationServerIp;
                httpWebRequest = HttpWebRequest.Create(PathMaker.GetValidationServer() + Strings.VALIDATEJSPNAME + "?ClientTag=" + guid) as HttpWebRequest;
                //httpWebRequest = HttpWebRequest.Create(Strings.SERVERNAME + Strings.VALIDATEJSPNAME + "?ClientTag=" + guid) as HttpWebRequest;
                //Specifing the Method
                httpWebRequest.Method      = "POST";
                httpWebRequest.ContentType = "multipart/form-data=-----------------------------";
                // Create POST data and convert it to a byte array.
                string bufferTmp = "---------------------------Content-Disposition: form-data; name=\"fileField\";filename=" + "\"" + xmlFileName + "\"Content-Type: text/xml\n\n\n";
                Byte[] buffer    = Encoding.ASCII.GetBytes(bufferTmp);
                //need to fix targetfilename with a real value
                string path = validationData.xmlFileName;
                //Open xml file for reading
                FileStream fs      = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                int        length  = (int)fs.Length;
                byte[]     buffer2 = new byte[length];
                int        count;
                int        sum = 0;
                //Read xml into buffer2
                while ((count = fs.Read(buffer2, sum, length - sum)) > 0)
                {
                    sum += count;
                }
                fs.Close();

                //postDataString has to be formatted just right otherwise it won't work
                string tmpPostDataString = "\n\n\n\n-----------------------------\nContent-Disposition: form-data; ";
                tmpPostDataString += validationData.postDataString;
                tmpPostDataString += ("\n-----------------------------");
                tmpPostDataString += ("\nfilefield: " + Common.StripExtensionFileName(validationData.vuiFileName));

                Console.WriteLine("postDataString: " + tmpPostDataString);

                byte[] buffer3 = Encoding.ASCII.GetBytes(tmpPostDataString);

                //Combine the buffers
                byte[] bufferCombined = new byte[buffer.Length + buffer2.Length + buffer3.Length];
                Array.Copy(buffer, 0, bufferCombined, 0, buffer.Length);
                Array.Copy(buffer2, 0, bufferCombined, buffer.Length, buffer2.Length);
                Array.Copy(buffer3, 0, bufferCombined, buffer.Length + buffer2.Length, buffer3.Length);

                //Send Requst with PostData
                httpWebRequest.ContentLength = bufferCombined.Length;
                httpWebRequest.Timeout       = System.Threading.Timeout.Infinite;

                Stream PostData = httpWebRequest.GetRequestStream();
                PostData.Write(bufferCombined, 0, bufferCombined.Length);
                PostData.Close();

                //Getting the Response and reading the result.
                httpWebResponse = httpWebRequest.GetResponse() as HttpWebResponse;

                using (StreamReader sr = new StreamReader(httpWebResponse.GetResponseStream())) {
                    htmlResults = sr.ReadToEnd();
                }

                httpWebResponse.Close();
            }
            catch (WebException e) {
                if (e.Status == WebExceptionStatus.ProtocolError)
                {
                    MessageBox.Show("Exception Message :" + e.Message +
                                    "\nStatus Code : " + ((HttpWebResponse)e.Response).StatusCode +
                                    "\nStatus Description : " + ((HttpWebResponse)e.Response).StatusDescription +
                                    "\nPlease Contact PathMaker Support", "XML Validate Error");
                }
                else
                {
                    if (cancelUIRun.Equals(false))
                    {
                        MessageBox.Show("Unable to Validate XML.\nPlease make sure you are connected to Convergys Network.", "XML Validate Error");
                    }
                }
                cancelUIRun = false;
                base.OnRunWorkerCompleted(new RunWorkerCompletedEventArgs(this, null, true));
            }
            finally {
                if (httpWebResponse != null)
                {
                    httpWebResponse.Close();
                }
            }
        }
Ejemplo n.º 19
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);
        }