/[EmuXPortal]/trunk/EmuXPortal/Form1.cs
ViewVC logotype

Diff of /trunk/EmuXPortal/Form1.cs

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

--- trunk/EmuXPortal/Form1.cs	2012/08/23 04:13:19	112
+++ trunk/EmuXPortal/Form1.cs	2012/08/23 04:32:20	113
@@ -339,32 +339,32 @@
                 return this.Width;
             }
         }
-        private void AddPlatformControl(Control c)
-        {          
-            if (platform_flow.InvokeRequired) { platform_flow.Invoke((MethodInvoker)delegate() { AddPlatformControl(c); }); }
-            else 
-            {
-                platform_flow.Controls.Add(c);            
-            }            
-        }
-        private void UpdatePlatformControls() 
-        {
-            if (platform_flow.InvokeRequired) { platform_flow.Invoke((MethodInvoker)delegate() { UpdatePlatformControls(); }); }
-            else { this.Update(); }
-        }
-        private void AddGameControl(Control c)
-        {
-            if (rom_flow.InvokeRequired) { rom_flow.Invoke((MethodInvoker)delegate() { AddGameControl(c); }); }
-            else
-            {              
-                rom_flow.Controls.Add(c);
-            }
-        }
-        private void UpdateGameControls()
-        {
-            if (rom_flow.InvokeRequired) { rom_flow.Invoke((MethodInvoker)delegate() { UpdateGameControls(); }); }
-            else { this.Update(); }
-        }
+        //private void AddPlatformControl(Control c)
+        //{          
+        //    if (platform_flow.InvokeRequired) { platform_flow.Invoke((MethodInvoker)delegate() { AddPlatformControl(c); }); }
+        //    else 
+        //    {
+        //        platform_flow.Controls.Add(c);            
+        //    }            
+        //}
+        //private void UpdatePlatformControls() 
+        //{
+        //    //if (platform_flow.InvokeRequired) { platform_flow.Invoke((MethodInvoker)delegate() { UpdatePlatformControls(); }); }
+        //    //else { this.Update(); }
+        //}
+        //private void AddGameControl(Control c)
+        //{
+        //    if (rom_flow.InvokeRequired) { rom_flow.Invoke((MethodInvoker)delegate() { AddGameControl(c); }); }
+        //    else
+        //    {              
+        //        rom_flow.Controls.Add(c);
+        //    }
+        //}
+        //private void UpdateGameControls()
+        //{
+        //    //if (rom_flow.InvokeRequired) { rom_flow.Invoke((MethodInvoker)delegate() { UpdateGameControls(); }); }
+        //    //else { this.Update(); }
+        //}
         #region gameWorker
         private static Image DefaultGameImage = Properties.Resources.DefaultGameImage;
         private void gameWorker_DoWork(object sender, DoWorkEventArgs e)
@@ -373,10 +373,11 @@
             RomParser parser = new RomParser(log, CurrentSelectedRom);
 
             ProgressBar bar = new ProgressBar();
-            AddGameControl(bar);
-            UpdateGameControls();
-            Application.DoEvents();
-            Thread.Sleep(10);
+            if (rom_flow.InvokeRequired) { rom_flow.Invoke((MethodInvoker)delegate() { rom_flow.Controls.Add(bar); }); }
+            else { rom_flow.Controls.Add(bar); }
+            //UpdateGameControls();
+            //Application.DoEvents();
+            //Thread.Sleep(10);
             bar.Invoke(new MethodInvoker(delegate
             {
                 //bar.Message = "Please Wait...";
@@ -399,14 +400,15 @@
                 game_ctrl.PreviewKeyDown += new PreviewKeyDownEventHandler(game_ctrl_PreviewKeyDown);
                 game_ctrl.GotFocus += new EventHandler(game_ctrl_GotFocus);
                 game_ctrl.LostFocus += new EventHandler(game_ctrl_LostFocus);
-                AddGameControl(game_ctrl);
-                UpdateGameControls();
-                Application.DoEvents();
-                int percent = (int)(100.0 * (count / total_count));
-                log.WriteLine("gameWorker_DoWork(): count={0} total={1} percent={2}", count, total_count, percent);
+                if (rom_flow.InvokeRequired) { rom_flow.Invoke((MethodInvoker)delegate() { rom_flow.Controls.Add(game_ctrl); }); }
+                else { rom_flow.Controls.Add(game_ctrl); }
+                //UpdateGameControls();
+                //Application.DoEvents();
+                //int percent = (int)(100.0 * (count / total_count));
+                //log.WriteLine("gameWorker_DoWork(): count={0} total={1} percent={2}", count, total_count, (int)(100.0 * (count / total_count)));
                 bar.Invoke(new MethodInvoker(delegate
                 {
-                    bar.Value = percent;
+                    bar.Value = (int)(100.0 * (count / total_count));
                 }));
                 count++;
             }
@@ -433,10 +435,11 @@
             double count = 0;
             double total_count = parser.Platforms.Count;
             ProgressBar bar = new ProgressBar();
-             AddPlatformControl(bar);
-            UpdatePlatformControls();
-            Application.DoEvents();
-            Thread.Sleep(10);
+            if (platform_flow.InvokeRequired) { platform_flow.Invoke((MethodInvoker)delegate() { platform_flow.Controls.Add(bar); }); }
+            else { platform_flow.Controls.Add(bar); }  
+            //UpdatePlatformControls();
+            //Application.DoEvents();
+            //Thread.Sleep(10);
             bar.Invoke(new MethodInvoker(delegate
             {
                 bar.Margin = new System.Windows.Forms.Padding(0);
@@ -454,13 +457,14 @@
                 platform_ctrl.PreviewKeyDown += new PreviewKeyDownEventHandler(platform_ctrl_PreviewKeyDown);
                 platform_ctrl.GotFocus += new EventHandler(platform_ctrl_GotFocus);
                 platform_ctrl.LostFocus += new EventHandler(platform_ctrl_LostFocus);
-                AddPlatformControl(platform_ctrl);
-                Application.DoEvents();
-                int percent = (int)(100.0 * (count / total_count));
-                log.WriteLine("platformWorker_DoWork(): count={0} total={1} percent={2}", count, total_count, percent);
+                if (platform_flow.InvokeRequired) { platform_flow.Invoke((MethodInvoker)delegate() { platform_flow.Controls.Add(platform_ctrl); }); }
+                else { platform_flow.Controls.Add(platform_ctrl); }  
+                //Application.DoEvents();
+                //int percent = (int)(100.0 * (count / total_count));
+                //log.WriteLine("platformWorker_DoWork(): count={0} total={1} percent={2}", count, total_count, (int)(100.0 * (count / total_count)));
                 bar.Invoke(new MethodInvoker(delegate
                 {
-                    bar.Value = percent;
+                    bar.Value = (int)(100.0 * (count / total_count));
                 }));
                 count++;
             }

 

  ViewVC Help
Powered by ViewVC 1.1.22