示例#1
0
        public Form1()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            setStartAndEnd(1);

            MyConfigSection config = readConfig();

            if (config != null)
            {
                this.textBox1.Text = config.PartNumber;
                if (config.PasueNumber == null || config.PasueNumber.Length <= 0)
                {
                    this.textBox2.Text = config.StartNumber;
                }
                else
                {
                    this.textBox2.Text = config.PasueNumber;
                }
                this.textBox3.Text  = config.EndNumber;
                this.comboBox1.Text = config.Country;
            }
        }
示例#2
0
        MyConfigSection readConfig()
        {
            Configuration   config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            MyConfigSection data   = config.Sections["last"] as MyConfigSection;

            return(data);
        }
示例#3
0
        private void saveConfig()
        {
            Configuration   config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            MyConfigSection data   = new MyConfigSection();

            data.OperTime    = DateTime.Now;
            data.PartNumber  = this.textBox1.Text.Trim();
            data.StartNumber = this.textBox2.Text.Trim();
            data.EndNumber   = this.textBox3.Text.Trim();
            data.Country     = this.comboBox1.Text.Trim();
            data.PasueNumber = pasueNum;

            //config.SectionGroups.Remove("last");
            config.Sections.Remove("last");
            config.Sections.Add("last", data);
            config.Save(ConfigurationSaveMode.Minimal);
        }
示例#4
0
        private void saveConfig()
        {
            Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            MyConfigSection data = new MyConfigSection();
            data.OperTime = DateTime.Now;
            data.PartNumber = this.textBox1.Text.Trim();
            data.StartNumber = this.textBox2.Text.Trim();
            data.EndNumber = this.textBox3.Text.Trim();
            data.Country = this.comboBox1.Text.Trim();
            data.PasueNumber = pasueNum;

            //config.SectionGroups.Remove("last");
            config.Sections.Remove("last");
            config.Sections.Add("last", data);
            config.Save(ConfigurationSaveMode.Minimal);
        }