/[RomCheater]/trunk/RomCheater/Docking/FloatingPIDSelector.cs
ViewVC logotype

Diff of /trunk/RomCheater/Docking/FloatingPIDSelector.cs

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

--- trunk/RomCheater/Docking/PIDSelector.cs	2012/06/07 19:56:27	332
+++ trunk/RomCheater/Docking/PIDSelector.cs	2012/06/07 21:11:51	335
@@ -34,8 +34,11 @@
         #region IAcceptsProcessPID
         public int ProcessPID { get; set; }
         #endregion
-        #region IAcceptsPlugin<IConfigPlugin> members
-        public IConfigPlugin AcceptedPlugin { get; set; }
+        #region IAcceptsPlugin<IConfigPlugin> members 
+        private IConfigPlugin _AcceptedPlugin;
+        public IConfigPlugin AcceptedPlugin { 
+            get { return _AcceptedPlugin; }
+            set { _AcceptedPlugin = value; ProcessWatcherTimer.Enabled = (value != null); } }
         #endregion
         #region IAcceptsChangedProcess members
         public event BaseEventHandler<ProcessChangedEventArgs> OnSelectedProcessChanged;
@@ -98,14 +101,16 @@
         //}
 
         private void btnRefresh_Click(object sender, EventArgs e)
-        {                      
-            this.RefreshList();            
+        {
+            //this.RefreshList();            
         }
 
         private bool RefreshList()
         {
+            //if (this.AcceptedPlugin == null) { return false; };
             isRefreshing = true;
             lstProcessList.Items.Clear();
+            //logger.VerboseDebug.WriteLine(System.Environment.StackTrace);
             this.AcceptedPlugin.Reload(true);
             // create a selection of PCSX2 processes
             List<ProcContainer> proc_list = AcceptedPlugin.ValidProcessesForPlugin;
@@ -203,7 +208,7 @@
             if (AcceptedPlugin == null || this.DesignMode) return;
             txtstatus_Pid.Text = "";
             txtstatus_Filename.Text = "";
-            btnRefresh.PerformClick();
+            this.RefreshList();
         }
 
 
@@ -227,7 +232,7 @@
             if (!fi.Exists) { logger.Warn.WriteLine("Cannot load and attach to non-existing exe file: {0}", fi.FullName); return; }
             Process p = Process.Start(fi.FullName);
             this.ProcessPID = p.Id;
-            isAttachingToProcess = true;          
+            isAttachingToProcess = true;
         }
 
         private void ProcessWatcherTimer_Tick(object sender, EventArgs e) 
@@ -236,7 +241,7 @@
             //if (lstProcessList.Items.Count == 0) return;
             isAutoRefreshing = true;
             int pid = this.ProcessPID;          
-            btnRefresh.PerformClick();
+            this.RefreshList();
             bool pid_still_exists = false;
             int item_index = -1;
             foreach (ListViewItem li2 in lstProcessList.Items)
@@ -251,7 +256,7 @@
             }
             if (pid_still_exists)
             {
-                //logger.Debug.WriteLine("Pid: {0} still exists", pid);                
+                //logger.Debug.WriteLine("Pid: {0} still exists", pid);
                 if (lstProcessList.SelectedItems.Count > 0)
                 {
                     if (lstProcessList.SelectedItems[0] != null)

 

  ViewVC Help
Powered by ViewVC 1.1.22