/[EmuXPortal]/branches/mono/EmuXPortal/Form1.cs
ViewVC logotype

Diff of /branches/mono/EmuXPortal/Form1.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 110 by william, Thu Aug 23 02:44:26 2012 UTC revision 112 by william, Thu Aug 23 04:13:19 2012 UTC
# Line 19  namespace EmuXPortal Line 19  namespace EmuXPortal
19          IEmuConfig CurrentSelectedRom = null;          IEmuConfig CurrentSelectedRom = null;
20          PlatformControl CurrentPlatformControl = null;          PlatformControl CurrentPlatformControl = null;
21          GameControl CurrentGameControl = null;          GameControl CurrentGameControl = null;
22            logger log = new logger();
23          public Form1()          public Form1()
24          {          {
25              InitializeComponent();              InitializeComponent();
26              platform_flow.Dock = DockStyle.Fill;              platform_flow.Dock = DockStyle.Fill;
27              rom_flow.Dock = DockStyle.Fill;              rom_flow.Dock = DockStyle.Fill;
28                          log.OpenLog();          
29          }          }
30            
31          private void Form1_Load(object sender, EventArgs e)          private void Form1_Load(object sender, EventArgs e)
32          {          {
33              Config.LoadConfig();              Config.LoadConfig(log);
34              Config.InitializePresentationForm(this);                        Config.InitializePresentationForm(log,this);          
35          }          }
36          private void Form1_Shown(object sender, EventArgs e) { platform_flow.Visible = true; Cursor.Hide(); }          private void Form1_Shown(object sender, EventArgs e) { platform_flow.Visible = true; Cursor.Hide(); }
37          void platform_ctrl_LostFocus(object sender, EventArgs e)          void platform_ctrl_LostFocus(object sender, EventArgs e)
# Line 369  namespace EmuXPortal Line 370  namespace EmuXPortal
370          private void gameWorker_DoWork(object sender, DoWorkEventArgs e)          private void gameWorker_DoWork(object sender, DoWorkEventArgs e)
371          {          {
372              Stopwatch t = e.Argument as Stopwatch;              Stopwatch t = e.Argument as Stopwatch;
373              RomParser parser = new RomParser(CurrentSelectedRom);              RomParser parser = new RomParser(log, CurrentSelectedRom);
374    
375              ProgressBar bar = new ProgressBar();              ProgressBar bar = new ProgressBar();
376              AddGameControl(bar);              AddGameControl(bar);
# Line 402  namespace EmuXPortal Line 403  namespace EmuXPortal
403                  UpdateGameControls();                  UpdateGameControls();
404                  Application.DoEvents();                  Application.DoEvents();
405                  int percent = (int)(100.0 * (count / total_count));                  int percent = (int)(100.0 * (count / total_count));
406                  logger.WriteLine("gameWorker_DoWork(): count={0} total={1} percent={2}",count,total_count,percent);                  log.WriteLine("gameWorker_DoWork(): count={0} total={1} percent={2}", count, total_count, percent);
407                  bar.Invoke(new MethodInvoker(delegate                  bar.Invoke(new MethodInvoker(delegate
408                  {                  {
409                      bar.Value = percent;                      bar.Value = percent;
# Line 420  namespace EmuXPortal Line 421  namespace EmuXPortal
421              rom_flow.Controls[0].Select();              rom_flow.Controls[0].Select();
422              (rom_flow.Controls[0] as GameControl).BorderStyle = BorderStyle.FixedSingle;              (rom_flow.Controls[0] as GameControl).BorderStyle = BorderStyle.FixedSingle;
423              t.Stop();              t.Stop();
424              logger.WriteLine("RomParser took: {0}s to parse roms", (int)t.Elapsed.TotalSeconds);              log.WriteLine("RomParser took: {0}s to parse roms", (int)t.Elapsed.TotalSeconds);
425          }          }
426          #endregion          #endregion
427          #region platformWorker          #region platformWorker
# Line 428  namespace EmuXPortal Line 429  namespace EmuXPortal
429          private void platformWorker_DoWork(object sender, DoWorkEventArgs e)          private void platformWorker_DoWork(object sender, DoWorkEventArgs e)
430          {          {
431              Stopwatch t = e.Argument as Stopwatch;              Stopwatch t = e.Argument as Stopwatch;
432              PlatformParser parser = new PlatformParser(Config.RomPath);              PlatformParser parser = new PlatformParser(log, Config.RomPath);
433              double count = 0;              double count = 0;
434              double total_count = parser.Platforms.Count;              double total_count = parser.Platforms.Count;
435              ProgressBar bar = new ProgressBar();              ProgressBar bar = new ProgressBar();
# Line 456  namespace EmuXPortal Line 457  namespace EmuXPortal
457                  AddPlatformControl(platform_ctrl);                  AddPlatformControl(platform_ctrl);
458                  Application.DoEvents();                  Application.DoEvents();
459                  int percent = (int)(100.0 * (count / total_count));                  int percent = (int)(100.0 * (count / total_count));
460                  logger.WriteLine("platformWorker_DoWork(): count={0} total={1} percent={2}", count, total_count, percent);                  log.WriteLine("platformWorker_DoWork(): count={0} total={1} percent={2}", count, total_count, percent);
461                  bar.Invoke(new MethodInvoker(delegate                  bar.Invoke(new MethodInvoker(delegate
462                  {                  {
463                      bar.Value = percent;                      bar.Value = percent;
# Line 473  namespace EmuXPortal Line 474  namespace EmuXPortal
474              platform_flow.Controls.RemoveAt(0);              platform_flow.Controls.RemoveAt(0);
475              platform_flow.Controls[0].Select();              platform_flow.Controls[0].Select();
476              (platform_flow.Controls[0] as PlatformControl).BorderStyle = BorderStyle.FixedSingle;              (platform_flow.Controls[0] as PlatformControl).BorderStyle = BorderStyle.FixedSingle;
477              logger.WriteLine("PlatformParser took: {0}s to parse platforms", (int)t.Elapsed.TotalSeconds);              log.WriteLine("PlatformParser took: {0}s to parse platforms", (int)t.Elapsed.TotalSeconds);
478          }          }
479          #endregion          #endregion
480    
481          private void Form1_FormClosed(object sender, FormClosedEventArgs e)          private void Form1_FormClosed(object sender, FormClosedEventArgs e)
482          {          {
483              Cursor.Show();              Cursor.Show();
484                log.CloseLog();
485          }          }
486          #endregion          #endregion
487      }      }

Legend:
Removed from v.110  
changed lines
  Added in v.112

  ViewVC Help
Powered by ViewVC 1.1.22