/[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/28 04:10:38	155
+++ trunk/RomCheater/Docking/PIDSelector.cs	2012/05/28 04:14:03	156
@@ -62,15 +62,20 @@
         private void btnList_Click(object sender, EventArgs e) { this.lstProcessList.View = View.List; }
         private void btnTile_Click(object sender, EventArgs e) { this.lstProcessList.View = View.Tile; }
 
-        private void btnOK_Click(object sender, EventArgs e)
+        private void PerformListViewItemSelect(ListViewItem li)
         {
-            if (!(lstProcessList.SelectedItems.Count > 0)) return;
-            this.SelectedPid = Convert.ToInt32(lstProcessList.SelectedItems[0].SubItems[1].Text);
+            this.SelectedPid = Convert.ToInt32(li.SubItems[1].Text);
             //this.Close();
             if (this.OnSelectedProcessChanged != null)
             {
                 this.OnSelectedProcessChanged(this, new ProcessChangedEventArgs(this.SelectedPid));
             }
+            Process SelectedProcess = Process.GetProcessById(this.SelectedPid);
+            logger.Debug.WriteLine("Using Process: ({0} : {1})", SelectedProcess.Id, SelectedProcess.ProcessName);
+        }
+        private void btnOK_Click(object sender, EventArgs e)
+        {
+            
         }
 
         //private void btnCancel_Click(object sender, EventArgs e)
@@ -126,14 +131,20 @@
                 }
                 else
                 {
-                    logger.Error.Write("image_key is an empty string!");
-                    if (small_image != null) { logger.Error.Write(" [however small_image is not null]"); }
-                    if (large_image != null) { logger.Error.Write(" [however large_image is not null]\n"); }
+                    //logger.Error.WriteLine("image_key is an empty string!");
+                    //if (small_image != null) { logger.Error.WriteLine(" [however small_image is not null]"); }
+                    //if (large_image != null) { logger.Error.WriteLine(" [however large_image is not null]\n"); }
                 }
             }
             lstProcessList.SmallImageList = small_image_list;
             lstProcessList.LargeImageList = large_image_list;
             this.lstProcessList.Items.AddRange(items.ToArray());
+
+            if (lstProcessList.Items.Count > 0)
+            {
+                lstProcessList.Items[0].Selected = true;
+            }
+
             return true;
         }
 
@@ -175,6 +186,21 @@
             if (AcceptedPlugin == null || this.DesignMode) return;
             btnRefresh.PerformClick();
         }
+
+
+        private void lstProcessList_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
+        {
+            if (!e.IsSelected) return;
+            PerformListViewItemSelect(e.Item);
+        }
+
+        private void lstProcessList_ItemActivate(object sender, EventArgs e)
+        {
+            ListViewItem Item = lstProcessList.SelectedItems[0];
+            PerformListViewItemSelect(Item);
+        }
+
+
     }
 
     #region eventargs

 

  ViewVC Help
Powered by ViewVC 1.1.22