Ejemplo n.º 1
0
        private static void AddStartElement(XmlDocument xmlDoc, StartShadow shadow)
        {
            XmlElement startElement = CreateElement(xmlDoc.DocumentElement, xmlStrings.Start);

            AddNameValuePairs(shadow.GetDefaultSettings(), startElement, xmlStrings.DefaultSettings);
            XmlElement globalBehaviorElement = CreateElement(startElement, xmlStrings.GlobalBehavior);

            AddPromptTypes(shadow.GetPromptTypes(), globalBehaviorElement);
            AddCommandTransitions(shadow, shadow.GetCommandTransitions(), globalBehaviorElement);
            AddConfirmationList(shadow.GetConfirmationPrompts(), globalBehaviorElement);
            AddNameValuePairs(shadow.GetInitialization(), startElement, xmlStrings.Initialization);
            XmlElement firstStateElement = CreateElement(startElement, xmlStrings.FirstState);

            firstStateElement.InnerText = GetXmlGotoFromShadow(shadow.GetFirstStateGotoTarget());
            AddMaxHandling(shadow, shadow.GetMaxHandling(), startElement);
        }
Ejemplo n.º 2
0
 private static void AddStartElement(XmlDocument xmlDoc, StartShadow shadow)
 {
     XmlElement startElement = CreateElement(xmlDoc.DocumentElement, xmlStrings.Start);
     AddNameValuePairs(shadow.GetDefaultSettings(), startElement, xmlStrings.DefaultSettings);
     XmlElement globalBehaviorElement = CreateElement(startElement, xmlStrings.GlobalBehavior);
     AddPromptTypes(shadow.GetPromptTypes(), globalBehaviorElement);
     AddCommandTransitions(shadow, shadow.GetCommandTransitions(), globalBehaviorElement);
     AddConfirmationList(shadow.GetConfirmationPrompts(), globalBehaviorElement);
     AddNameValuePairs(shadow.GetInitialization(), startElement, xmlStrings.Initialization);
     XmlElement firstStateElement = CreateElement(startElement, xmlStrings.FirstState);
     firstStateElement.InnerText = GetXmlGotoFromShadow(shadow.GetFirstStateGotoTarget());
     AddMaxHandling(shadow, shadow.GetMaxHandling(), startElement);
 }
        private static void AddStartTables(Document doc, StartShadow startShadow)
        {
            Selection content = doc.Application.Selection;

            // always work bottom of table to top so we can add rows and not move the row starts for later actions
            content.GoTo(What: WdGoToItem.wdGoToBookmark, Name: "GlobalCommands");
            doc.Tables[Templates.GlobalCommands].Range.Copy();
            content.Paste();
            Table table = startShadow.GetConfirmationPrompts();
            Microsoft.Office.Interop.Word.Table globalCommandTable = doc.Tables[doc.Tables.Count]; //was doc.Tables.Count - 4
            FillConfirmationPromptTable(globalCommandTable, 5, table);
            table = startShadow.GetCommandTransitions();
            FillCommandTransitionTable(globalCommandTable, 2, table);

            content.GoTo(What: WdGoToItem.wdGoToBookmark, Name: "GlobalPrompts");
            doc.Tables[Templates.GlobalPromptTypes].Range.Copy();
            content.Paste();
            table = startShadow.GetPromptTypes();
            Microsoft.Office.Interop.Word.Table globalPromptTypesTable = doc.Tables[doc.Tables.Count];//was  doc.Tables.Count - 3
            FillPromptTypesTable(globalPromptTypesTable, 3, table);

            content.GoTo(What: WdGoToItem.wdGoToBookmark, Name: "DefaultSettings");
            doc.Tables[Templates.DefaultSettings].Range.Copy();
            content.Paste();
            table = startShadow.GetDefaultSettings();
            Microsoft.Office.Interop.Word.Table defaultSettingsTable = doc.Tables[doc.Tables.Count];//was  doc.Tables.Count - 2
            FillNameValuePairs(defaultSettingsTable, 2, table);

            content.GoTo(What: WdGoToItem.wdGoToBookmark, Name: "MaxHandling");
            doc.Tables[Templates.GlobalMaxHandler].Range.Copy();
            content.Paste();
            table = startShadow.GetMaxHandling();
            Microsoft.Office.Interop.Word.Table maxHandlingTable = doc.Tables[doc.Tables.Count];//was  doc.Tables.Count - 1
            FillMaxHandling(maxHandlingTable, 2, table);

            content.GoTo(What: WdGoToItem.wdGoToBookmark, Name: "DialogStatesNextLine");
            Shadow firstShadow = startShadow.GetFirstStateGotoTarget();

            if (addMSWordMapMarkers)
            {
                content.Font.Name = "Arial";
                content.Font.Size = 2;
                content.Font.Color = WdColor.wdColorWhite;//change this to white late to make it more hidden
                content.TypeText("Start");
                content.set_Style(WdBuiltinStyle.wdStyleHeading3);
                content.TypeParagraph();
                content = doc.Application.Selection;//re-read all current content
            }

            doc.Tables[Templates.Start].Range.Copy();
            content.Bookmarks.Add("bmStart");
            content.Paste();
            Microsoft.Office.Interop.Word.Table startTable = doc.Tables[doc.Tables.Count];

            if (firstShadow != null) {
                Selection sel = startTable.Cell(3, 1).Application.Selection;
                sel.InsertAfter(CachedGetGotoName(firstShadow));
                sel.set_Style("HyperLink");
                string link = "bm" + Left(AlphaNumericCharsOnly(CachedGetGotoName(firstShadow)), 38);
                sel.Document.Hyperlinks.Add(Anchor: sel.Range, SubAddress: link);
                sel.set_Style("TableNormalCell");
                sel.MoveStart(WdUnits.wdWord, -1);
                sel.Cut();
                Range range = startTable.Cell(3, 1).Range;
                range.Paste();
            }

            table = startShadow.GetInitialization();
            FillNameValueNotesPairs(startTable, 6, table);

            startTable.Range.ParagraphFormat.KeepTogether = -1; // = true

            //SetCellBackgroundColorIfNecessary(startTable.Cell(1, 1), startShadow.GetLastChangeDate());
            SetCellBackgroundColorIfNecessary(startTable.Cell(1, 1), startShadow.GetLastChangeVersion());//JDK added

            content.Move(WdUnits.wdStory);
            content.set_Style("Normal");
            content.TypeParagraph();
            content.Move(WdUnits.wdStory);
        }
Ejemplo n.º 4
0
        private void Start_Load(object sender, EventArgs e)
        {
            // Default Settings
            // I didn't like showing these in a table, so these are handled custom.
            Table table = shadow.GetDefaultSettings();

            modeComboBox.Format               -= new ListControlConvertEventHandler(OnControlFormat);
            bargeInComboBox.Format            -= new ListControlConvertEventHandler(OnControlFormat);
            promptIdFormatComboBox.Format     -= new ListControlConvertEventHandler(OnControlFormat);
            retriesComboBox.Format            -= new ListControlConvertEventHandler(OnControlFormat);
            timeoutsComboBox.Format           -= new ListControlConvertEventHandler(OnControlFormat);
            disconfirmsComboBox.Format        -= new ListControlConvertEventHandler(OnControlFormat);
            modeComboBox.Format               += new ListControlConvertEventHandler(OnControlFormat);
            bargeInComboBox.Format            += new ListControlConvertEventHandler(OnControlFormat);
            promptIdFormatComboBox.Format     += new ListControlConvertEventHandler(OnControlFormat);
            retriesComboBox.Format            += new ListControlConvertEventHandler(OnControlFormat);
            timeoutsComboBox.Format           += new ListControlConvertEventHandler(OnControlFormat);
            disconfirmsComboBox.Format        += new ListControlConvertEventHandler(OnControlFormat);
            sortOrderComboBox.Format          += new ListControlConvertEventHandler(OnControlFormat);
            defaultConfirmTypeComboBox.Format += new ListControlConvertEventHandler(OnControlFormat);

            for (int r = 0; r < table.GetNumRows(); r++)
            {
                string name       = table.GetData(r, (int)TableColumns.NameValuePairs.Name);
                string value      = table.GetData(r, (int)TableColumns.NameValuePairs.Value);
                string dateString = table.GetData(r, (int)TableColumns.NameValuePairs.ValueDateStamp);

                System.Drawing.Color?color = null;
                DateTime             date;
                if (DateTime.TryParse(dateString, out date))
                {
                    color = Common.GetHighlightColor(date);
                }

                if (name.Equals(Strings.DefaultSettingsMode))
                {
                    originalMode = value;
                    CommonForm.LoadModeComboBox(modeComboBox, value);
                    if (color != null)
                    {
                        modeComboBox.BackColor = color.Value;
                    }
                }
                else if (name.Equals(Strings.DefaultSettingsBargeIn))
                {
                    originalBargeIn = value;
                    CommonForm.LoadYNComboBox(bargeInComboBox, value);
                    if (color != null)
                    {
                        bargeInComboBox.BackColor = color.Value;
                    }
                }
                else if (name.Equals(Strings.DefaultSettingsPromptIDFormat))
                {
                    originalPromptIdFormat = value;
                    CommonForm.LoadPromptIdFormatComboBox(promptIdFormatComboBox, value);
                    if (color != null)
                    {
                        promptIdFormatComboBox.BackColor = color.Value;
                    }
                }
                else if (name.Equals(Strings.DefaultSettingsRetriesInTotalErrors))
                {
                    originalRetries = value;
                    CommonForm.LoadYNComboBox(retriesComboBox, value);
                    if (color != null)
                    {
                        retriesComboBox.BackColor = color.Value;
                    }
                }
                else if (name.Equals(Strings.DefaultSettingsTimeoutsInTotalErrors))
                {
                    originalTimeouts = value;
                    CommonForm.LoadYNComboBox(timeoutsComboBox, value);
                    if (color != null)
                    {
                        timeoutsComboBox.BackColor = color.Value;
                    }
                }
                else if (name.Equals(Strings.DefaultSettingsDisconfirmsInTotalErrors))
                {
                    originalDisconfirms = value;
                    CommonForm.LoadYNComboBox(disconfirmsComboBox, value);
                    if (color != null)
                    {
                        disconfirmsComboBox.BackColor = color.Value;
                    }
                }
                else if (name.Equals(Strings.DefaultSettingsStateSortOrder))
                {
                    originalSortOrder = value;
                    CommonForm.LoadSortOrderComboBox(sortOrderComboBox, value);
                    if (color != null)
                    {
                        sortOrderComboBox.BackColor = color.Value;
                    }
                }
                else if (name.Equals(Strings.DefaultSettingsConfirmMode))
                {
                    originalDefaultConfirmType = value;
                    CommonForm.LoadDefaultConfirmTypeComboBox(defaultConfirmTypeComboBox, value);
                    if (color != null)
                    {
                        defaultConfirmTypeComboBox.BackColor = color.Value;
                    }
                }
            }

            // Initialization Name/Value Pairs
            table = shadow.GetInitialization();
            CommonForm.LoadNameValuePairDataGridView(initializationDataGridView, table);

            // Initialize Global Prompt Types
            table = shadow.GetPromptTypes();
            CommonForm.LoadPromptTypeDataGridView(promptsDataGridView, table);

            // Initialize Global Command Transitions
            table = shadow.GetCommandTransitions();
            CommonForm.LoadStartCommandTransitionDataGridView(commandsDataGridView, table);

            // Initialize Global Confirmation Prompts
            table = shadow.GetConfirmationPrompts();
            CommonForm.LoadConfirmationPromptGridView(confirmationsDataGridView, table, commandsDataGridView);

            // Initialize Max Handling
            table = shadow.GetMaxHandling();
            CommonForm.LoadMaxHandlingGridView(maxHandlingDataGridView, table);
        }