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

revision 156 by william, Mon May 28 04:14:03 2012 UTC revision 323 by william, Thu Jun 7 16:33:41 2012 UTC
# Line 11  using RomCheater.PluginFramework.Core; Line 11  using RomCheater.PluginFramework.Core;
11  using System.IO;  using System.IO;
12  using RomCheater.Logging;  using RomCheater.Logging;
13  using WeifenLuo.WinFormsUI.Docking;  using WeifenLuo.WinFormsUI.Docking;
14    using RomCheater.PluginFramework.Events;
15    
16  namespace RomCheater.Docking  namespace RomCheater.Docking
17  {  {
18      public partial class PIDSelector : DockContent, IAcceptsPlugin<IConfigPlugin>      public partial class PIDSelector : DockContent, IAcceptsPlugin<IConfigPlugin>, IAcceptsChangedProcess, IAcceptsProcessPID
19      {      {
20          //private IConfigPlugin plugin = null;          //private IConfigPlugin plugin = null;
21          //bool isInError = false;          //bool isInError = false;
22          public PIDSelector() { InitializeComponent(); this.SelectedPid = -1; OnSelectedProcessChanged = null; this.AcceptedPlugin = null; }          public PIDSelector() { InitializeComponent(); this.ProcessPID = -1; OnSelectedProcessChanged = null; this.AcceptedPlugin = null; }
23          public PIDSelector(IConfigPlugin plugin) : this() { this.AcceptedPlugin = plugin; }          public PIDSelector(IConfigPlugin plugin) : this() { this.AcceptedPlugin = plugin; }
24          // unsued construtor (it's not implmented, may not be)          // unsued construtor (it's not implmented, may not be)
25          [Obsolete("constructor PIDSelector(int pid) is not implemented", false)]          [Obsolete("constructor PIDSelector(int pid) is not implemented", false)]
26          public PIDSelector(int pid) : this() { this.SelectedPid = pid; }          public PIDSelector(int pid) : this() { this.ProcessPID = pid; }
27          [Obsolete("constructor PIDSelector(IConfigPlugin plugin, int pid) is not implemented", false)]          [Obsolete("constructor PIDSelector(IConfigPlugin plugin, int pid) is not implemented", false)]
28          public PIDSelector(IConfigPlugin plugin, int pid) : this(plugin) { this.SelectedPid = pid; }          public PIDSelector(IConfigPlugin plugin, int pid) : this(plugin) { this.ProcessPID = pid; }
29            
30          private int _SelectedPid;          #region IAcceptsProcessPID
31          public int SelectedPid { get { return _SelectedPid; } set { _SelectedPid = value; } }          public int ProcessPID { get; set; }
32            #endregion
33            #region IAcceptsPlugin<IConfigPlugin> members
34          public IConfigPlugin AcceptedPlugin { get; set; }          public IConfigPlugin AcceptedPlugin { get; set; }
35            #endregion
36          public EventHandler<ProcessChangedEventArgs> OnSelectedProcessChanged { get; set; }          #region IAcceptsChangedProcess members
37            public event BaseEventHandler<ProcessChangedEventArgs> OnSelectedProcessChanged;
38            #endregion
39                    
40    
41    
# Line 63  namespace RomCheater.Docking Line 67  namespace RomCheater.Docking
67          private void btnTile_Click(object sender, EventArgs e) { this.lstProcessList.View = View.Tile; }          private void btnTile_Click(object sender, EventArgs e) { this.lstProcessList.View = View.Tile; }
68    
69          private void PerformListViewItemSelect(ListViewItem li)          private void PerformListViewItemSelect(ListViewItem li)
70          {          {            
71              this.SelectedPid = Convert.ToInt32(li.SubItems[1].Text);              this.ProcessPID = Convert.ToInt32(li.SubItems[1].Text);
72              //this.Close();              Process SelectedProcess = Process.GetProcessById(this.ProcessPID);
             if (this.OnSelectedProcessChanged != null)  
             {  
                 this.OnSelectedProcessChanged(this, new ProcessChangedEventArgs(this.SelectedPid));  
             }  
             Process SelectedProcess = Process.GetProcessById(this.SelectedPid);  
73              logger.Debug.WriteLine("Using Process: ({0} : {1})", SelectedProcess.Id, SelectedProcess.ProcessName);              logger.Debug.WriteLine("Using Process: ({0} : {1})", SelectedProcess.Id, SelectedProcess.ProcessName);
74                //this.Close();
75                if (OnSelectedProcessChanged != null)
76                    OnSelectedProcessChanged(new ProcessChangedEventArgs(this, this.ProcessPID));          
77          }          }
78          private void btnOK_Click(object sender, EventArgs e)          private void btnOK_Click(object sender, EventArgs e)
79          {          {
# Line 202  namespace RomCheater.Docking Line 204  namespace RomCheater.Docking
204    
205    
206      }      }
   
     #region eventargs  
     public class ProcessChangedEventArgs : EventArgs  
     {  
         public ProcessChangedEventArgs() : this(-1) { }  
         public ProcessChangedEventArgs(int pid) { this.ProcessID = pid; }  
         public int ProcessID { get; private set; }  
     }  
     #endregion  
207  }  }
208    

Legend:
Removed from v.156  
changed lines
  Added in v.323

  ViewVC Help
Powered by ViewVC 1.1.22