void form_FormClosing(object sender, FormClosingEventArgs e) { if (((Form)sender).DialogResult != DialogResult.OK) { this.ExitThread(); } else { try { DB.DataConnectionName = "oracle"; //Database db = DB.GetInstance(); List <ConfigFormEntity> formconfig = BaseControlFactory.GetFormConfigFromStationCode(LoginInfo.StationInfo.RMES_ID); if (formconfig.Count < 1) { MessageBox.Show("该站点没有绑定任何执行窗体,请确认本地设置是否正确。"); e.Cancel = true; } else { Rectangle rect = new Rectangle(); rect = Screen.PrimaryScreen.Bounds; string formID = ""; if (rect.Width >= 2000) { MessageBox.Show("请调整页面分辨率标准大小1024*768。"); e.Cancel = true; return; //formID = "FORM_MAN_ZONE"; } else { //formID = "FORM_MAN_ZONE"; formID = formconfig[0].FORMID; } List <ConfigFormEntity> _formconfig = BaseControlFactory.GetFormConfigFromFormID(formID); List <ConfigControlsEntity> configs = BaseControlFactory.GetFormControlConfigByFormID(formID); //List<ConfigControlsEntity> configs = BaseControlFactory.GetFormControlConfigByFormID(formconfig.First().FORMID); _mainform = Rmes.WinForm.Base.UiFactory.GetMainFormInstance(_formconfig.First(), configs.ToList <ConfigControlsEntity>()); _mainform.Text = LoginInfo.CompanyInfo.COMPANY_NAME_BRIEF + "MES系统"; _mainform.FormClosed += new FormClosedEventHandler(_mainform_FormClosed); _mainform.FormClosing += new FormClosingEventHandler(_mainform_FormClosing); _mainform.StartPosition = FormStartPosition.CenterScreen; _mainform.Show(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "系统初始化产生问题!"); this.ExitThread(); } } }
public void Save() { if (!debugmode) { return; } ConfigControlsEntity en = this.OBJ as ConfigControlsEntity; if (en != null) { BaseControlFactory.SaveFormControlsInfo(en); } base.Dispose(); }
void frmReLogin_FormClosing(object sender, FormClosingEventArgs e) { if (((Form)sender).DialogResult != DialogResult.OK) { this.Owner.Show(); this.Dispose(); } else { this.Owner.Dispose(); try { DB.DataConnectionName = "oracle"; Database db = DB.GetInstance(); List <ConfigFormEntity> formconfig = BaseControlFactory.GetFormConfigFromStationCode(LoginInfo.StationInfo.RMES_ID); if (formconfig.Count < 1) { MessageBox.Show("该站点没有绑定任何执行窗体,请确认本地设置是否正确。"); e.Cancel = true; } else { List <ConfigControlsEntity> configs = BaseControlFactory.GetFormControlConfigByFormID(formconfig.First().FORMID); BaseForm _mainform = Rmes.WinForm.Base.UiFactory.ReLoad(formconfig.First(), configs.ToList <ConfigControlsEntity>()); _mainform.Text = LoginInfo.CompanyInfo.COMPANY_NAME_BRIEF + "MES系统"; //_mainform.FormClosed += new FormClosedEventHandler(_mainform_FormClosed); //_mainform.FormClosing += new FormClosingEventHandler(_mainform_FormClosing); _mainform.Show(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "系统初始化产生问题!"); Application.ExitThread(); } } }