示例#1
0
        public static void LoadCommandTransitionDataGridView(DataGridView gridView, Table table)
        {
            BindingList<CommandTransitionRow> ctList = CommandTransitionRow.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);
                AddTextBoxColumn(gridView, CommandTransitionRow.GotoColumnName);
                AddStringComboBoxColumn(gridView, CommandTransitionRow.ConfirmColumnName);
                LoadComboBoxColumn(gridView, CommandTransitionRow.ConfirmColumnName, confirmValues);
                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<CommandTransitionRow>(gridView, false);
                HideDateStampColumns(gridView);
                gridView.Columns[CommandTransitionRow.GotoColumnName].ReadOnly = true;
            }

            gridView.DataSource = ctList;
        }
        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.Goto, shadow.GetUniqueId());
            table.SetData(table.GetNumRows() - 1, (int)TableColumns.Transitions.GotoDateStamp, DateTime.Today.ToString(Strings.DateColumnFormatString));
            SetTransitionsWithoutRemovingOutputsForDeletedTransitions(table);
        }
        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;
        }
示例#4
0
 public static BindingList<ChangeLogRow> GetRowsFromTable(Table table)
 {
     BindingList<ChangeLogRow> list = new BindingList<ChangeLogRow>();
     for (int row = 0; row < table.GetNumRows(); row++) {
         ChangeLogRow cl = new ChangeLogRow();
         cl.Date = table.GetData(row, (int)TableColumns.ChangeLog.Date);
         cl.Version = table.GetData(row, (int)TableColumns.ChangeLog.Version);
         cl.Details = table.GetData(row, (int)TableColumns.ChangeLog.Details);
         cl.Author = table.GetData(row, (int)TableColumns.ChangeLog.Author);
         cl.Highlight = table.GetData(row, (int)TableColumns.ChangeLog.Highlight);
         list.Add(cl);
     }
     return list;
 }
        public static Table GetTableFromRows(BindingList<NameValuePairRow> rows)
        {
            Table table = new Table(rows.Count, Enum.GetNames(typeof(TableColumns.NameValuePairs)).Length);

            int row = 0;
            foreach (NameValuePairRow nv in rows) {
                table.SetData(row, (int)TableColumns.NameValuePairs.Name, nv.Name);
                table.SetData(row, (int)TableColumns.NameValuePairs.Value, nv.Value);
                table.SetData(row, (int)TableColumns.NameValuePairs.NameDateStamp, nv.NameDateStamp);
                table.SetData(row, (int)TableColumns.NameValuePairs.ValueDateStamp, nv.ValueDateStamp);
                row++;
            }
            return table;
        }
        public static BindingList<NameValuePairRow> GetRowsFromTable(Table table)
        {
            BindingList<NameValuePairRow> list = new BindingList<NameValuePairRow>();

            for (int r = 0; r < table.GetNumRows(); r++) {
                NameValuePairRow nv = new NameValuePairRow();
                nv.Name = table.GetData(r, (int)TableColumns.NameValuePairs.Name);
                nv.Value = table.GetData(r, (int)TableColumns.NameValuePairs.Value);
                nv.NameDateStamp = table.GetData(r, (int)TableColumns.NameValuePairs.NameDateStamp);
                nv.ValueDateStamp = table.GetData(r, (int)TableColumns.NameValuePairs.ValueDateStamp);
                list.Add(nv);
            }
            return list;
        }
示例#7
0
 public static BindingList<PromptRow> GetRowsFromTable(Table table)
 {
     BindingList<PromptRow> list = new BindingList<PromptRow>();
     for (int row = 0; row < table.GetNumRows(); row++) {
         PromptRow pt = new PromptRow();
         pt.Condition = table.GetData(row, (int)TableColumns.Prompts.Condition);
         pt.Wording = table.GetData(row, (int)TableColumns.Prompts.Wording);
         pt.Id = table.GetData(row, (int)TableColumns.Prompts.Id);
         pt.ConditionDateStamp = table.GetData(row, (int)TableColumns.Prompts.ConditionDateStamp);
         pt.WordingDateStamp = table.GetData(row, (int)TableColumns.Prompts.WordingDateStamp);
         pt.IdDateStamp = table.GetData(row, (int)TableColumns.Prompts.IdDateStamp);
         list.Add(pt);
     }
     return list;
 }
 public static BindingList<MaxHandlingRow> GetRowsFromTable(Table table)
 {
     BindingList<MaxHandlingRow> list = new BindingList<MaxHandlingRow>();
     for (int row = 0; row < table.GetNumRows(); row++) {
         MaxHandlingRow mh = new MaxHandlingRow();
         mh.Condition = table.GetData(row, (int)TableColumns.MaxHandling.Condition);
         mh.Count = table.GetData(row, (int)TableColumns.MaxHandling.Count);
         mh.Action = table.GetData(row, (int)TableColumns.MaxHandling.Action);
         mh.Goto = table.GetData(row, (int)TableColumns.MaxHandling.Goto);
         mh.CountDateStamp = table.GetData(row, (int)TableColumns.MaxHandling.CountDateStamp);
         mh.ActionDateStamp = table.GetData(row, (int)TableColumns.MaxHandling.ActionDateStamp);
         mh.GotoDateStamp = table.GetData(row, (int)TableColumns.MaxHandling.GotoDateStamp);
         list.Add(mh);
     }
     return list;
 }
示例#9
0
        public static Table GetTableFromRows(BindingList<ChangeLogRow> rows)
        {
            Table table = new Table(rows.Count, Enum.GetNames(typeof(TableColumns.ChangeLog)).Length);

            int row = 0;
            foreach (ChangeLogRow cl in rows) {
                table.SetData(row, (int)TableColumns.ChangeLog.Date, cl.Date);
                table.SetData(row, (int)TableColumns.ChangeLog.Version, cl.Version);
                table.SetData(row, (int)TableColumns.ChangeLog.Details, cl.Details);
                table.SetData(row, (int)TableColumns.ChangeLog.Author, cl.Author);
                table.SetData(row, (int)TableColumns.ChangeLog.Highlight, cl.Highlight);
                row++;
            }

            return table;
        }
 public static BindingList<ConfirmationPromptRow> GetRowsFromTable(Table table)
 {
     BindingList<ConfirmationPromptRow> list = new BindingList<ConfirmationPromptRow>();
     for (int row = 0; row < table.GetNumRows(); row++) {
         ConfirmationPromptRow cp = new ConfirmationPromptRow();
         cp.Option = table.GetData(row, (int)TableColumns.ConfirmationPrompts.Option);
         cp.Condition = table.GetData(row, (int)TableColumns.ConfirmationPrompts.Condition);
         cp.Wording = table.GetData(row, (int)TableColumns.ConfirmationPrompts.Wording);
         cp.Id = table.GetData(row, (int)TableColumns.ConfirmationPrompts.Id);
         cp.OptionDateStamp = table.GetData(row, (int)TableColumns.ConfirmationPrompts.OptionDateStamp);
         cp.ConditionDateStamp = table.GetData(row, (int)TableColumns.ConfirmationPrompts.ConditionDateStamp);
         cp.WordingDateStamp = table.GetData(row, (int)TableColumns.ConfirmationPrompts.WordingDateStamp);
         cp.IdDateStamp = table.GetData(row, (int)TableColumns.ConfirmationPrompts.IdDateStamp);
         list.Add(cp);
     }
     return list;
 }
示例#11
0
 public static BindingList<TransitionRow> GetRowsFromTable(Table table)
 {
     BindingList<TransitionRow> list = new BindingList<TransitionRow>();
     for (int row = 0; row < table.GetNumRows(); row++) {
         TransitionRow ct = new TransitionRow();
         ct.Action = table.GetData(row, (int)TableColumns.Transitions.Action);
         ct.Condition = table.GetData(row, (int)TableColumns.Transitions.Condition);
         // stash the real goto data in a hidden column
         ct.GotoData_TreatAsDateStamp = table.GetData(row, (int)TableColumns.Transitions.Goto);
         Shadow targetShadow = Common.GetGotoTargetFromData(ct.GotoData_TreatAsDateStamp);
         if (targetShadow == null)
             ct.Goto = ct.GotoData_TreatAsDateStamp;
         else
             ct.Goto = targetShadow.GetGotoName();
         ct.ActionDateStamp = table.GetData(row, (int)TableColumns.Transitions.ActionDateStamp);
         ct.ConditionDateStamp = table.GetData(row, (int)TableColumns.Transitions.ConditionDateStamp);
         ct.GotoDateStamp = table.GetData(row, (int)TableColumns.Transitions.GotoDateStamp);
         list.Add(ct);
     }
     return list;
 }
        public static BindingList<NameValuePairRow> GetRowsFromTable(Table table)
        {
            BindingList<NameValuePairRow> list = new BindingList<NameValuePairRow>();

            Boolean newStartStep = false;
            //Version 1.6.1.13+ uses a new set of fields for init data NV pairs - Notes column was added JDK 08-25-2014
            if (table.GetNumColumns() >= 5)
            {
                newStartStep = true;
            }

            if (newStartStep)
            {
                for (int r = 0; r < table.GetNumRows(); r++)
                {
                    NameValuePairRow nv = new NameValuePairRow();
                    nv.Name = table.GetData(r, (int)TableColumns.NameValuePairs.Name);
                    nv.Value = table.GetData(r, (int)TableColumns.NameValuePairs.Value);
                    nv.Notes = table.GetData(r, (int)TableColumns.NameValuePairs.Notes);
                    nv.NameDateStamp = table.GetData(r, (int)TableColumns.NameValuePairs.NameDateStamp);
                    nv.ValueDateStamp = table.GetData(r, (int)TableColumns.NameValuePairs.ValueDateStamp);
                    nv.NotesDateStamp = table.GetData(r, (int)TableColumns.NameValuePairs.NotesDateStamp);
                    list.Add(nv);
                }
            } else {
                for (int r = 0; r < table.GetNumRows(); r++)
                {
                    NameValuePairRow nv = new NameValuePairRow();
                    nv.Name = table.GetData(r, (int)TableColumns.NameValuePairs.Name);
                    nv.Value = table.GetData(r, (int)TableColumns.NameValuePairs.Value);
                    nv.Notes = "";
                    nv.NameDateStamp = table.GetData(r, (int)TableColumns.NameValuePairs.NameDateStamp);
                    nv.ValueDateStamp = table.GetData(r, (int)TableColumns.NameValuePairs.ValueDateStamp);
                    nv.NotesDateStamp = "";
                    list.Add(nv);
                }
            }
            return list;
        }
        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;
        }
 internal void SetMaxHandling(Table table)
 {
     Common.SetCellTable(shape, ShapeProperties.Start.MaxHandling, table);
 }
 internal void SetInitialization(Table table)
 {
     Common.SetCellTable(shape, ShapeProperties.Start.Initialization, table);
 }
 internal void SetDefaultSettings(Table table)
 {
     Common.SetCellTable(shape, ShapeProperties.Start.DefaultSettings, table);
 }
 internal void SetConfirmationPrompts(Table table)
 {
     Common.SetCellTable(shape, ShapeProperties.Start.ConfirmationPrompts, table);
 }
 internal void SetCommandTransitions(Table table)
 {
     Common.SetCellTable(shape, ShapeProperties.Start.CommandTransitions, table);
 }
 internal Table GetMaxHandling()
 {
     Table table = Common.GetCellTable(shape, ShapeProperties.Start.MaxHandling);
     if (table.IsEmpty()) {
         table = new Table(CommonShadow.MaxHandlingConditions.Length, Enum.GetNames(typeof(TableColumns.MaxHandling)).Length);
         for (int row = 0; row < CommonShadow.MaxHandlingConditions.Length; row++) {
             table.SetData(row, (int)TableColumns.MaxHandling.Condition, CommonShadow.MaxHandlingConditions[row]);
             table.SetData(row, (int)TableColumns.MaxHandling.Count, CommonShadow.MaxHandlingDefaultCounts[row]);
             table.SetData(row, (int)TableColumns.MaxHandling.Goto, CommonShadow.MaxHandlingDefaultGotos[row]);
         }
     }
     return table;
 }
        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;
        }
        public static Table GetTableFromRows(BindingList<StartCommandTransitionRow> rows)
        {
            Table table = new Table(rows.Count, Enum.GetNames(typeof(TableColumns.CommandTransitions)).Length);

            int row = 0;
            foreach (StartCommandTransitionRow ct in rows) {
                table.SetData(row, (int)TableColumns.CommandTransitions.Action, ct.Action);
                table.SetData(row, (int)TableColumns.CommandTransitions.Condition, ct.Condition);
                table.SetData(row, (int)TableColumns.CommandTransitions.Confirm, ct.Confirm);
                table.SetData(row, (int)TableColumns.CommandTransitions.DTMF, ct.DTMF);
                table.SetData(row, (int)TableColumns.CommandTransitions.Goto, ct.Goto);
                table.SetData(row, (int)TableColumns.CommandTransitions.Option, ct.Option);
                table.SetData(row, (int)TableColumns.CommandTransitions.Vocab, ct.Vocab);
                table.SetData(row, (int)TableColumns.CommandTransitions.ActionDateStamp, ct.ActionDateStamp);
                table.SetData(row, (int)TableColumns.CommandTransitions.ConditionDateStamp, ct.ConditionDateStamp);
                table.SetData(row, (int)TableColumns.CommandTransitions.ConfirmDateStamp, ct.ConfirmDateStamp);
                table.SetData(row, (int)TableColumns.CommandTransitions.DTMFDateStamp, ct.DTMFDateStamp);
                table.SetData(row, (int)TableColumns.CommandTransitions.GotoDateStamp, ct.GotoDateStamp);
                table.SetData(row, (int)TableColumns.CommandTransitions.OptionDateStamp, ct.OptionDateStamp);
                table.SetData(row, (int)TableColumns.CommandTransitions.VocabDateStamp, ct.VocabDateStamp);
                row++;
            }
            return table;
        }
 internal void SetPromptTypes(Table table)
 {
     Common.SetCellTable(shape, ShapeProperties.Start.PromptTypes, table);
 }
 internal void SetTransitions(Table table)
 {
     SetTransitionsWithoutRemovingOutputsForDeletedTransitions(table);
     RemoveOutputsIfNotInTableColumn(table, (int)TableColumns.Transitions.Goto);
 }
        internal void SetDeveloperNotes(Table table)
        {
            Table tmp = GetDeveloperNotes();

            if ((table.GetData(0, 0) == null || table.GetData(0, 0).Length == 0) && tmp.IsEmpty())
                return;

            if (tmp.IsEmpty()) {
                table.SetData(0, (int)TableColumns.DeveloperNotes.TextDateStamp, DateTime.Now.ToString(Strings.DateColumnFormatString));
                Common.SetCellTable(shape, ShapeProperties.DeveloperNotes, table);
            }
            else if (!tmp.GetData(0, (int)TableColumns.DeveloperNotes.Text).Equals(table.GetData(0, (int)TableColumns.DeveloperNotes.Text))) {
                table.SetData(0, (int)TableColumns.DeveloperNotes.TextDateStamp, DateTime.Now.ToString(Strings.DateColumnFormatString));
                Common.SetCellTable(shape, ShapeProperties.DeveloperNotes, table);
            }
        }
示例#25
0
        internal void RemoveOutputsIfNotInTableColumn(Table table, int gotoColumn)
        {
            List<Connect> connects = GetShapeOutputs();
            List<Shadow> shadows = new List<Shadow>();

            foreach (Connect connect in connects) {
                // The 1D connector is always the To and 2D shapes are always the From
                Shape toShape = connect.FromSheet;
                Shadow shadow = PathMaker.LookupShadowByShape(toShape);
                shadows.Add(shadow);
            }

            for (int row = 0; row < table.GetNumRows(); row++) {
                string uid = table.GetData(row, gotoColumn);
                Shadow shadow = PathMaker.LookupShadowByUID(uid);
                if (shadow != null)
                    shadows.Remove(shadow);
            }

            if (shadows.Count > 0) {
                foreach (Shadow shadow in shadows)
                    shadow.shape.Delete();
            }
        }
        /**
         * Because SetTransitions calls RemoveOutputsForDeletedTransitions, it can result in
         * a shape delete.  When it's being called because of a connector delete, we can end
         * up with an error because we try to delete the same shape twice.  This avoids that.
         **/
        private void SetTransitionsWithoutRemovingOutputsForDeletedTransitions(Table table)
        {
            List<Connect> connects = GetShapeOutputs();

            for (int r = 0; r < table.GetNumRows(); r++) {
                string uid = table.GetData(r, (int)TableColumns.Transitions.Goto);
                ConnectorShadow shadow = PathMaker.LookupShadowByUID(uid) as ConnectorShadow;
                if (shadow != null)
                    shadow.SetLabelName(table.GetData(r, (int)TableColumns.Transitions.Condition));
            }

            Common.SetCellTable(shape, ShapeProperties.Transitions, table);
        }
 internal void SetPrefixListTable(Table prefixList)
 {
     Common.SetCellTable(shape, ShapeProperties.PrefixList.Prefix, prefixList);
 }
 public static BindingList<StartCommandTransitionRow> GetRowsFromTable(Table table)
 {
     BindingList<StartCommandTransitionRow> list = new BindingList<StartCommandTransitionRow>();
     for (int row = 0; row < table.GetNumRows(); row++) {
         StartCommandTransitionRow ct = new StartCommandTransitionRow();
         ct.Action = table.GetData(row, (int)TableColumns.CommandTransitions.Action);
         ct.Condition = table.GetData(row, (int)TableColumns.CommandTransitions.Condition);
         ct.Confirm = table.GetData(row, (int)TableColumns.CommandTransitions.Confirm);
         ct.DTMF = table.GetData(row, (int)TableColumns.CommandTransitions.DTMF);
         ct.Goto = table.GetData(row, (int)TableColumns.CommandTransitions.Goto);
         ct.Option = table.GetData(row, (int)TableColumns.CommandTransitions.Option);
         ct.Vocab = table.GetData(row, (int)TableColumns.CommandTransitions.Vocab);
         ct.ActionDateStamp = table.GetData(row, (int)TableColumns.CommandTransitions.ActionDateStamp);
         ct.ConditionDateStamp = table.GetData(row, (int)TableColumns.CommandTransitions.ConditionDateStamp);
         ct.ConfirmDateStamp = table.GetData(row, (int)TableColumns.CommandTransitions.ConfirmDateStamp);
         ct.DTMFDateStamp = table.GetData(row, (int)TableColumns.CommandTransitions.DTMFDateStamp);
         ct.GotoDateStamp = table.GetData(row, (int)TableColumns.CommandTransitions.GotoDateStamp);
         ct.OptionDateStamp = table.GetData(row, (int)TableColumns.CommandTransitions.OptionDateStamp);
         ct.VocabDateStamp = table.GetData(row, (int)TableColumns.CommandTransitions.VocabDateStamp);
         list.Add(ct);
     }
     return list;
 }
示例#29
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];

                    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));
                    }
                    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));
                    nextNum++;
                }

                return nextNum - startNumber;
            }
            else
                return 0;
        }
 internal void SetChangeLog(Table table)
 {
     Common.SetCellTable(shape, ShapeProperties.ChangeLog.Changes, table);
 }
示例#31
0
        // tried to do this as a BackgroundWorker - way too slow.  Need to use the ProgressBarForm this way for
        // good performance.
        internal static bool DoVersion1Upgrade(Object arg, ProgressBarForm progressBarForm)
        {
            Document document = arg as Document;

            // these should only ever be used here...
            const string OffPageReferenceShapeName        = "Off-page reference";
            const string DynamicConnectorShapeName        = "Dynamic connector";
            const string OnPageReferenceIncomingShapeName = "On-page reference.Incoming";
            const string OnPageReferenceOutgoingShapeName = "On-page reference.Outgoing";
            const string SubDialogCallShapeName           = "Call Sub-Dialog";
            const string CommentShapeName       = "Comment";
            const string PageShapeName          = "Sheet";
            const string ReturnShapeName        = "Return";
            const string PlaceHolderShapeName   = "Placeholder";
            const string DMTypeCellName         = "Prop.DMType";
            const string DocumentTitleShapeName = "Document Title";
            const string ChangeLogShapeName     = "Change Log";
            const string TransferShapeName      = "Transfer";
            const string TransferShapeName2     = "Terminator";
            const string HangUpShapeName        = "Hang up";

            // most transitions can point to terminals (hangup/transfer/return) but not
            // maxhandlers - so we need a list without terminals to use for maxhandler conversions
            Dictionary <string, List <string> > uniqueIdMap            = new Dictionary <string, List <string> >();
            Dictionary <string, List <string> > uniqueIdMapNoTerminals = new Dictionary <string, List <string> >();

            int total = 0;

            foreach (Page page in document.Pages)
            {
                total += page.Shapes.Count;
            }

            total = total * 4; // add some extra for the stuff done outside of this loop at the end

            int counter = 0;

            foreach (Page page in document.Pages)
            {
                foreach (Shape shape in page.Shapes)
                {
                    ShapeTypes shapeType = ShapeTypes.None;

                    progressBarForm.SetProgressPercentage(counter++, total);
                    if (progressBarForm.Cancelled)
                    {
                        return(false);
                    }

                    string dmType = Common.GetCellString(shape, DMTypeCellName);

                    if (dmType.Equals("IA", StringComparison.Ordinal))
                    {
                        shapeType = ShapeTypes.Interaction;
                    }
                    else if (dmType.Equals("PP", StringComparison.Ordinal))
                    {
                        shapeType = ShapeTypes.Play;
                    }
                    else if (dmType.Equals("DE", StringComparison.Ordinal))
                    {
                        shapeType = ShapeTypes.Decision;
                    }
                    else if (dmType.Equals("DR", StringComparison.Ordinal))
                    {
                        shapeType = ShapeTypes.Data;
                    }
                    else if (dmType.Equals("SD", StringComparison.Ordinal))
                    {
                        shapeType = ShapeTypes.SubDialog;
                    }
                    else if (dmType.Equals("ST", StringComparison.Ordinal))
                    {
                        shapeType = ShapeTypes.Start;
                    }

                    if (shapeType == ShapeTypes.None)
                    {
                        // Figure out what else it could be...
                        if (shape.Name.StartsWith(DocumentTitleShapeName))
                        {
                            shapeType = ShapeTypes.DocTitle;
                        }
                        else if (shape.Name.StartsWith(ChangeLogShapeName))
                        {
                            shapeType = ShapeTypes.ChangeLog;
                        }
                        else if (shape.Name.StartsWith(TransferShapeName) || shape.Name.StartsWith(TransferShapeName2))
                        {
                            shapeType = ShapeTypes.Transfer;
                        }
                        else if (shape.Name.StartsWith(HangUpShapeName))
                        {
                            shapeType = ShapeTypes.HangUp;
                        }
                        else if (shape.Name.StartsWith(OffPageReferenceShapeName))
                        {
                            shapeType = ShapeTypes.OffPageRef;
                        }
                        else if (shape.Name.StartsWith(DynamicConnectorShapeName))
                        {
                            shapeType = ShapeTypes.Connector;
                        }
                        else if (shape.Name.StartsWith(OnPageReferenceIncomingShapeName))
                        {
                            shapeType = ShapeTypes.OnPageRefIn;
                        }
                        else if (shape.Name.StartsWith(OnPageReferenceOutgoingShapeName))
                        {
                            shapeType = ShapeTypes.OnPageRefOut;
                        }
                        else if (shape.Name.StartsWith(SubDialogCallShapeName))
                        {
                            shapeType = ShapeTypes.CallSubDialog;
                        }
                        else if (shape.Name.StartsWith(CommentShapeName))
                        {
                            shapeType = ShapeTypes.Comment;
                        }
                        else if (shape.Name.StartsWith(PageShapeName))
                        {
                            shapeType = ShapeTypes.Page;
                        }
                        else if (shape.Name.StartsWith(ReturnShapeName))
                        {
                            shapeType = ShapeTypes.Return;
                        }
                        else if (shape.Name.StartsWith(PlaceHolderShapeName))
                        {
                            shapeType = ShapeTypes.Placeholder;
                        }
                        else
                        {
                            postUpgradeReportString += "Shape could not be upgraded properly - " + ShapeDescription(shape) + "\n\n";
                            shape.Text = Strings.ToBeDeletedLabel;
                            continue;
                        }
                    }

                    System.Diagnostics.Debug.Assert(shapeType != ShapeTypes.None);

                    // we really don't need to do anything with the page shapes
                    // this also includes the rectangles drawn for revision history
                    if (shapeType == ShapeTypes.Page)
                    {
                        continue;
                    }

                    // remove the action properties on all shapes
                    RemoveRightMouseAction(shape, "P&roperties");

                    // and fix the actions for the ones we care about
                    if (shapeType != ShapeTypes.OffPageRef && shapeType != ShapeTypes.HangUp &&
                        shapeType != ShapeTypes.OnPageRefIn && shapeType != ShapeTypes.OnPageRefOut &&
                        shapeType != ShapeTypes.Return && shapeType != ShapeTypes.Transfer &&
                        shapeType != ShapeTypes.Comment && shapeType != ShapeTypes.Placeholder &&
                        shapeType != ShapeTypes.Connector)
                    {
                        AddRightMouseAction(shape, "P&roperties", "RUNADDONWARGS(\"QueueMarkerEvent\",\"/PathMaker /CMD=2\")",
                                            true, false, false, false);
                    }

                    // delete old rows no longer used
                    DeleteOldPropertyCell(shape, "Prop.TestPlanSetting");
                    DeleteOldPropertyCell(shape, "Prop.CheckPoints");
                    DeleteOldPropertyCell(shape, "Prop.UpdateData");
                    DeleteOldPropertyCell(shape, "Prop.LineName");
                    DeleteOldPropertyCell(shape, "Prop.Input");
                    DeleteOldPropertyCell(shape, "Prop.Output");
                    DeleteOldPropertyCell(shape, "Prop.OSDM");
                    DeleteOldPropertyCell(shape, "Prop.Destination");
                    DeleteOldPropertyCell(shape, "Prop.ColumnData");
                    DeleteOldPropertyCell(shape, "Prop.EnteringFrom");
                    DeleteOldPropertyCell(shape, "Prop.StartingDialogState");
                    DeleteOldPropertyCell(shape, "Prop.StartingDM");
                    DeleteOldPropertyCell(shape, "Prop.ChangeDate");
                    DeleteOldPropertyCell(shape, "Prop.InitialDate");
                    DeleteOldPropertyCell(shape, "Prop.LogoFilePath");
                    DeleteOldPropertyCell(shape, "Prop.LastUpdate");

                    if (shapeType == ShapeTypes.CallSubDialog)
                    {
                        // none of these are used...
                        DeleteOldPropertyCell(shape, "Prop.DMName");
                        DeleteOldPropertyCell(shape, "Prop.EnteringFrom");
                        DeleteOldPropertyCell(shape, "Prop.StartingDialogState");
                        DeleteOldPropertyCell(shape, "Prop.Notes");
                        DeleteOldPropertyCell(shape, "Prop.LastUpdate");
                        DeleteOldPropertyCell(shape, "Prop.Transitions");
                    }
                    else if (shapeType == ShapeTypes.SubDialog)
                    {
                        DeleteOldPropertyCell(shape, "Prop.Transitions");
                    }

                    // Add a new cell containing the name of the subdialog being called
                    // Later it will be converted to a UID
                    if (shapeType == ShapeTypes.CallSubDialog)
                    {
                        Common.SetCellString(shape, ShapeProperties.CallSubDialog.SubDialogUID, shape.Text);
                    }

                    // rename rows that are confusing
                    RenameRow(shape, "Prop.DialogParameters", ShapeProperties.SpecialSettings, "Special Settings");
                    RenameRow(shape, "Prop.DMName", ShapeProperties.StateId, "State Name");
                    RenameRow(shape, "Prop.DMType", ShapeProperties.ShapeType, "Shape Type");
                    RenameRow(shape, "Prop.InputData", ShapeProperties.Start.Initialization, "Initialization");
                    RenameRow(shape, "Prop.GlobalCommands", ShapeProperties.CommandTransitions, "Command Transitions");
                    RenameRow(shape, "Prop.GlobalPrompts", ShapeProperties.PromptTypes, "Prompt Types");
                    RenameRow(shape, "Prop.GlobalConfirmations", ShapeProperties.ConfirmationPrompts, "Confirmation Prompts");
                    RenameRow(shape, "Prop.TitleLine1", ShapeProperties.DocTitle.ClientName, "Client Name");
                    RenameRow(shape, "Prop.TitleLine2", ShapeProperties.DocTitle.ProjectName, "Project Name");
                    if (shapeType == ShapeTypes.Interaction)
                    {
                        RenameRow(shape, "Prop.Transitions", "Prop.CommandTransitions", "Command Transitions");
                        RenameRow(shape, "Prop.Prompts", "Prop.PromptTypes", "Prompt Types");
                    }

                    // undo encoding we'll never use
                    UnencodeProperty(shape, ShapeProperties.ChangeLog.Changes);
                    UnencodeProperty(shape, ShapeProperties.Start.DefaultSettings);
                    UnencodeProperty(shape, ShapeProperties.Start.Initialization);
                    UnencodeProperty(shape, ShapeProperties.MaxHandling);
                    UnencodeProperty(shape, ShapeProperties.Play.Prompts);
                    UnencodeProperty(shape, ShapeProperties.PromptTypes);
                    UnencodeProperty(shape, ShapeProperties.Transitions);
                    UnencodeProperty(shape, ShapeProperties.CommandTransitions);
                    UnencodeProperty(shape, ShapeProperties.SpecialSettings);
                    UnencodeProperty(shape, ShapeProperties.DeveloperNotes);
                    UnencodeProperty(shape, ShapeProperties.ConfirmationPrompts);
                    UnencodeProperty(shape, ShapeProperties.LastUpdate);

                    // make each shape get a GUID
                    string uniqueId = shape.get_UniqueID((short)VisUniqueIDArgs.visGetOrMakeGUID);
                    // off page refs have two shapes with the same name and we don't need them for this
                    if (shapeType != ShapeTypes.OffPageRef)
                    {
                        List <string> list = null;

                        if (uniqueIdMap.TryGetValue(shape.Name, out list))
                        {
                            list.Add(uniqueId);
                        }
                        else
                        {
                            list = new List <string>();
                            list.Add(uniqueId);
                            uniqueIdMap.Add(shape.Name, list);
                        }

                        if (shapeType != ShapeTypes.Placeholder && shapeType != ShapeTypes.HangUp &&
                            shapeType != ShapeTypes.Transfer && shapeType != ShapeTypes.Return)
                        {
                            list = null;
                            if (uniqueIdMapNoTerminals.TryGetValue(shape.Name, out list))
                            {
                                list.Add(uniqueId);
                            }
                            else
                            {
                                list = new List <string>();
                                list.Add(uniqueId);
                                uniqueIdMapNoTerminals.Add(shape.Name, list);
                            }
                        }
                    }

                    // change all double click handlers
                    if (shapeType == ShapeTypes.DocTitle || shapeType == ShapeTypes.ChangeLog ||
                        shapeType == ShapeTypes.Start || shapeType == ShapeTypes.Interaction ||
                        shapeType == ShapeTypes.Play || shapeType == ShapeTypes.Decision ||
                        shapeType == ShapeTypes.Data || shapeType == ShapeTypes.SubDialog ||
                        shapeType == ShapeTypes.CallSubDialog)
                    {
                        Common.SetCellFormula(shape, "EventDblClick", "RUNADDONWARGS(\"QueueMarkerEvent\",\"/PathMaker /CMD=1\")");
                    }

                    // global transitions need a new column to match the interaction transitions
                    if (shapeType == ShapeTypes.Start)
                    {
                        Table table = Common.GetCellTable(shape, ShapeProperties.CommandTransitions);
                        if (!table.IsEmpty())
                        {
                            int newCol = table.AddColumn();
                            System.Diagnostics.Debug.Assert(newCol == 18);
                            // copies the goto column to the line column to match interactions
                            table.CopyColumn(7, 18);
                            Common.SetCellTable(shape, ShapeProperties.CommandTransitions, table);
                        }
                    }

                    // unlock most shape text edits - remember play and interaction are multiple shapes
                    if (shapeType == ShapeTypes.Data || shapeType == ShapeTypes.Decision ||
                        shapeType == ShapeTypes.Interaction || shapeType == ShapeTypes.Play || shapeType == ShapeTypes.SubDialog)
                    {
                        shape.get_CellsSRC((short)VisSectionIndices.visSectionObject,
                                           (short)VisRowIndices.visRowLock,
                                           (short)VisCellIndices.visLockTextEdit).FormulaU = "0";
                    }
                    if (shapeType == ShapeTypes.Interaction || shapeType == ShapeTypes.Play)
                    {
                        shape.Shapes[1].get_CellsSRC((short)VisSectionIndices.visSectionObject,
                                                     (short)VisRowIndices.visRowLock,
                                                     (short)VisCellIndices.visLockTextEdit).FormulaU = "0";
                        // and bring it to front so you are editing the shape name by default
                        shape.Shapes[1].BringToFront();
                    }
                    // the old stuff never locked call sub dialogs - we want to
                    if (shapeType == ShapeTypes.CallSubDialog)
                    {
                        shape.get_CellsSRC((short)VisSectionIndices.visSectionObject,
                                           (short)VisRowIndices.visRowLock,
                                           (short)VisCellIndices.visLockTextEdit).FormulaU = "1";
                    }

                    // normalize/fix all the grid datastore stuff - get rid of unused columns, etc.
                    // remove plus, minus, goto, update_plus, update_minus, cp_idx
                    RemoveColumnsFromCellTable(shape, ShapeProperties.CommandTransitions, new int[6] {
                        3, 5, 7, 12, 14, 19
                    });
                    // remove plus, minus, update_plus, update_minus
                    RemoveColumnsFromCellTable(shape, ShapeProperties.ConfirmationPrompts, new int[4] {
                        1, 3, 7, 9
                    });
                    // remove plus, minus, updateplus, updateminus
                    RemoveColumnsFromCellTable(shape, ShapeProperties.PromptTypes, new int[4] {
                        1, 3, 7, 9
                    });
                    // remove plus, minus, updateplus, updateminus, cp_idx
                    RemoveColumnsFromCellTable(shape, ShapeProperties.Play.Prompts, new int[5] {
                        0, 2, 5, 7, 10
                    });
                    // remove plus, minus, goto, updateplus, updateminus
                    RemoveColumnsFromCellTable(shape, ShapeProperties.Transitions, new int[5] {
                        0, 2, 4, 5, 7
                    });
                    // remove highlight index column
                    RemoveColumnsFromCellTable(shape, ShapeProperties.ChangeLog.Changes, new int[1] {
                        5
                    });

                    // clear any old changelog descriptions from the page itself
                    if (shapeType == ShapeTypes.ChangeLog)
                    {
                        Page changeLogPage = shape.ContainingPage;
                        for (int count = changeLogPage.Shapes.Count; count > 0; count--)
                        {
                            if (changeLogPage.Shapes[count] != shape)
                            {
                                changeLogPage.Shapes[count].Delete();
                            }
                        }
                    }

                    // Start has the max handlers in a different order than the interaction states - fix it here
                    if (shapeType == ShapeTypes.Start)
                    {
                        SwapRowsInCellTable(shape, ShapeProperties.MaxHandling, 0, 1);
                    }

                    // Get rid of expressware checkpoints default setting
                    if (shapeType == ShapeTypes.Start)
                    {
                        Table table = Common.GetCellTable(shape, ShapeProperties.Start.DefaultSettings);
                        for (int r = 0; r < table.GetNumRows(); r++)
                        {
                            if (table.GetData(r, 0).Equals("ExpressWare Checkpoints"))
                            {
                                table.DeleteRow(r);
                                break;
                            }
                        }
                    }

                    // apparently subDialogs developer notes were not written out as a two column entry (one for date of change)
                    if (shapeType == ShapeTypes.SubDialog)
                    {
                        EnsureTwoColumns(shape, ShapeProperties.DeveloperNotes);
                    }

                    // set shape type - this will add it if necessary - make sure to use int value
                    Common.SetCellFormula(shape, ShapeProperties.ShapeType, ((int)shapeType).ToString());
                    SetRowLabel(shape, ShapeProperties.ShapeType, "Shape Type");
                }
            }

            // we remove change log stuff above - need to recount the remaining totals
            total = 0;
            foreach (Page page in document.Pages)
            {
                total += page.Shapes.Count;
            }
            total = counter + (total * 3);  // we'll go through 3 times below

            // The following stuff needed to wait until every state had a GUID

            // change all references from state ids/names to use GUIDs
            foreach (Page page in document.Pages)
            {
                foreach (Shape shape in page.Shapes)
                {
                    // column 13 should now be the link column
                    ReplaceStateIdsWithUniqueIds(shape, uniqueIdMap, ShapeProperties.CommandTransitions, 13);
                    // column 5 should be the link column
                    ReplaceStateIdsWithUniqueIds(shape, uniqueIdMap, ShapeProperties.Transitions, 5);
                    // column 3 should be the goto column
                    ReplaceStateIdsWithUniqueIds(shape, uniqueIdMapNoTerminals, ShapeProperties.MaxHandling, 3);
                    // it's a singleton, not a table - only exists on call subdialogs
                    ReplaceStateIdWithUniqueIds(shape, uniqueIdMap, ShapeProperties.CallSubDialog.SubDialogUID);
                    progressBarForm.SetProgressPercentage(counter++, total);
                    if (progressBarForm.Cancelled)
                    {
                        return(false);
                    }
                }
            }

            // fix off page connectors
            Dictionary <string, Shape> offPageShapeNameMap = new Dictionary <string, Shape>();

            foreach (Page page in document.Pages)
            {
                foreach (Shape shape in page.Shapes)
                {
                    if (Common.GetShapeType(shape) == ShapeTypes.OffPageRef)
                    {
                        // common fixes
                        // hyperlinks point to pages, not shapes, even if the shape is deleted - drop these
                        short row;
                        if (shape.get_CellExists(ShapeProperties.OffPageRef.HyperLink, (short)VisExistsFlags.visExistsAnywhere) != 0)
                        {
                            row = shape.get_CellsRowIndex(ShapeProperties.OffPageRef.HyperLink);
                            shape.DeleteRow((short)VisSectionIndices.visSectionHyperlink, row);
                        }
                        if (shape.get_CellExists("Hyperlink.PageLinkDest", (short)VisExistsFlags.visExistsAnywhere) != 0)
                        {
                            row = shape.get_CellsRowIndex("Hyperlink.PageLinkDest");
                            shape.DeleteRow((short)VisSectionIndices.visSectionHyperlink, row);
                        }
                        // the standard off-page connector dbl click handler works fine
                        Common.SetCellFormula(shape, ShapeProperties.EventDblClick, Strings.OffPageConnectorDblClickCommand);
                        // the standard off-page connector drop handler works fine
                        Common.SetCellFormula(shape, ShapeProperties.EventDrop, Strings.OffPageConnectorDropCommand);
                        // keep the text synchronized
                        Common.SetCellFormula(shape, ShapeProperties.TheText, Strings.OffPageConnectorTextCommand);
                        // delete actions to change shape to circle/arrow
                        row = shape.get_CellsRowIndex("Actions.Row_3");
                        shape.DeleteRow((short)VisSectionIndices.visSectionAction, row);
                        row = shape.get_CellsRowIndex("Actions.Row_4");
                        shape.DeleteRow((short)VisSectionIndices.visSectionAction, row);

                        Shape target;
                        if (offPageShapeNameMap.TryGetValue(shape.Text, out target))
                        {
                            // we have a pair...
                            Common.SetCellString(shape, ShapeProperties.OffPageConnectorShapeID,
                                                 shape.get_UniqueID((short)VisUniqueIDArgs.visGetOrMakeGUID));
                            Common.SetCellString(shape, ShapeProperties.OffPageConnectorDestinationPageID,
                                                 target.ContainingPage.PageSheet.get_UniqueID((short)VisUniqueIDArgs.visGetOrMakeGUID));
                            Common.SetCellString(shape, ShapeProperties.OffPageConnectorDestinationShapeID,
                                                 target.get_UniqueID((short)VisUniqueIDArgs.visGetOrMakeGUID));

                            Common.SetCellString(target, ShapeProperties.OffPageConnectorShapeID,
                                                 target.get_UniqueID((short)VisUniqueIDArgs.visGetOrMakeGUID));
                            Common.SetCellString(target, ShapeProperties.OffPageConnectorDestinationPageID,
                                                 shape.ContainingPage.PageSheet.get_UniqueID((short)VisUniqueIDArgs.visGetOrMakeGUID));
                            Common.SetCellString(target, ShapeProperties.OffPageConnectorDestinationShapeID,
                                                 shape.get_UniqueID((short)VisUniqueIDArgs.visGetOrMakeGUID));

                            offPageShapeNameMap.Remove(shape.Text);
                        }
                        else
                        {
                            offPageShapeNameMap.Add(shape.Text, shape);
                        }
                    }
                    progressBarForm.SetProgressPercentage(counter++, total);
                    if (progressBarForm.Cancelled)
                    {
                        return(false);
                    }
                }
            }

            // In CID you could have on-page connectors backwards - check for them here
            foreach (Page page in document.Pages)
            {
                foreach (Shape shape in page.Shapes)
                {
                    if (Common.GetShapeType(shape) == ShapeTypes.OnPageRefIn)
                    {
                        bool arrowSide = false;
                        foreach (Connect c in shape.FromConnects)
                        {
                            // determine which end of the connector is connected to the nonConnectorShadow
                            if (c.FromCell.Name.Equals(Strings.EndConnectionPointCellName))
                            {
                                arrowSide = true;
                            }
                        }
                        // if we are on the arrow side of the connector, that means this is an input connector
                        if (arrowSide)
                        {
                            postUpgradeReportString += "On page reference input can't have inputs - " + ShapeDescription(shape) + "\n\n";
                            catastrophicError        = true;
                        }
                    }
                    else if (Common.GetShapeType(shape) == ShapeTypes.OnPageRefOut)
                    {
                        bool arrowSide = true;
                        foreach (Connect c in shape.FromConnects)
                        {
                            // determine which end of the connector is connected to the nonConnectorShadow
                            if (c.FromCell.Name.Equals(Strings.EndConnectionPointCellName))
                            {
                                arrowSide = true;
                            }

                            // if we are on the non-arrow side of the connector, that means this is an output connector
                            if (!arrowSide)
                            {
                                postUpgradeReportString += "On page reference output can't have outputs - " + ShapeDescription(shape) + "\n\n";
                                catastrophicError        = true;
                            }
                        }
                    }
                }
            }

            // any left over are not hooked up - this is a problem...
            if (offPageShapeNameMap.Count > 0)
            {
                for (int i = 0; i < offPageShapeNameMap.Count; i++)
                {
                    Shape noMatch = offPageShapeNameMap.Values.ElementAt(i);
                    postUpgradeReportString += "No matching off page connector found for " + ShapeDescription(noMatch) + "\n\n";
                    noMatch.Text             = Strings.ToBeDeletedLabel;
                }
            }

            // Last thing to do - now that we can use all the new column names, we want to find all table fields using $$ and fix them
            foreach (Page page in document.Pages)
            {
                foreach (Shape shape in page.Shapes)
                {
                    FixDollarDollarTableFields(shape, ShapeProperties.CommandTransitions);
                    FixDollarDollarTableFields(shape, ShapeProperties.PromptTypes);
                    FixDollarDollarTableFields(shape, ShapeProperties.ConfirmationPrompts);
                    FixDollarDollarTableFields(shape, ShapeProperties.MaxHandling);
                    FixDollarDollarTableFields(shape, ShapeProperties.DeveloperNotes);
                    FixDollarDollarTableFields(shape, ShapeProperties.SpecialSettings);
                    FixDollarDollarTableFields(shape, ShapeProperties.Transitions);
                    FixDollarDollarTableFields(shape, ShapeProperties.Play.Prompts);
                    FixDollarDollarTableFields(shape, ShapeProperties.Start.DefaultSettings);
                    FixDollarDollarTableFields(shape, ShapeProperties.Start.Initialization);
                    progressBarForm.SetProgressPercentage(counter++, total);
                    if (progressBarForm.Cancelled)
                    {
                        return(false);
                    }
                }
            }
            progressBarForm.SetProgressPercentage(100, 100);

            progressBarForm.Hide();
            progressBarForm = null;
            return(true);
        }