AppMain.MainForm.LoadAppSettings C# (CSharp) Method

LoadAppSettings() private method

アプリの設定を設定ファイルから読み込む。
private LoadAppSettings ( ) : void
return void
		private void LoadAppSettings()
		{
			StreamReader reader = null;
			try
			{
				XmlSerializer serializer = new XmlSerializer(typeof(AppSettings));
				reader = new StreamReader(Application.StartupPath + MainForm.settingFileName);
				this.appSettings = (AppSettings)serializer.Deserialize(reader);
			}
			catch(FileNotFoundException)
			{
				this.SetAppSettings();
				return;
			}
			catch(Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
			finally
			{
				if(reader != null) reader.Close();
			}
			this.Left   = this.appSettings.left;
			this.Top    = this.appSettings.top;
			this.Width  = this.appSettings.width;
			this.Height = this.appSettings.height;
		}//LoadAppSettings