1 public class ApplicationSettings
2 {
3
4 private bool appSettingsChanged;
5 // 用于存储应用程序设置的变量。
6
7 private Point formLocation;
8
9 public Point FormLocation
10 {
11 get { return formLocation; }
12 set
13 {
14 if (value != formLocation)
15 {
16 formLocation = value;
17 appSettingsChanged = true;
18 }
19 }
20 }
21
22
23 // 从配置文件中反序列化类。
24 public bool LoadAppSettings()
25 {
26 XmlSerializer mySerializer = null;
27 FileStream myFileStream = null;
28 bool fileExists = false;
29
30 try
31 {
32 // 为 ApplicationSettings 类型创建 XmlSerializer。
33 mySerializer = new XmlSerializer(typeof(ApplicationSettings));
34 FileInfo fi = new FileInfo(Application.LocalUserAppDataPath
35 + @"\myApplication.config");
36 // 如果配置文件存在,将其打开。
37 if (fi.Exists)
38 &