Changeset 38
- Timestamp:
- Feb 25, 2005, 3:31:02 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MacFaceFloat/MainForm.cs
r35 r38 40 40 private int curMarkers; 41 41 42 [STAThread] 43 public static void Main(string[] args) 44 { 45 MainForm form = new MainForm(); 46 form.StartApplication(); 47 } 48 42 49 // RXgN^ 43 50 public MainForm() … … 59 66 60 67 _updateTimer = new System.Windows.Forms.Timer(); 68 _updateTimer.Tick += new EventHandler(this.CountProcessorUsage); 61 69 _updateTimer.Enabled = false; 62 70 _updateTimer.Interval = 1000; 63 _updateTimer.Tick += new EventHandler(this.CountProcessorUsage);64 _updateTimer.Stop();65 71 } 66 72 … … 117 123 this.Text = "MacFace For Windows"; 118 124 this.TopMost = true; 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 // Ýè 130 _config = Configuration.GetInstance(); 131 _config.Load(); 132 133 134 // çp^[ÇÝÝ 135 bool result = false; 136 if (Directory.Exists(_config.FaceDefPath)) 137 { 138 result = LoadFaceDefine(_config.FaceDefPath); 139 } 140 141 if (!result) 142 { 143 if (!SelectFaceDefine(Application.StartupPath)) 144 { 145 Application.Exit(); 146 return; 147 } 148 } 149 150 Application.ApplicationExit += new EventHandler(Application_ApplicationExit); 151 152 this.Location = _config.Location; 153 ApplyConfiguration(); 154 155 _updateTimer.Start(); 156 Application.Run(this); 157 } 158 159 void Application_ApplicationExit(object sender, EventArgs e) 160 { 161 notifyIcon.Visible = false; 162 163 // Û¶ 164 _config.Opacity = (int)(this.Opacity * 100); 165 _config.FaceDefPath = (_currentFaceDef != null ? _currentFaceDef.Path : Path.Combine(Application.StartupPath, "default.mcface")); 166 _config.Location = this.Location; 167 _config.TransparentMouseMessage = this.TransparentMouseMessage; 168 169 _config.Save(); 170 } 130 171 131 172 /* … … 232 273 } 233 274 275 private void ApplyConfiguration() 276 { 277 this.Opacity = (float)_config.Opacity / 100; 278 this.PatternSize = (float)_config.PatternSize / 100; 279 this.TransparentMouseMessage = _config.TransparentMouseMessage; 280 281 RefreshPattern(); 282 } 283 234 284 public float PatternSize 235 285 { … … 262 312 this.Update(); 263 313 } 264 265 //266 // N®267 //268 public void MainForm_Load(object sender, System.EventArgs e)269 {270 // Ýè271 _config = Configuration.GetInstance();272 _config.Load();273 274 275 // çp^[ÇÝÝ276 bool result = false;277 if (Directory.Exists(_config.FaceDefPath))278 {279 result = LoadFaceDefine(_config.FaceDefPath);280 ApplyConfiguration();281 _updateTimer.Start();282 }283 284 if (!result)285 {286 if (!SelectFaceDefine(Application.StartupPath))287 {288 Application.Exit();289 return;290 }291 292 }293 }294 295 //296 // I¹297 //298 private void MainForm_Closing(object sender, CancelEventArgs e)299 {300 notifyIcon.Visible = false;301 302 // Û¶303 _config.Opacity = (int) (this.Opacity * 100);304 _config.FaceDefPath = (_currentFaceDef != null ? _currentFaceDef.Path : Path.Combine(Application.StartupPath, "default.mcface"));305 _config.Location = this.Location;306 _config.TransparentMouseMessage = this.TransparentMouseMessage;307 308 _config.Save();309 }310 311 314 312 315 /* … … 333 336 } 334 337 } 335 336 private void ApplyConfiguration()337 {338 this.Opacity = (float)_config.Opacity / 100;339 this.PatternSize = (float)_config.PatternSize / 100;340 this.Location = _config.Location;341 this.TransparentMouseMessage = _config.TransparentMouseMessage;342 343 RefreshPattern();344 }345 338 } 346 339 }
Note: See TracChangeset
for help on using the changeset viewer.