コード例 #1
0
        /// <summary>
        /// 窗口关闭
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ConfigForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            //保存事件
            if (ParaPropertyChanged || TemplatePropertyChanged)
            {
                if (DialogResult.Yes == MessageBox.Show("Save the Change", "Tip", MessageBoxButtons.YesNo))
                {
                    //保存Template 参数
                    if (TemplatePropertyChanged)//属性发生改变
                    {
                        TemplatePropertyChanged = false;
                        //传入保存函数
                        TemplateSaveProcess(comboBox_ConfigFileList.SelectedItem.ToString());
                    }
                    //保存SysPara 参数
                    if (ParaPropertyChanged)//属性发生改变
                    {
                        ParaPropertyChanged = false;

                        //更新数据
                        ProgramData.SysPara.SourcePath          = textBox_SourcePath.Text;
                        ProgramData.SysPara.TemplateFile        = comboBox_CurrentTemplateFile.SelectedIndex >= 0 ? comboBox_CurrentTemplateFile.SelectedItem.ToString() : "Not Config";
                        ProgramData.SysPara.SealSize            = new Size((int)numericUpDown_SealWidth.Value, (int)numericUpDown_SealHeight.Value);
                        ProgramData.SysPara.SheetSize           = new Size((int)numericUpDown_SheetWidth.Value, (int)numericUpDown_SheetHeight.Value);
                        ProgramData.SysPara.ImgSavePath         = textBox_ImgSavePath.Text;
                        ProgramData.SysPara.IsSaveSearchHistory = checkBox_IsSaveSearchHistory.Checked;

                        //保存数据
                        ProgramData.SaveSysPara();
                    }
                }
            }
            //重新读取Template
            ProgramData.RefreshTemplateTable();
        }
コード例 #2
0
        /// <summary>
        /// 保存玻璃方向参数
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ComboBox_GlassDirection_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (IniFlag)
            {
                return;
            }
            BindComboxEnumType <Direction> aer = comboBox_GlassDirection.SelectedItem as BindComboxEnumType <Direction>;

            if (aer == null || string.IsNullOrEmpty(aer.Name))
            {
                return;
            }
            Direction direction = (Direction)Enum.Parse(typeof(Direction), aer.Name);

            ProgramData.SysPara.GlassDirection = direction;
            ProgramData.SaveSysPara();
        }