コード例 #1
0
ファイル: StartForm.cs プロジェクト: btuny/pathmaker_os_files
        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);
        }