/// <summary> /// 另存控件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SaveConfigbutton_Click(object sender, EventArgs e) { try { //Note by ChengSk - 20190116 //if (!SystemStructSaveConfig()) // return; //if (!ChannelRangeSaveConfig()) // return; //if (!ChannelExitSaveConfig()) // return; //if (!ExitMotorDriverPinSaveConfig()) // return; //if (!WeightSaveConfig(false)) // return; ////if (!FlawSetSaveConfig()) //// return; //Modify by ChengSk - 20190116 if (!SystemStructSaveConfig2()) { return; } if (!ChannelRangeSaveConfig2()) { return; } if (!ChannelExitSaveConfig2()) { return; } if (!ExitMotorDriverPinSaveConfig2()) { return; } if (!WeightSaveConfig2(false)) { return; } SaveConfigForm scForm = new SaveConfigForm(null, true); scForm.ShowDialog(); } catch (Exception ex) { Trace.WriteLine("ProjectSetForm中函数SaveConfigbutton_Click出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("ProjectSetForm中函数SaveConfigbutton_Click出错" + ex); #endif } }
private void ProjectSetForm_FormClosing(object sender, FormClosingEventArgs e) { try { //EnableWindow(m_mainForm.Handle, false);//ivycc 2013.11.29 //DialogResult result = MessageBox.Show("是否保存配置信息?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); //DialogResult result = MessageBox.Show("0x30001001 Whether to preseve the configuration information?", "Information", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); DialogResult result = MessageBox.Show("0x30001001 " + LanguageContainer.ProjectSetFormMessagebox1Text[GlobalDataInterface.selectLanguageIndex], LanguageContainer.ProjectSetFormMessageboxInformationCaption[GlobalDataInterface.selectLanguageIndex], MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (result == DialogResult.Cancel)//cancel { e.Cancel = true; return; } else if (result == DialogResult.No) //no { GlobalDataInterface.UpWeightInfoEvent -= new GlobalDataInterface.WeightInfoEventHandler(OnUpWeightInfo); //Add by ChengSk - 20180830 GlobalDataInterface.UpImageDataEvent -= new GlobalDataInterface.ImageDataEventHandler(OnUpImageData); //Add by ChengSk - 20180830 GlobalDataInterface.UpAutoWhiteBalanceInfoEvent -= new GlobalDataInterface.AutoWhiteBalanceInfoEventHandler(OnUpAutoWhiteBalanceInfo); //Add by ChengSk - 20180830 GlobalDataInterface.UpShutterAdjustInfoEvent -= new GlobalDataInterface.ShutterAdjustInfoEventHandler(OnShutterAdjustInfo); GlobalDataInterface.UpFruitGradeInfoEvent -= new GlobalDataInterface.FruitGradeInfoEventHandler(OnUpFruitGradeInfo); //Add by ChengSk - 20180830 //add by xcw 20201207 m_mainForm.SetProjectEnabledtoolStripMenuItem(true); //Add by ChengSk - 20190121 //GlobalDataInterface.OpenProjectSetFormNumber--; //Add by ChengSk - 20190111 //if (!SystemStructSaveConfig()) // return; //if (!ChannelRangeSaveConfig()) // return; //if (!ChannelExitSaveConfig()) // return; //if (!WeightSaveConfig(false)) // return; //if (!FlawSetSaveConfig()) // return; WeightSetPageUnSelected(); CloseTest(); StopVolveTest(); //水平滚动条初始化 //Add by ChengSk - 20180408 m_mainForm.splitContainer2_Panel1_HorizontalScroll_init(); //出口列表操作 m_mainForm.InitExitListBox(true); m_mainForm.SetAllExitListBox(); if (GlobalDataInterface.global_IsTestMode) { GlobalDataInterface.TransmitParam(-1, (int)HC_FSM_COMMAND_TYPE.HC_CMD_PROJ_CLOSED, null); } return; } else if (result == DialogResult.Yes) //yes { m_mainForm.SetProjectEnabledtoolStripMenuItem(true); //Add by ChengSk - 20190121 //GlobalDataInterface.OpenProjectSetFormNumber--; //Add by ChengSk - 20190111 //Note by ChengSk - 20190116 //if (!SystemStructSaveConfig()) // return; //if (!ChannelRangeSaveConfig()) // return; //if (!ChannelExitSaveConfig()) // return; //if (!ExitMotorDriverPinSaveConfig()) // return; //if (!WeightSaveConfig(false)) // return; ////if (!FlawSetSaveConfig()) //// return; //Modify by ChengSk - 20190116 if (!SystemStructSaveConfig2()) { return; } if (!ChannelRangeSaveConfig2()) { return; } if (!ChannelExitSaveConfig2()) { return; } if (!ExitMotorDriverPinSaveConfig2()) { return; } if (!WeightSaveConfig2(false)) { return; } SaveConfigForm scForm = new SaveConfigForm(null, true); scForm.ShowDialog(); } WeightSetPageUnSelected(); CloseTest(); StopVolveTest(); if (GlobalDataInterface.global_IsTestMode) { GlobalDataInterface.TransmitParam(-1, (int)HC_FSM_COMMAND_TYPE.HC_CMD_PROJ_CLOSED, null); } //水平滚动条初始化 //Add by ChengSk - 20180408 m_mainForm.splitContainer2_Panel1_HorizontalScroll_init(); //出口列表操作 m_mainForm.InitExitListBox(true); m_mainForm.SetAllExitListBox(); //主界面菜单电机使能按钮 m_mainForm.SetMenuMotorEnable(); GlobalDataInterface.UpWeightInfoEvent -= new GlobalDataInterface.WeightInfoEventHandler(OnUpWeightInfo); //Add by ChengSk - 20180830 GlobalDataInterface.UpImageDataEvent -= new GlobalDataInterface.ImageDataEventHandler(OnUpImageData); //Add by ChengSk - 20180830 GlobalDataInterface.UpAutoWhiteBalanceInfoEvent -= new GlobalDataInterface.AutoWhiteBalanceInfoEventHandler(OnUpAutoWhiteBalanceInfo); //Add by ChengSk - 20180830 GlobalDataInterface.UpShutterAdjustInfoEvent -= new GlobalDataInterface.ShutterAdjustInfoEventHandler(OnShutterAdjustInfo); GlobalDataInterface.UpFruitGradeInfoEvent -= new GlobalDataInterface.FruitGradeInfoEventHandler(OnUpFruitGradeInfo); //Add by ChengSk - 20180830 } catch (Exception ex) { Trace.WriteLine("ProjectSetForm中函数ProjectSetForm_FormClosing出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("ProjectSetForm中函数ProjectSetForm_FormClosing出错" + ex); #endif } }
/// <summary> /// 保存程序 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SavetoolStripButton_Click(object sender, EventArgs e) { SaveConfigForm scForm = new SaveConfigForm(this, false); scForm.ShowDialog(); }
/// <summary> /// 菜单->文件->保存配置 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void 保存配置toolStripMenuItem_Click(object sender, EventArgs e) { SaveConfigForm scForm = new SaveConfigForm(this, false); scForm.ShowDialog(); }