ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/RomCheater/trunk/RomCheater/Docking/PIDSelector.cs
(Generate patch)

Comparing trunk/RomCheater/Docking/PIDSelector.cs (file contents):
Revision 151 by william, Mon May 28 00:17:16 2012 UTC vs.
Revision 152 by william, Mon May 28 02:01:34 2012 UTC

--- trunk/RomCheater/Docking/PIDSelector.cs	2012/05/28 00:17:16	151
+++ trunk/RomCheater/Docking/PIDSelector.cs	2012/05/28 02:01:34	152
@@ -16,10 +16,10 @@ namespace RomCheater.Docking
 {
     public partial class PIDSelector : DockContent
     {
-        private IConfigPlugin plugin = null;
+        //private IConfigPlugin plugin = null;
         //bool isInError = false;
         public PIDSelector() { InitializeComponent(); this.SelectedPid = -1; OnSelectedProcessChanged = null; }
-        public PIDSelector(IConfigPlugin plugin) : this() { this.plugin = plugin; }
+        public PIDSelector(IConfigPlugin plugin) : this() { this.ConfigPlugin = plugin; }
         // unsued construtor (it's not implmented, may not be)
         [Obsolete("constructor PIDSelector(int pid) is not implemented", false)]
         public PIDSelector(int pid) : this() { this.SelectedPid = pid; }
@@ -29,6 +29,7 @@ namespace RomCheater.Docking
         private int _SelectedPid;
         public int SelectedPid { get { return _SelectedPid; } set { _SelectedPid = value; } }
 
+        public IConfigPlugin ConfigPlugin { get; set; }
 
         public EventHandler<ProcessChangedEventArgs> OnSelectedProcessChanged { get; set; }
         
@@ -47,7 +48,7 @@ namespace RomCheater.Docking
         private void PreInitShow(DockPanel panel)
         {
             //if (panel == null) return;
-            if (!this.RefreshList()) { MessageBox.Show(string.Format("Could not find any Processes for plugin {0}.  Please start an instance of one.", plugin.ToString())); }
+            if (!this.RefreshList()) { MessageBox.Show(string.Format("Could not find any Processes for plugin {0}.  Please start an instance of one.", ConfigPlugin.ToString())); }
             else { if (panel == null) { base.Show(); } else { base.Show(panel); } }
         }
         //private DialogResult PreInitDialog(IWin32Window owner)
@@ -86,9 +87,9 @@ namespace RomCheater.Docking
         private bool RefreshList()
         {
             lstProcessList.Items.Clear();
-            this.plugin.Reload();
+            this.ConfigPlugin.Reload();
             // create a selection of PCSX2 processes
-            List<ProcContainer> proc_list = plugin.ValidProcessesForPlugin;
+            List<ProcContainer> proc_list = ConfigPlugin.ValidProcessesForPlugin;
 
             if (!(proc_list.Count > 0)) { //MessageBox.Show("Could not find any PCSX2 Processes.  Please start an instance of one."); 
                 return false; }
@@ -168,6 +169,12 @@ namespace RomCheater.Docking
             }
 
         }
+
+        private void PIDSelector_Load(object sender, EventArgs e)
+        {
+            if (ConfigPlugin == null || this.DesignMode) return;
+            btnRefresh.PerformClick();
+        }
     }
 
     #region eventargs