| 119 | | this.Load += new EventHandler(MainForm_Load); |
|---|
| 120 | | this.Closing += new CancelEventHandler(MainForm_Closing); |
|---|
| 121 | | } |
|---|
| 122 | | |
|---|
| 123 | | |
|---|
| 124 | | [STAThread] |
|---|
| 125 | | public static void Main(string[] args) |
|---|
| 126 | | { |
|---|
| 127 | | Application.Run(new MainForm()); |
|---|
| 128 | | } |
|---|
| 129 | | |
|---|
| | 125 | } |
|---|
| | 126 | |
|---|
| | 127 | public void StartApplication() |
|---|
| | 128 | { |
|---|
| | 129 | // �ݒ� _config = Configuration.GetInstance(); |
|---|
| | 130 | _config.Load(); |
|---|
| | 131 | |
|---|
| | 132 | |
|---|
| | 133 | // ���^�[���ǂݍ��� |
|---|
| | 134 | bool result = false; |
|---|
| | 135 | if (Directory.Exists(_config.FaceDefPath)) |
|---|
| | 136 | { |
|---|
| | 137 | result = LoadFaceDefine(_config.FaceDefPath); |
|---|
| | 138 | } |
|---|
| | 139 | |
|---|
| | 140 | if (!result) |
|---|
| | 141 | { |
|---|
| | 142 | if (!SelectFaceDefine(Application.StartupPath)) |
|---|
| | 143 | { |
|---|
| | 144 | Application.Exit(); |
|---|
| | 145 | return; |
|---|
| | 146 | } |
|---|
| | 147 | } |
|---|
| | 148 | |
|---|
| | 149 | Application.ApplicationExit += new EventHandler(Application_ApplicationExit); |
|---|
| | 150 | |
|---|
| | 151 | this.Location = _config.Location; |
|---|
| | 152 | ApplyConfiguration(); |
|---|
| | 153 | |
|---|
| | 154 | _updateTimer.Start(); |
|---|
| | 155 | Application.Run(this); |
|---|
| | 156 | } |
|---|
| | 157 | |
|---|
| | 158 | void Application_ApplicationExit(object sender, EventArgs e) |
|---|
| | 159 | { |
|---|
| | 160 | notifyIcon.Visible = false; |
|---|
| | 161 | |
|---|
| | 162 | // �ۑ� |
|---|
| | 163 | _config.Opacity = (int)(this.Opacity * 100); |
|---|
| | 164 | _config.FaceDefPath = (_currentFaceDef != null ? _currentFaceDef.Path : Path.Combine(Application.StartupPath, "default.mcface")); |
|---|
| | 165 | _config.Location = this.Location; |
|---|
| | 166 | _config.TransparentMouseMessage = this.TransparentMouseMessage; |
|---|
| | 167 | |
|---|
| | 168 | _config.Save(); |
|---|
| | 169 | } |
|---|
| 265 | | // |
|---|
| 266 | | // �N�� |
|---|
| 267 | | // |
|---|
| 268 | | public void MainForm_Load(object sender, System.EventArgs e) |
|---|
| 269 | | { |
|---|
| 270 | | // �ݒ� _config = Configuration.GetInstance(); |
|---|
| 271 | | _config.Load(); |
|---|
| 272 | | |
|---|
| 273 | | |
|---|
| 274 | | // ���^�[���ǂݍ��� |
|---|
| 275 | | bool result = false; |
|---|
| 276 | | if (Directory.Exists(_config.FaceDefPath)) |
|---|
| 277 | | { |
|---|
| 278 | | result = LoadFaceDefine(_config.FaceDefPath); |
|---|
| 279 | | ApplyConfiguration(); |
|---|
| 280 | | _updateTimer.Start(); |
|---|
| 281 | | } |
|---|
| 282 | | |
|---|
| 283 | | if (!result) |
|---|
| 284 | | { |
|---|
| 285 | | if (!SelectFaceDefine(Application.StartupPath)) |
|---|
| 286 | | { |
|---|
| 287 | | Application.Exit(); |
|---|
| 288 | | return; |
|---|
| 289 | | } |
|---|
| 290 | | |
|---|
| 291 | | } |
|---|
| 292 | | } |
|---|
| 293 | | |
|---|
| 294 | | // |
|---|
| 295 | | // �I�� |
|---|
| 296 | | // |
|---|
| 297 | | private void MainForm_Closing(object sender, CancelEventArgs e) |
|---|
| 298 | | { |
|---|
| 299 | | notifyIcon.Visible = false; |
|---|
| 300 | | |
|---|
| 301 | | // �ۑ� |
|---|
| 302 | | _config.Opacity = (int) (this.Opacity * 100); |
|---|
| 303 | | _config.FaceDefPath = (_currentFaceDef != null ? _currentFaceDef.Path : Path.Combine(Application.StartupPath, "default.mcface")); |
|---|
| 304 | | _config.Location = this.Location; |
|---|
| 305 | | _config.TransparentMouseMessage = this.TransparentMouseMessage; |
|---|
| 306 | | |
|---|
| 307 | | _config.Save(); |
|---|
| 308 | | } |
|---|
| 309 | | |
|---|
| 310 | | |
|---|