/// <summary> /// Инициализация панели /// </summary> public bool initialize(out string msgError) { bool bRes = true; msgError = string.Empty; if (s_listFormConnectionSettings[(int)CONN_SETT_TYPE.CONFIG_DB].Ready == 0) { _state = InitializeConfigDB(out msgError); switch (_state) { case -1: msgError = FormMainStatistic.MSG_ERROR_INIT[(int)FormMainStatistic.INDEX_ERROR_INIT.UNKNOWN]; break; case -3: //@"Не найден пользователь@ break; case -2: case -5: case -4: //@"Необходимо изменить параметры соединения с БД" - получено из 'Initialize' bRes = false; break; case -6: //@"Пользователю не разрешено использовать задачу" - получено из 'Initialize' break; default: //Успех... пост-инициализация formParameters = new FormParameters_DB(s_listFormConnectionSettings[(int)CONN_SETT_TYPE.CONFIG_DB].getConnSett()); updateParametersSetup(); s_iMainSourceData = Int32.Parse(formParameters.m_arParametrSetup[(int)FormParameters.PARAMETR_SETUP.MAIN_DATASOURCE]); m_panel = new PanelSourceData(SystemColors.ControlText, SystemColors.Control); m_panel.SetDelegateReport(ErrorReport, WarningReport, ActionReport, ReportClear); m_panel.Start(); #region Добавить рабочую панель на форму this._panelMain.SuspendLayout(); _panelMain.Controls.Add(this.m_panel); this._panelMain.ResumeLayout(false); this._panelMain.PerformLayout(); #endregion break; } } else {//Файла с параметрами соединения нет совсем или считанные параметры соединения не валидны msgError = @"Необходимо изменить параметры соединения с БД конфигурации"; bRes = false; } return(bRes); }
/// <summary> /// Обязательный метод для поддержки конструктора - не изменяйте /// содержимое данного метода при помощи редактора кода. /// </summary> private void InitializeComponent() { m_panelMain = new PanelSourceData(SystemColors.Control); this.SuspendLayout(); // // FormStatisticTimeSync // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(800, 600); this.Name = "FormStatisticTimeSync"; this.Text = "StatisticTimeSync"; this.MainMenuStrip = new MenuStrip(); this.MainMenuStrip.Items.AddRange( new ToolStripMenuItem[] { new ToolStripMenuItem(@"Файл") , new ToolStripMenuItem(@"Настройка") , new ToolStripMenuItem(@"О программе") } ); (this.MainMenuStrip.Items[0] as ToolStripMenuItem).DropDownItems.Add(new ToolStripMenuItem(@"Выход")); (this.MainMenuStrip.Items[0] as ToolStripMenuItem).DropDownItems[0].Click += new EventHandler(fMenuItemExit_Click); (this.MainMenuStrip.Items[1] as ToolStripMenuItem).DropDownItems.Add(new ToolStripMenuItem(@"БД конфигурации")); (this.MainMenuStrip.Items[1] as ToolStripMenuItem).DropDownItems[0].Click += new EventHandler(fMenuItemDBConfig_Click); (this.MainMenuStrip.Items[2] as ToolStripMenuItem).Click += new EventHandler(fMenuItemAbout_Click); this.Controls.Add(MainMenuStrip); //Создать панель для размещения "рабочих" панелей Panel _panelMain = new Panel(); _panelMain.Location = new Point(0, this.MainMenuStrip.Height); _panelMain.Size = new System.Drawing.Size(this.ClientSize.Width, this.ClientSize.Height - this.MainMenuStrip.Height - this.m_statusStripMain.Height); _panelMain.Anchor = (AnchorStyles)(((AnchorStyles.Left | AnchorStyles.Top) | AnchorStyles.Right) | AnchorStyles.Bottom); _panelMain.Controls.Add(this.m_panelMain); this.Controls.Add(_panelMain); this.ResumeLayout(false); this.PerformLayout(); this.Load += new System.EventHandler(FormStatisticTimeSync_Load); this.Activated += new System.EventHandler(FormStatisticTimeSync_Activate); this.Deactivate += new System.EventHandler(FormStatisticTimeSync_Deactivate); }