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

revision 152 by william, Mon May 28 02:01:34 2012 UTC revision 153 by william, Mon May 28 02:20:29 2012 UTC
# Line 14  using WeifenLuo.WinFormsUI.Docking; Line 14  using WeifenLuo.WinFormsUI.Docking;
14    
15  namespace RomCheater.Docking  namespace RomCheater.Docking
16  {  {
17      public partial class PIDSelector : DockContent      public partial class PIDSelector : DockContent, IAcceptsPlugin<IConfigPlugin>
18      {      {
19          //private IConfigPlugin plugin = null;          //private IConfigPlugin plugin = null;
20          //bool isInError = false;          //bool isInError = false;
21          public PIDSelector() { InitializeComponent(); this.SelectedPid = -1; OnSelectedProcessChanged = null; }          public PIDSelector() { InitializeComponent(); this.SelectedPid = -1; OnSelectedProcessChanged = null; this.AcceptedPlugin = null; }
22          public PIDSelector(IConfigPlugin plugin) : this() { this.ConfigPlugin = plugin; }          public PIDSelector(IConfigPlugin plugin) : this() { this.AcceptedPlugin = plugin; }
23          // unsued construtor (it's not implmented, may not be)          // unsued construtor (it's not implmented, may not be)
24          [Obsolete("constructor PIDSelector(int pid) is not implemented", false)]          [Obsolete("constructor PIDSelector(int pid) is not implemented", false)]
25          public PIDSelector(int pid) : this() { this.SelectedPid = pid; }          public PIDSelector(int pid) : this() { this.SelectedPid = pid; }
# Line 29  namespace RomCheater.Docking Line 29  namespace RomCheater.Docking
29          private int _SelectedPid;          private int _SelectedPid;
30          public int SelectedPid { get { return _SelectedPid; } set { _SelectedPid = value; } }          public int SelectedPid { get { return _SelectedPid; } set { _SelectedPid = value; } }
31    
32          public IConfigPlugin ConfigPlugin { get; set; }          public IConfigPlugin AcceptedPlugin { get; set; }
33    
34          public EventHandler<ProcessChangedEventArgs> OnSelectedProcessChanged { get; set; }          public EventHandler<ProcessChangedEventArgs> OnSelectedProcessChanged { get; set; }
35                    
# Line 48  namespace RomCheater.Docking Line 48  namespace RomCheater.Docking
48          private void PreInitShow(DockPanel panel)          private void PreInitShow(DockPanel panel)
49          {          {
50              //if (panel == null) return;              //if (panel == null) return;
51              if (!this.RefreshList()) { MessageBox.Show(string.Format("Could not find any Processes for plugin {0}.  Please start an instance of one.", ConfigPlugin.ToString())); }              if (!this.RefreshList()) { MessageBox.Show(string.Format("Could not find any Processes for plugin {0}.  Please start an instance of one.", AcceptedPlugin.ToString())); }
52              else { if (panel == null) { base.Show(); } else { base.Show(panel); } }              else { if (panel == null) { base.Show(); } else { base.Show(panel); } }
53          }          }
54          //private DialogResult PreInitDialog(IWin32Window owner)          //private DialogResult PreInitDialog(IWin32Window owner)
# Line 87  namespace RomCheater.Docking Line 87  namespace RomCheater.Docking
87          private bool RefreshList()          private bool RefreshList()
88          {          {
89              lstProcessList.Items.Clear();              lstProcessList.Items.Clear();
90              this.ConfigPlugin.Reload();              this.AcceptedPlugin.Reload();
91              // create a selection of PCSX2 processes              // create a selection of PCSX2 processes
92              List<ProcContainer> proc_list = ConfigPlugin.ValidProcessesForPlugin;              List<ProcContainer> proc_list = AcceptedPlugin.ValidProcessesForPlugin;
93    
94              if (!(proc_list.Count > 0)) { //MessageBox.Show("Could not find any PCSX2 Processes.  Please start an instance of one.");              if (!(proc_list.Count > 0)) { //MessageBox.Show("Could not find any PCSX2 Processes.  Please start an instance of one.");
95                  return false; }                  return false; }
# Line 172  namespace RomCheater.Docking Line 172  namespace RomCheater.Docking
172    
173          private void PIDSelector_Load(object sender, EventArgs e)          private void PIDSelector_Load(object sender, EventArgs e)
174          {          {
175              if (ConfigPlugin == null || this.DesignMode) return;              if (AcceptedPlugin == null || this.DesignMode) return;
176              btnRefresh.PerformClick();              btnRefresh.PerformClick();
177          }          }
178      }      }

Legend:
Removed from v.152  
changed lines
  Added in v.153

  ViewVC Help
Powered by ViewVC 1.1.22