/[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

--- branches/mono/EmuXPortal/Form1.cs	2016/03/17 08:12:45	273
+++ branches/mono/EmuXPortal/Form1.cs	2016/03/17 08:31:33	274
@@ -32,6 +32,7 @@
         private delegate Font Delegate_ResizeFont(Font font, float size);
         IEmuConfig CurrentSelectedRom = null;
         PlatformControl CurrentPlatformControl = null;
+		int SavedPlatformIndex= -1;
         GameControl CurrentGameControl = null;
 
         #region unhandled exception support
@@ -336,7 +337,8 @@
                 this.WindowState = FormWindowState.Maximized;
             }
 			if (e.KeyCode == Keys.Back || e.KeyCode == Keys.Escape)
-            {
+            {				
+				SavedPlatformIndex = platform_flow.Controls.IndexOf (CurrentPlatformControl);
                 rom_flow.Visible = false;
                 platform_flow.Visible = true;
             }
@@ -867,8 +869,18 @@
                 platform_ctrl.Width = this.Width - 10;
                 platform_ctrl.PlatformName = string.Format("You don't have any roms in your rompath: '{0}'",Config.RomPath);
                 platform_flow.Controls.Add(platform_ctrl);
-            }
-            platform_flow.Controls[0].Select();
+            }            
+			if (SavedPlatformIndex != -1) {
+				var platform_control = platform_flow.Controls [SavedPlatformIndex] as PlatformControl;
+				platform_flow.SuspendLayout ();
+				CurrentPlatformControl = platform_control;
+				platform_flow.ScrollControlIntoView (CurrentPlatformControl);
+				CurrentPlatformControl.Select ();
+				platform_flow.ResumeLayout ();
+				SavedPlatformIndex = -1;
+			} else {
+				platform_flow.Controls[0].Select();
+			}
             gLog.Profiler.WriteLine("PlatformParser took: {0}s to parse platforms", (int)t.Elapsed.TotalSeconds);
         }
         #endregion

 

  ViewVC Help
Powered by ViewVC 1.1.22