예제 #1
0
        private static int StateIdShadowSorterVisioPageGroupHelper(Shadow a, Shadow b)
        {
            if (a == b)
            {
                return(0);
            }

            StateShadow stateA = a as StateShadow;
            StateShadow stateB = b as StateShadow;

            if (stateA == null)
            {
                return(1);
            }
            if (stateB == null)
            {
                return(-1);
            }

            string stateAPrefix, stateANumber, stateAName;
            string stateBPrefix, stateBNumber, stateBName;

            StateShadow.DisectStateIdIntoParts(stateA.GetStateId(), out stateAPrefix, out stateANumber, out stateAName);
            StateShadow.DisectStateIdIntoParts(stateB.GetStateId(), out stateBPrefix, out stateBNumber, out stateBName);

            int earliestPageA = stateToPageReference[stateAPrefix + stateANumber];
            int earliestPageB = stateToPageReference[stateBPrefix + stateBNumber];

            if (earliestPageA != earliestPageB)
            {
                return(earliestPageA - earliestPageB);
            }

            return(stateA.GetStateId().CompareTo(stateB.GetStateId()));
        }
예제 #2
0
        public static void RedoAllPromptIds()
        {
            List <Shadow> shadowList  = PathMaker.LookupAllShadows();
            int           count       = 100;
            StartShadow   startShadow = PathMaker.LookupStartShadow();

            if (startShadow == null)
            {
                Common.ErrorMessage("No start shape available to determine prompt id format");
                return;
            }

            string promptIdFormat = startShadow.GetDefaultSetting(Strings.DefaultSettingsPromptIDFormat);

            startShadow.RedoPromptIds(count, promptIdFormat);

            foreach (Shadow s in shadowList)
            {
                StateShadow stateShadow = s as StateShadow;
                if (stateShadow != null)
                {
                    count += stateShadow.RedoPromptIds(count, promptIdFormat);
                }
            }
        }
        internal void SetSubDialogUID(string subDialogUID)
        {
            Common.SetCellString(shape, ShapeProperties.CallSubDialog.SubDialogUID, subDialogUID);
            StateShadow shadow = PathMaker.LookupShadowByUID(subDialogUID) as StateShadow;

            if (shadow != null)
            {
                Common.ForcedSetShapeText(shape, StateShadow.StateIdForDisplay(shadow.GetStateId()));
            }
        }
        private void highlightStateForRow(int rowIndex)
        {
            string tmpline   = UISpecResultsGridView[0, rowIndex].Value.ToString();
            string matchName = string.Empty;

            Regex r1    = new Regex(Strings.StartTargetName);
            Match match = r1.Match(tmpline);

            //check to see if it's is a Start shape or something like it without ID Number.
            if (match.Success)
            {
                matchName = match.Groups[0].Value;
            }
            else
            {
                r1    = new Regex("[A-Z]{2}[0-9]{4}");
                match = r1.Match(tmpline);
                if (match.Success)
                {
                    matchName = match.Groups[0].Value;
                }
                else
                {
                    return;
                }
            }

            List <Shadow> shadowList = PathMaker.LookupAllShadows();

            foreach (Shadow shadow in shadowList)
            {
                StateShadow stateShadow = shadow as StateShadow;
                if (stateShadow != null)
                {
                    string stateName = stateShadow.GetStateId();

                    if (stateName.Contains(matchName))
                    {
                        visioControl.Document.Application.ActiveWindow.Page = visioControl.Document.Application.ActivePage;
                        shadow.SelectShape();
                        break;
                    }
                }
                else
                {
                    //if stateShadow is null then if it is a start shape
                    if (shadow.GetShapeType().ToString().Contains(matchName))
                    {
                        visioControl.Document.Application.ActiveWindow.Page = visioControl.Document.Application.ActivePage;
                        shadow.SelectShape();
                        break;
                    }
                }
            }
        }
        public static void Add(StateShadow stateShadow, Shape shape)
        {
            // Not using GetShapeId here because we don't want a fake one - we need to know
            // if we have one in the shape data or not
            string stateId = Common.GetCellString(shape, ShapeProperties.Play.StateId);

            // if we have a stateid already - we need to update our prefix and number tracking
            if (stateId.Length > 0)
            {
                string prefix, number, name;
                StateShadow.DisectStateIdIntoParts(stateId, out prefix, out number, out name);

                prefixNumberToShadow.Add(prefix + number, stateShadow);
                shadowToPrefixNumber.Add(stateShadow, prefix + number);

                if (prefix.Length == PrefixLength)
                {
                    currentStateIdPrefix = prefix.ToUpper();
                }
                if (number.Length == NumberLength)
                {
                    int numInt;

                    if (int.TryParse(number, out numInt))
                    {
                        while (numInt > currentStateNumber)
                        {
                            currentStateNumber = currentStateNumber + nextStateBump;
                            // if we are over 9999 we need to restart at 1000 but use increments of 25
                            if (currentStateNumber > 9999)
                            {
                                currentStateNumber = 1000;
                                if (nextStateBump == 50)
                                {
                                    nextStateBump = 25;
                                }
                                else if (nextStateBump == 25)
                                {
                                    nextStateBump = 10;
                                }
                                else if (nextStateBump == 10)
                                {
                                    nextStateBump = 5;
                                }
                                else
                                {
                                    nextStateBump = 1;
                                }
                            }
                        }
                    }
                }
            }
        }
 /**
  * Called when the stateId of the SubDialog associated with this CallSubDialog is changed
  * Needed to update the shape text of this shape
  */
 internal void OnSubDialogStateIdChanged(string subDialogUID)
 {
     if (GetSubDialogUID().Equals(subDialogUID))
     {
         StateShadow shadow = PathMaker.LookupShadowByUID(subDialogUID) as StateShadow;
         if (shadow != null)
         {
             Common.ForcedSetShapeText(shape, StateShadow.StateIdForDisplay(shadow.GetStateId()));
         }
     }
 }
예제 #7
0
        public static void StateIdShadowSorterVisioHeuristic(List <Shadow> shadowList, Document doc, StartShadow startShadow)
        {
            // group by alpha prefix, then by number within that
            // then sort groups by first visio page reference
            // if both on same page, startPrefix is first, the sort alphanumerically

            string firstPrefix = String.Empty;
            Shadow firstShadow = startShadow.GetFirstStateGotoTarget();

            if (firstShadow != null)
            {
                StateShadow firstState = firstShadow as StateShadow;
                string      firstNumber, firstName;
                StateShadow.DisectStateIdIntoParts(firstState.GetStateId(), out firstPrefix, out firstNumber, out firstName);
            }

            // make a list of first page references of each alpha prefix
            earliestPageReference = new Dictionary <string, int>();
            foreach (Shadow s in shadowList)
            {
                StateShadow sState = s as StateShadow;
                if (sState == null)
                {
                    continue;
                }
                int    pageNumber = s.GetPageNumber();
                string statePrefix, stateNumber, stateName;
                StateShadow.DisectStateIdIntoParts(sState.GetStateId(), out statePrefix, out stateNumber, out stateName);

                // always make this highest priority
                if (statePrefix.Equals(firstPrefix))
                {
                    pageNumber = -1;
                }

                int earliest;
                if (earliestPageReference.TryGetValue(statePrefix, out earliest))
                {
                    if (pageNumber < earliest)
                    {
                        earliestPageReference[statePrefix] = pageNumber;
                    }
                }
                else
                {
                    earliestPageReference.Add(statePrefix, pageNumber);
                }
            }

            shadowList.Sort(StateIdShadowSorterVisioHeuristicHelper);
        }
        public static void Remove(StateShadow stateShadow)
        {
            string prefix, number, name;

            StateShadow.DisectStateIdIntoParts(stateShadow.GetStateId(), out prefix, out number, out name);
            int backupToNumber = currentStateNumber;

            // let's make sure this isn't an undo of a paste of a duplicate
            string      prefixPlusNumber;
            StateShadow shadow;

            if (prefixNumberToShadow.TryGetValue(prefix + number, out shadow))
            {
                if (shadow == stateShadow)
                {
                    // good match - remove
                    prefixNumberToShadow.Remove(prefix + number);
                    shadowToPrefixNumber.Remove(shadow);

                    int numberInt;
                    if (int.TryParse(number, out numberInt))
                    {
                        backupToNumber = numberInt;
                    }
                }
                else
                {
                    if (shadowToPrefixNumber.TryGetValue(stateShadow, out prefixPlusNumber))
                    {
                        // so we are registered with a different prefix + number, remove that one
                        prefixNumberToShadow.Remove(prefixPlusNumber);
                        shadowToPrefixNumber.Remove(stateShadow);

                        int numberInt;
                        if (int.TryParse(number, out numberInt))
                        {
                            backupToNumber = numberInt;
                        }
                    }
                    else
                    {
                        // should never get here...
                        Common.ErrorMessage("Removing a state which isn't in the State Id Map");
                    }
                }
                if (backupToNumber < currentStateNumber)
                {
                    currentStateNumber = backupToNumber;
                }
            }
        }
        // Given a stateId, tells if it's okay to use or not - used when pasting
        // to make sure we don't end up with duplicate ids in use
        internal static bool IsStateIdOkayForUse(string stateId)
        {
            string prefix, number, name;

            StateShadow.DisectStateIdIntoParts(stateId, out prefix, out number, out name);
            if (prefixNumberToShadow.ContainsKey(prefix + number))
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
예제 #10
0
        public static void StateIdShadowSorterVisioPageGrouping(List <Shadow> shadowList, Document doc, StartShadow startShadow)
        {
            // Try to create a group of states per Visio page then
            // sort alphanumerically so the printing order matches the pages

            //string firstPrefix = String.Empty;
            //Shadow firstShadow = startShadow.GetFirstStateGotoTarget();
            //if (firstShadow != null)
            //{
            //StateShadow firstState = firstShadow as StateShadow;
            //string firstNumber, firstName;
            //StateShadow.DisectStateIdIntoParts(firstState.GetStateId(), out firstPrefix, out firstNumber, out firstName);
            //}

            // make a list of first page references of each alpha prefix
            stateToPageReference = new Dictionary <string, int>();
            foreach (Shadow s in shadowList)
            {
                StateShadow sState = s as StateShadow;
                if (sState == null)
                {
                    continue;
                }
                //int firstPageNumber;
                int    pageNumber = s.GetPageNumber();
                string statePrefix, stateNumber, stateName;
                StateShadow.DisectStateIdIntoParts(sState.GetStateId(), out statePrefix, out stateNumber, out stateName);

                // always make this highest priority
                //if (sState.GetStateId().Equals(firstState.GetStateId()))
                //firstPageNumber = pageNumber;

                int earliest;
                if (stateToPageReference.TryGetValue(statePrefix + stateNumber, out earliest))
                {
                    if (pageNumber < earliest)
                    {
                        stateToPageReference[statePrefix + stateNumber] = pageNumber;
                    }
                }
                else
                {
                    stateToPageReference.Add(statePrefix + stateNumber, pageNumber);
                }
            }

            shadowList.Sort(StateIdShadowSorterVisioPageGroupHelper);
        }
예제 #11
0
        internal static void LoadStateIdTextBoxes(TextBox statePrefixTextBox, TextBox stateNumberTextBox, TextBox stateNameTextBox, string stateId)
        {
            if (stateId.Length != 0)
            {
                string tmp = StateShadow.StateIdForDisplay(stateId);

                string prefix, number, name;
                StateShadow.DisectStateIdIntoParts(tmp, out prefix, out number, out name);
                statePrefixTextBox.Text = prefix;
                stateNumberTextBox.Text = number;
                stateNameTextBox.Text   = name;
            }
            else
            {
                statePrefixTextBox.Text = string.Empty;
                stateNumberTextBox.Text = string.Empty;
                stateNameTextBox.Text   = string.Empty;
            }

            statePrefixTextBox.KeyPress -= new KeyPressEventHandler(StatePrefixKeyHandler);
            stateNumberTextBox.KeyPress -= new KeyPressEventHandler(StateNumberKeyHandler);
            statePrefixTextBox.KeyPress += new KeyPressEventHandler(StatePrefixKeyHandler);
            stateNumberTextBox.KeyPress += new KeyPressEventHandler(StateNumberKeyHandler);

            statePrefixTextBox.Validating -= new CancelEventHandler(OnStateIdTextBoxesValidating);
            statePrefixTextBox.Validating += new CancelEventHandler(OnStateIdTextBoxesValidating);
            stateNumberTextBox.Validating -= new CancelEventHandler(OnStateIdTextBoxesValidating);
            stateNumberTextBox.Validating += new CancelEventHandler(OnStateIdTextBoxesValidating);
            stateNameTextBox.Validating   -= new CancelEventHandler(OnStateIdTextBoxesValidating);
            stateNameTextBox.Validating   += new CancelEventHandler(OnStateIdTextBoxesValidating);

            statePrefixTextBox.Validated -= new EventHandler(OnStateIdTextBoxValidated);
            statePrefixTextBox.Validated += new EventHandler(OnStateIdTextBoxValidated);
            stateNumberTextBox.Validated -= new EventHandler(OnStateIdTextBoxValidated);
            stateNumberTextBox.Validated += new EventHandler(OnStateIdTextBoxValidated);
            stateNameTextBox.Validated   -= new EventHandler(OnStateIdTextBoxValidated);
            stateNameTextBox.Validated   += new EventHandler(OnStateIdTextBoxValidated);

            //Handle Text change on TextBox
            statePrefixTextBox.TextChanged -= new EventHandler(OnStateIdTextBoxChanged);
            statePrefixTextBox.TextChanged += new EventHandler(OnStateIdTextBoxChanged);
            stateNumberTextBox.TextChanged -= new EventHandler(OnStateIdTextBoxChanged);
            stateNumberTextBox.TextChanged += new EventHandler(OnStateIdTextBoxChanged);
            stateNameTextBox.TextChanged   -= new EventHandler(OnStateIdTextBoxChanged);
            stateNameTextBox.TextChanged   += new EventHandler(OnStateIdTextBoxChanged);
        }
예제 #12
0
        private static void AddEnteringFrom(StateShadow shadow, XmlElement stateElement)
        {
            List <string> inputList = shadow.GetEnteringFromTargetNames();

            if (inputList.Count == 0)
            {
                return;
            }

            XmlElement listElement = CreateElement(stateElement, xmlStrings.PreviousStateList);

            foreach (string s in inputList)
            {
                XmlElement element = CreateElement(listElement, xmlStrings.StateId);
                element.InnerText = s;
            }
        }
예제 #13
0
        public static int StateIdShadowSorterAlphaNumerical(Shadow a, Shadow b)
        {
            if (a == b)
            {
                return(0);
            }

            StateShadow stateA = a as StateShadow;
            StateShadow stateB = b as StateShadow;

            if (stateA == null)
            {
                return(1);
            }
            if (stateB == null)
            {
                return(-1);
            }

            return(stateA.GetStateId().CompareTo(stateB.GetStateId()));
        }
        public static void Add(StateShadow stateShadow, Shape shape)
        {
            // Not using GetShapeId here because we don't want a fake one - we need to know
            // if we have one in the shape data or not
            string stateId = Common.GetCellString(shape, ShapeProperties.Play.StateId);

            // if we have a stateid already - we need to update our prefix and number tracking
            if (stateId.Length > 0) {
                string prefix, number, name;
                StateShadow.DisectStateIdIntoParts(stateId, out prefix, out number, out name);

                prefixNumberToShadow.Add(prefix + number, stateShadow);
                shadowToPrefixNumber.Add(stateShadow, prefix + number);

                if (prefix.Length == PrefixLength)
                    currentStateIdPrefix = prefix.ToUpper();
                if (number.Length == NumberLength) {
                    int numInt;

                    if (int.TryParse(number, out numInt)) {
                        while (numInt > currentStateNumber) {
                            currentStateNumber = currentStateNumber + nextStateBump;
                            // if we are over 9999 we need to restart at 1000 but use increments of 25
                            if (currentStateNumber > 9999) {
                                currentStateNumber = 1000;
                                if (nextStateBump == 50)
                                    nextStateBump = 25;
                                else if (nextStateBump == 25)
                                    nextStateBump = 10;
                                else if (nextStateBump == 10)
                                    nextStateBump = 5;
                                else
                                    nextStateBump = 1;
                            }
                        }
                    }
                }
            }
        }
예제 #15
0
        public static int StateIdShadowSorterNumericalAlpha(Shadow a, Shadow b)
        {
            if (a == b)
            {
                return(0);
            }

            StateShadow stateA = a as StateShadow;
            StateShadow stateB = b as StateShadow;

            if (stateA == null)
            {
                return(1);
            }
            if (stateB == null)
            {
                return(-1);
            }

            string stateAPrefix, stateANumber, stateAName;
            string stateBPrefix, stateBNumber, stateBName;

            StateShadow.DisectStateIdIntoParts(stateA.GetStateId(), out stateAPrefix, out stateANumber, out stateAName);
            StateShadow.DisectStateIdIntoParts(stateB.GetStateId(), out stateBPrefix, out stateBNumber, out stateBName);

            int result = stateANumber.CompareTo(stateBNumber);

            if (result == 0)
            {
                return(stateAPrefix.CompareTo(stateBPrefix));
            }
            else
            {
                return(result);
            }
        }
예제 #16
0
        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
            //Common.WarningMessage("INTERACTION SHADOW:  Starting to loop thru table records");
            Table table = GetPromptTypes();
            String lastVersionStamp = base.GetLastChangeVersion();
            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);
                string conditionDateString = table.GetData(r, (int)TableColumns.PromptTypes.ConditionDateStamp);
                string typeDateString = table.GetData(r, (int)TableColumns.PromptTypes.TypeDateStamp);

                if (wordingDateString.Contains("/") &&  !wordingDateString.Equals(""))
                {
                    DateTime revisionDate;
                    if (DateTime.TryParse(wordingDateString, out revisionDate))
                    {
                        tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate);
                        //Common.WarningMessage("INTERACTION: Wording Date was: " + wordingDateString + " and label update is: " + tempVersionStamp);
                        table.SetData(r, (int)TableColumns.PromptTypes.WordingDateStamp, tempVersionStamp);
                        labelsUpdated = true;
                    }
                }
                if (idDateString.Contains("/") && !idDateString.Equals(""))
                {
                    DateTime revisionDate;
                    if (DateTime.TryParse(idDateString, out revisionDate))
                    {
                        tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate);
                        //Common.WarningMessage("INTERACTION: ID Date was: " + idDateString + " and label update is: " + tempVersionStamp);
                        table.SetData(r, (int)TableColumns.PromptTypes.IdDateStamp, tempVersionStamp);
                        labelsUpdated = true;
                    }
                }
                if (conditionDateString.Contains("/") && !conditionDateString.Equals(""))
                {
                    DateTime revisionDate;
                    if (DateTime.TryParse(conditionDateString, out revisionDate))
                    {
                        tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate);
                        //Common.WarningMessage("INTERACTION: ID Date was: " + idDateString + " and label update is: " + tempVersionStamp);
                        table.SetData(r, (int)TableColumns.PromptTypes.ConditionDateStamp, tempVersionStamp);
                        labelsUpdated = true;
                    }
                }
                if (typeDateString.Contains("/") && !typeDateString.Equals(""))
                {
                    DateTime revisionDate;
                    if (DateTime.TryParse(typeDateString, out revisionDate))
                    {
                        tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate);
                        //Common.WarningMessage("INTERACTION: ID Date was: " + idDateString + " and label update is: " + tempVersionStamp);
                        table.SetData(r, (int)TableColumns.PromptTypes.TypeDateStamp, tempVersionStamp);
                        labelsUpdated = true;
                    }
                }
            }
            if (labelsUpdated)
                SetPromptTypes(table);  //JDK - UNCOMMENT THIS TO MAKE EDITS STICK

            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.Contains("/") && !wordingDateString.Equals(""))
                {
                    DateTime revisionDate;
                    if (DateTime.TryParse(wordingDateString, out revisionDate))
                    {
                        tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate);
                        //.WarningMessage("INTERACTION: Conf Wording Date was: " + wordingDateString + " and label update is: " + tempVersionStamp);
                        table.SetData(r, (int)TableColumns.ConfirmationPrompts.WordingDateStamp, tempVersionStamp);
                        labelsUpdated = true;
                    }
                }
                if (idDateString.Contains("/") && !idDateString.Equals(""))
                {
                    DateTime revisionDate;
                    if (DateTime.TryParse(idDateString, out revisionDate))
                    {
                        tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate);
                        //Common.WarningMessage("INTERACTION: Conf ID Date was: " + idDateString + " and label update is: " + tempVersionStamp);
                        table.SetData(r, (int)TableColumns.ConfirmationPrompts.IdDateStamp, tempVersionStamp);
                        labelsUpdated = true;
                    }
                }
            }
            if (labelsUpdated)
                SetConfirmationPrompts(table);  //JDK - UNCOMMENT THIS TO MAKE EDITS STICK

            labelsUpdated = false;
            table = GetMaxHandling();
            for (int r = 0; r < table.GetNumRows(); r++)
            {
                string actionDateStamp = table.GetData(r, (int)TableColumns.MaxHandling.ActionDateStamp);
                string countDateString = table.GetData(r, (int)TableColumns.MaxHandling.CountDateStamp);
                string gotoDateString = table.GetData(r, (int)TableColumns.MaxHandling.GotoDateStamp);

                if (actionDateStamp.Contains("/") || actionDateStamp.Equals(""))
                {
                    DateTime revisionDate;
                    if (DateTime.TryParse(actionDateStamp, out revisionDate))
                    {
                        tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate);
                        //.WarningMessage("INTERACTION: Conf Wording Date was: " + wordingDateString + " and label update is: " + tempVersionStamp);
                        table.SetData(r, (int)TableColumns.MaxHandling.ActionDateStamp, tempVersionStamp);
                        labelsUpdated = true;
                    }
                }
                if (countDateString.Contains("/") || countDateString.Equals(""))
                {
                    DateTime revisionDate;
                    if (DateTime.TryParse(countDateString, out revisionDate))
                    {
                        tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate);
                        //Common.WarningMessage("INTERACTION: Conf ID Date was: " + idDateString + " and label update is: " + tempVersionStamp);
                        table.SetData(r, (int)TableColumns.MaxHandling.CountDateStamp, tempVersionStamp);
                        labelsUpdated = true;
                    }
                }
                if (gotoDateString.Contains("/") || gotoDateString.Equals(""))
                {
                    DateTime revisionDate;
                    if (DateTime.TryParse(gotoDateString, out revisionDate))
                    {
                        tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate);
                        //Common.WarningMessage("INTERACTION: Conf ID Date was: " + idDateString + " and label update is: " + tempVersionStamp);
                        table.SetData(r, (int)TableColumns.MaxHandling.GotoDateStamp, tempVersionStamp);
                        labelsUpdated = true;
                    }
                }
            }
            if (labelsUpdated)
                SetMaxHandling(table);

            labelsUpdated = false;
            table = GetCommandTransitions();

            for (int r = 0; r < table.GetNumRows(); r++)
            {
                string actionDateStamp = table.GetData(r, (int)TableColumns.CommandTransitions.ActionDateStamp);
                string conditionDateStamp = table.GetData(r, (int)TableColumns.CommandTransitions.ConditionDateStamp);
                string confirmDateStamp = table.GetData(r, (int)TableColumns.CommandTransitions.ConfirmDateStamp);
                string dtmfDateStamp = table.GetData(r, (int)TableColumns.CommandTransitions.DTMFDateStamp);
                string gotoDateStamp = table.GetData(r, (int)TableColumns.CommandTransitions.GotoDateStamp);
                string optionDateStamp = table.GetData(r, (int)TableColumns.CommandTransitions.OptionDateStamp);
                string vocabDateStamp = table.GetData(r, (int)TableColumns.CommandTransitions.VocabDateStamp);

                if (!actionDateStamp.Equals("") && actionDateStamp.Contains("/"))
                {
                    DateTime revisionDate;
                    if (DateTime.TryParse(actionDateStamp, out revisionDate))
                    {
                        tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate);
                        table.SetData(r, (int)TableColumns.CommandTransitions.ActionDateStamp, tempVersionStamp);
                        labelsUpdated = true;
                    }
                }
                if (!conditionDateStamp.Equals("") && conditionDateStamp.Contains("/"))
                {
                    DateTime revisionDate;
                    if (DateTime.TryParse(conditionDateStamp, out revisionDate))
                    {
                        tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate);
                        table.SetData(r, (int)TableColumns.CommandTransitions.ConditionDateStamp, tempVersionStamp);
                        labelsUpdated = true;
                    }
                }
                if (!confirmDateStamp.Equals("") && confirmDateStamp.Contains("/"))
                {
                    DateTime revisionDate;
                    if (DateTime.TryParse(confirmDateStamp, out revisionDate))
                    {
                        tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate);
                        table.SetData(r, (int)TableColumns.CommandTransitions.ConfirmDateStamp, tempVersionStamp);
                        labelsUpdated = true;
                    }
                }
                if (!dtmfDateStamp.Equals("") && dtmfDateStamp.Contains("/"))
                {
                    DateTime revisionDate;
                    if (DateTime.TryParse(dtmfDateStamp, out revisionDate))
                    {
                        tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate);
                        table.SetData(r, (int)TableColumns.CommandTransitions.DTMFDateStamp, tempVersionStamp);
                        labelsUpdated = true;
                    }
                }
                if (!gotoDateStamp.Equals("") && gotoDateStamp.Contains("/"))
                {
                    DateTime revisionDate;
                    if (DateTime.TryParse(gotoDateStamp, out revisionDate))
                    {
                        tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate);
                        table.SetData(r, (int)TableColumns.CommandTransitions.GotoDateStamp, tempVersionStamp);
                        labelsUpdated = true;
                    }
                }
                if (!optionDateStamp.Equals("") && optionDateStamp.Contains("/"))
                {
                    DateTime revisionDate;
                    if (DateTime.TryParse(optionDateStamp, out revisionDate))
                    {
                        tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate);
                        table.SetData(r, (int)TableColumns.CommandTransitions.OptionDateStamp, tempVersionStamp);
                        labelsUpdated = true;
                    }
                }
                if (!vocabDateStamp.Equals("") && vocabDateStamp.Contains("/"))
                {
                    DateTime revisionDate;
                    if (DateTime.TryParse(vocabDateStamp, out revisionDate))
                    {
                        tempVersionStamp = PathMaker.LookupChangeLogShadow().GetVersionStringForChange(revisionDate);
                        table.SetData(r, (int)TableColumns.CommandTransitions.VocabDateStamp, tempVersionStamp);
                        labelsUpdated = true;
                    }
                }
            }
            if (labelsUpdated)
                SetCommandTransitions(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);
        }
예제 #18
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);
            }
        }
예제 #19
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);
            }
        }
        public static void Remove(StateShadow stateShadow)
        {
            string prefix, number, name;
            StateShadow.DisectStateIdIntoParts(stateShadow.GetStateId(), out prefix, out number, out name);
            int backupToNumber = currentStateNumber;

            // let's make sure this isn't an undo of a paste of a duplicate
            string prefixPlusNumber;
            StateShadow shadow;
            if (prefixNumberToShadow.TryGetValue(prefix + number, out shadow)) {
                if (shadow == stateShadow) {
                    // good match - remove
                    prefixNumberToShadow.Remove(prefix + number);
                    shadowToPrefixNumber.Remove(shadow);

                    int numberInt;
                    if (int.TryParse(number, out numberInt))
                        backupToNumber = numberInt;
                }
                else {
                    if (shadowToPrefixNumber.TryGetValue(stateShadow, out prefixPlusNumber)) {
                        // so we are registered with a different prefix + number, remove that one
                        prefixNumberToShadow.Remove(prefixPlusNumber);
                        shadowToPrefixNumber.Remove(stateShadow);

                        int numberInt;
                        if (int.TryParse(number, out numberInt))
                            backupToNumber = numberInt;
                    }
                    else {
                        // should never get here...
                        Common.ErrorMessage("Removing a state which isn't in the State Id Map");
                    }
                }
                if (backupToNumber < currentStateNumber)
                    currentStateNumber = backupToNumber;
            }
        }
        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);
        }
예제 #22
0
        // Does the actual translation from state name to UID - may also return a keyword (Return, Hang Up, etc.) for which no UID exists or
        // null if no change is necessary
        // expectedLabel is used to check connectors - Visio has a habit of changing connector names so we need to ensure
        // we have the right one - it's ignored if the goto is not via a connector
        private static string TranslateGotoToUniqueIdForShapeOrKeyword(Shape shape, string gotoShapeName, Dictionary <string, List <string> > uniqueIdMap, string expectedLabel)
        {
            List <string> list = null;

            // Call SubDialogs don't have underscores in the SubDialog names
            ShapeTypes type = Common.GetShapeType(shape);

            if (type == ShapeTypes.CallSubDialog)
            {
                gotoShapeName = StateShadow.StateIdForStorage(gotoShapeName);
            }

            if (uniqueIdMap.TryGetValue(gotoShapeName, out list))
            {
                // dynamic connectors must be on the same page as the shape
                // visio somtimes renames shapes when copying/pasting so we really want
                // to make sure we get the right connector from the right page
                if (list.Count == 1 && !gotoShapeName.StartsWith(Strings.DynamicConnectorShapeNameStart))
                {
                    return(list.ElementAt(0));
                }
                else
                {
                    // There can be multiple shapes with same name, lovely - need to find one on this page or we're in trouble
                    foreach (string uid in list)
                    {
                        try {
                            Shape s = shape.ContainingPage.Shapes.get_ItemU(uid);
                            if (s != null)
                            {
                                // if it's a connector, make sure it's attached to the shape and matches the expected label
                                if (gotoShapeName.StartsWith(Strings.DynamicConnectorShapeNameStart))
                                {
                                    foreach (Connect c in s.Connects)
                                    {
                                        if (c.FromCell.Name.Equals(Strings.BeginConnectionPointCellName) &&
                                            c.ToSheet == shape &&
                                            Common.MakeLabelName(s.Text).Equals(expectedLabel))
                                        {
                                            return(uid);
                                        }
                                    }
                                    return(NeedsToBeRepairedString);
                                }
                                else
                                {
                                    return(uid);
                                }
                            }
                        }
                        catch {
                            // just ignore for now - when checking for one from a different page, it throws an exception
                        }
                    }
                    // if we get here, it means either we have a bogus connection (unlikely) or the connector we're looking for
                    // has been changed when we output from CID
                    return(NeedsToBeRepairedString);
                }
            }

            // some things are expected
            if (gotoShapeName.Length == 0)
            {
                return(null);
            }

            if (gotoShapeName.Equals(Strings.CurrentStateKeyword))
            {
                return(null);
            }

            // these will just be treated as terminals - let's do our best to convert them
            if (gotoShapeName.ToLower().Contains(Strings.ReturnKeyword.ToLower()))
            {
                return(Strings.ReturnKeyword);
            }
            else if (gotoShapeName.ToLower().Contains(Strings.TransferKeyword.ToLower()))
            {
                return(Strings.TransferKeyword);
            }
            else if (gotoShapeName.ToLower().Contains(Strings.HangUpKeywordShortForm.ToLower()))
            {
                return(Strings.HangUpKeywordShortForm);
            }

            return(NeedsToBeRepairedString);
        }
예제 #23
0
 internal static string UnloadStateIdTextBoxes(TextBox statePrefixTextBox, TextBox stateNumberTextBox, TextBox stateNameTextBox)
 {
     return(StateShadow.BuildStateIdForStorage(statePrefixTextBox.Text, stateNumberTextBox.Text, stateNameTextBox.Text));
 }
 internal virtual void RedoHiddenDateMarkers(StateShadow stateShadow)
 {
 }
예제 #25
0
        private static void AddEnteringFrom(StateShadow shadow, XmlElement stateElement)
        {
            List<string> inputList = shadow.GetEnteringFromTargetNames();
            if (inputList.Count == 0)
                return;

            XmlElement listElement = CreateElement(stateElement, xmlStrings.PreviousStateList);

            foreach (string s in inputList) {
                XmlElement element = CreateElement(listElement, xmlStrings.StateId);
                element.InnerText = s;
            }
        }
예제 #26
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);
                    }
                }
            }
        }
        private static void FillEnteringFrom(Cell cell, StateShadow shadow)
        {
            List<string> list = shadow.GetEnteringFromTargetNames();
            List<string> maxList;

            HashSet<string> uniqueList = new HashSet<string>();
            foreach (string s in list)
                uniqueList.Add(s);
            if (gotoMaxHandlerCache.TryGetValue(shadow.GetStateId(), out maxList))
                foreach (string s in maxList)
                    uniqueList.Add(s);

            list = uniqueList.ToList();

            bool first = true;
            cell.Range.InsertAfter(" ");
            foreach (string enteringFrom in list) {
                if (!first)
                    cell.Range.InsertAfter(", ");
                first = false;

                Selection sel = cell.Application.Selection;
                sel.InsertAfter(enteringFrom);
                sel.set_Style("HyperLink");
                string link = "bm" + Left(AlphaNumericCharsOnly(enteringFrom), 38);
                sel.Document.Hyperlinks.Add(Anchor: sel.Range, SubAddress: link);
                int count = cell.Range.Characters.Count;
                sel.set_Style("TableNormalCell");
                sel.MoveStart(WdUnits.wdWord, -1);
                sel.Cut();
                Range range = cell.Range.Characters[count - 1];
                range.Paste();

            }
        }
예제 #28
0
        void OnShapeAdd(Shape shape)
        {
            ShapeTypes type = Common.GetShapeType(shape);
            bool       is1D = shape.OneD != 0;

            // Tricky - when pasting, Visio gives out new uids to the shapes if there are duplicates
            // in this document.  So, we are going to stash the original ones - unless we are pasting.
            // If we are pasting, the paste end will fix the ones that were added.
            if (!visioControl.Document.Application.get_IsInScope((int)VisUICmds.visCmdUFEditPaste) &&
                !visioControl.Document.Application.get_IsInScope((int)VisUICmds.visCmdUFEditDuplicate))
            {
                string uid    = shape.get_UniqueID((short)VisUniqueIDArgs.visGetOrMakeGUID);
                string cached = Common.GetCellString(shape, Strings.CutCopyPasteTempCellName);

                // when undoing a delete page, you can't write this yet so this check will ignore it
                if (!uid.Equals(cached))
                {
                    Common.SetCellString(shape, Strings.CutCopyPasteTempCellName, uid);
                }
            }
            else if (Common.GetShapeType(shape) == ShapeTypes.OffPageRef)
            {
                Common.ErrorMessage("Pasted off-page reference needs to be connected.  Double click on it to repair.");
                // Because these can be cut and pasted from a single document, clearing these fields
                // allows us to avoid having more than one off page connector pointing to a single other one
                // which causes issues with tracking things in the shadows.  This way here, double clicking
                // on the connector will ask which page to connect it to.
                Common.SetCellString(shape, ShapeProperties.OffPageConnectorDestinationPageID, "");
                Common.SetCellString(shape, ShapeProperties.OffPageConnectorDestinationShapeID, "");
            }

            if (type == ShapeTypes.None && is1D)
            {
                // rogue connector - need to make it conform
                Common.SetCellString(shape, ShapeProperties.ShapeType, ((int)ShapeTypes.Connector).ToString());
                shape.get_CellsSRC((short)VisSectionIndices.visSectionObject,
                                   (short)VisRowIndices.visRowLine,
                                   (short)VisCellIndices.visLineEndArrow).FormulaU = "13";
                shape.get_CellsSRC((short)VisSectionIndices.visSectionObject,
                                   (short)VisRowIndices.visRowLine,
                                   (short)VisCellIndices.visLineRounding).FormulaU = "0.25 in";
                shape.get_CellsSRC((short)VisSectionIndices.visSectionObject,
                                   (short)VisRowIndices.visRowLock,
                                   (short)VisCellIndices.visLockTextEdit).FormulaU = "1";

                // just in case
                Common.FixConnectorTextControl(shape);

                // make every row in the shape data section invisible
                short row = (short)VisRowIndices.visRowFirst;
                while (shape.get_CellsSRCExists((short)VisSectionIndices.visSectionProp, row, (short)VisCellIndices.visCustPropsInvis, (short)VisExistsFlags.visExistsAnywhere) != 0)
                {
                    shape.get_CellsSRC((short)VisSectionIndices.visSectionProp, row++, (short)VisCellIndices.visCustPropsInvis).FormulaU = "TRUE";
                }
            }

            // when a shape is copied and pasted, it will be an exact copy of the previous shape
            // we need fix the duplicate name issue before we do anything else
            string oldPastedStateName = String.Empty;

            if (visioControl.Document.Application.get_IsInScope((int)VisUICmds.visCmdUFEditPaste) ||
                visioControl.Document.Application.get_IsInScope((int)VisUICmds.visCmdUFEditDuplicate))
            {
                string stateId = Common.GetCellString(shape, ShapeProperties.StateId);
                if (stateId.Length > 0)
                {
                    if (!StatePrefixAndNumberManager.IsStateIdOkayForUse(stateId))
                    {
                        oldPastedStateName = stateId;
                        // NEVER, NEVER do this without going through the shadow except here, before the shadow is made
                        Common.SetCellString(shape, ShapeProperties.StateId, String.Empty);
                    }
                }
            }

            Shadow shadow = Common.MakeShapeShadow(shape);

            if (shadow != null)
            {
                // if we have a pasted name that conflicted, this will reuse the name portion
                // but get us a new prefix and number and then renumber any prompts
                if (oldPastedStateName.Length > 0)
                {
                    string prefix, number, name;
                    StateShadow.DisectStateIdIntoParts(oldPastedStateName, out prefix, out number, out name);
                    shape.Text = StateShadow.StateIdForDisplay(name).Trim();
                    // this just pretends we just typed the name portion into the shape itself
                    shadow.OnShapeExitTextEdit();

                    // and now let's renumber any prompts if we're not using the "number" option
                    List <Shadow> shadowList = LookupShadowsByShapeType(ShapeTypes.Start);
                    if (shadowList.Count > 0)
                    {
                        StartShadow startShadow    = shadowList[0] as StartShadow;
                        string      promptIdFormat = startShadow.GetDefaultSetting(Strings.DefaultSettingsPromptIDFormat);
                        if (promptIdFormat.Equals(Strings.PromptIdFormatFull) || promptIdFormat.Equals(Strings.PromptIdFormatPartial))
                        {
                            StateShadow stateShadow = shadow as StateShadow;
                            if (stateShadow != null)
                            {
                                stateShadow.RedoPromptIds(0, promptIdFormat);
                            }
                        }
                    }
                }
                shadowShapeMap.Add(shape.get_UniqueID((short)VisUniqueIDArgs.visGetOrMakeGUID), shadow);
                shadow.OnShapeAdd();

                if (shadow.GetShapeType() == ShapeTypes.DocTitle ||
                    shadow.GetShapeType() == ShapeTypes.ChangeLog ||
                    shadow.GetShapeType() == ShapeTypes.AppDesc ||
                    shadow.GetShapeType() == ShapeTypes.PrefixList ||
                    shadow.GetShapeType() == ShapeTypes.Start)
                {
                    if (LookupShadowsByShapeType(shadow.GetShapeType()).Count > 1)
                    {
                        Common.ErrorMessage("Cannot have two Start, Change Log, or Document Title, App Description or Prefix List shapes");
                        Common.ForcedSetShapeText(shape, Strings.ToBeDeletedLabel);
                    }
                }
            }
            else
            {
                Common.ErrorMessage("Invalid non-PathMaker shape added");
                try {
                    Common.ForcedSetShapeText(shape, Strings.ToBeDeletedLabel);
                }
                catch {
                    // it may be a shape with two subshapes (play/interaction) so try this too
                    try {
                        Common.ForcedSetShapeText(shape.Shapes[0], Strings.ToBeDeletedLabel);
                    }
                    catch {
                        // copying from non-PathMaker visios can cause this to fail depending on shape sheets, locks, etc.
                        // We did our best - we can ignore these
                    }
                }
            }
        }
예제 #29
0
 virtual internal void RedoHiddenDateMarkers(StateShadow stateShadow)
 {
 }
예제 #30
0
        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);
            }
        }
예제 #31
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);
            }
        }