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

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

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

--- trunk/RomCheater/Docking/PIDSelector.cs	2012/05/27 23:59:22	150
+++ trunk/RomCheater/Docking/PIDSelector.cs	2012/05/28 00:17:16	151
@@ -18,7 +18,7 @@
     {
         private IConfigPlugin plugin = null;
         //bool isInError = false;
-        public PIDSelector() { InitializeComponent(); this.SelectedPid = -1; }
+        public PIDSelector() { InitializeComponent(); this.SelectedPid = -1; OnSelectedProcessChanged = null; }
         public PIDSelector(IConfigPlugin plugin) : this() { this.plugin = plugin; }
         // unsued construtor (it's not implmented, may not be)
         [Obsolete("constructor PIDSelector(int pid) is not implemented", false)]
@@ -30,6 +30,10 @@
         public int SelectedPid { get { return _SelectedPid; } set { _SelectedPid = value; } }
 
 
+        public EventHandler<ProcessChangedEventArgs> OnSelectedProcessChanged { get; set; }
+        
+
+
         public new void Show() { this.Show(null); }
         //public new void Show(IWin32Window owner) { this.PreInitShow(owner); }
         public new void Show(DockPanel panel) { this.PreInitShow(panel); }
@@ -61,14 +65,18 @@
         {
             if (!(lstProcessList.SelectedItems.Count > 0)) return;
             this.SelectedPid = Convert.ToInt32(lstProcessList.SelectedItems[0].SubItems[1].Text);
-            this.Close();
+            //this.Close();
+            if (this.OnSelectedProcessChanged != null)
+            {
+                this.OnSelectedProcessChanged(this, new ProcessChangedEventArgs(this.SelectedPid));
+            }
         }
 
-        private void btnCancel_Click(object sender, EventArgs e)
-        {
-            this.SelectedPid = -1;
-            this.Close();
-        }
+        //private void btnCancel_Click(object sender, EventArgs e)
+        //{
+        //    this.SelectedPid = -1;
+        //    //this.Close();
+        //}
 
         private void btnRefresh_Click(object sender, EventArgs e)
         {
@@ -161,5 +169,14 @@
 
         }
     }
+
+    #region eventargs
+    public class ProcessChangedEventArgs : EventArgs
+    {
+        public ProcessChangedEventArgs() : this(-1) { }
+        public ProcessChangedEventArgs(int pid) { this.ProcessID = pid; }
+        public int ProcessID { get; private set; }
+    }
+    #endregion
 }
 

 

  ViewVC Help
Powered by ViewVC 1.1.22