Settings 设置(2010-04-26)
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行库版本:2.0.50727.3603
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Mtxspfrom.Config {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
internal sealed partial class SetUser : global::System.Configuration.ApplicationSettingsBase {
private static SetUser defaultInstance = ((SetUser)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new SetUser())));
public static SetUser Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool Setting {
get {
return ((bool)(this["Setting"]));
}
set {
this["Setting"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool get {
get {
return ((bool)(this["get"]));
}
set {
this["get"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("测试1")]
public string test1 {
get {
return ((string)(this["test1"]));
}
set {
this["test1"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("测试2")]
public string test2 {
get {
return ((string)(this["test2"]));
}
set {
this["test2"] = value;
}
}
}
}
/////////////////////////////////////////////窗体区域////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Mtxspfrom.Config;
using System.Configuration;
namespace Mtxspfrom.Show
{
public partial class Set_Form : Form
{
private SetUser user = new SetUser();
internal SetUser SetUser
{
get
{
return user;
}
set
{
user = value;
}
}
public Set_Form()
{
InitializeComponent();
}
public void UpdateOptionSetting()
{
if (checkBox1.Checked)
user.Setting = true;
else
user.Setting = false;
if (checkBox2.Checked)
user.get = true;
else
user.get = false;
user.test1 = txt_one.Text.ToString();
user.test2 = txt_two.Text.ToString();
}
//窗体加载读取配置信息
private void Set_Form_Load(object sender, EventArgs e)
{
button2.Text = user.test1;
if (user.Setting)
checkBox1.Checked = true;
else
checkBox1.Checked = false;
if (user.get)
checkBox2.Checked = true;
else
checkBox2.Checked = false;
txt_one.Text = user.test1;
txt_two.Text = user.test2;
}
private void btn_test_Click(object sender, EventArgs e)
{
UpdateOptionSetting();
user.Save();
//这里需要线程来执行 窗体再加载 和 用户提示加载进度(类似保存中....20%)
Set_Form_Load(sender, e);
}
private void btn_tests_Click(object sender, EventArgs e)
{
this.Close();
}
}
}