Last change
on this file since 848 was
775,
checked in by swagner, 16 years ago
|
Experimented with the .NET application settings framework (#7)
|
File size:
1.1 KB
|
Rev | Line | |
---|
[757] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.ComponentModel;
|
---|
| 4 | using System.Data;
|
---|
| 5 | using System.Drawing;
|
---|
| 6 | using System.Text;
|
---|
| 7 | using System.Windows.Forms;
|
---|
| 8 |
|
---|
| 9 | namespace HeuristicLab.Settings {
|
---|
| 10 | public partial class MainForm : Form {
|
---|
| 11 | private Properties.Settings settings;
|
---|
| 12 |
|
---|
| 13 | public MainForm() {
|
---|
| 14 | InitializeComponent();
|
---|
| 15 | }
|
---|
| 16 |
|
---|
| 17 | private void MainForm_Load(object sender, EventArgs e) {
|
---|
| 18 | settings = Properties.Settings.Default;
|
---|
[775] | 19 | textBox1.Text = settings.MyApplicationSetting;
|
---|
| 20 | textBox2.Text = settings.MyUserSetting;
|
---|
[757] | 21 | }
|
---|
| 22 |
|
---|
| 23 | private void button1_Click(object sender, EventArgs e) {
|
---|
| 24 | settings.Save();
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | private void textBox1_TextChanged(object sender, EventArgs e) {
|
---|
[775] | 28 | settings.MyApplicationSetting = textBox1.Text;
|
---|
[757] | 29 | }
|
---|
[775] | 30 |
|
---|
| 31 | private void textBox2_TextChanged(object sender, EventArgs e) {
|
---|
| 32 | settings.MyUserSetting = textBox2.Text;
|
---|
| 33 | }
|
---|
| 34 |
|
---|
| 35 | private void button2_Click(object sender, EventArgs e) {
|
---|
| 36 | settings.Reload();
|
---|
| 37 | textBox1.Text = settings.MyApplicationSetting;
|
---|
| 38 | textBox2.Text = settings.MyUserSetting;
|
---|
| 39 | }
|
---|
[757] | 40 | }
|
---|
| 41 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.