/[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/PIDSelector.cs revision 110 by william, Thu May 10 12:16:41 2012 UTC trunk/RomCheater/Docking/PIDSelector.cs revision 151 by william, Mon May 28 00:17:16 2012 UTC
# Line 10  using RomCheater.PluginFramework.Interfa Line 10  using RomCheater.PluginFramework.Interfa
10  using RomCheater.PluginFramework.Core;  using RomCheater.PluginFramework.Core;
11  using System.IO;  using System.IO;
12  using RomCheater.Logging;  using RomCheater.Logging;
13    using WeifenLuo.WinFormsUI.Docking;
14    
15  namespace RomCheater  namespace RomCheater.Docking
16  {  {
17      public partial class PIDSelector : Form      public partial class PIDSelector : DockContent
18      {      {
19          private IConfigPlugin plugin = null;          private IConfigPlugin plugin = null;
20          //bool isInError = false;          //bool isInError = false;
21          public PIDSelector() { InitializeComponent(); this.SelectedPid = -1; }          public PIDSelector() { InitializeComponent(); this.SelectedPid = -1; OnSelectedProcessChanged = null; }
22          public PIDSelector(IConfigPlugin plugin) : this() { this.plugin = plugin; }          public PIDSelector(IConfigPlugin plugin) : this() { this.plugin = 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)]
# Line 29  namespace RomCheater Line 30  namespace RomCheater
30          public int SelectedPid { get { return _SelectedPid; } set { _SelectedPid = value; } }          public int SelectedPid { get { return _SelectedPid; } set { _SelectedPid = value; } }
31    
32    
33            public EventHandler<ProcessChangedEventArgs> OnSelectedProcessChanged { get; set; }
34            
35    
36    
37          public new void Show() { this.Show(null); }          public new void Show() { this.Show(null); }
38          public new void Show(IWin32Window owner) { this.PreInitShow(owner); }          //public new void Show(IWin32Window owner) { this.PreInitShow(owner); }
39          public new DialogResult ShowDialog() { return this.ShowDialog(null); }          public new void Show(DockPanel panel) { this.PreInitShow(panel); }
40          public new DialogResult ShowDialog(IWin32Window owner) { return this.PreInitDialog(owner); }          //public new DialogResult ShowDialog() { return this.ShowDialog(null); }
41          private void PreInitShow(IWin32Window owner)          //public new DialogResult ShowDialog(IWin32Window owner) { return this.PreInitDialog(owner); }
42          {          //private void PreInitShow(IWin32Window owner)
43              if (!this.RefreshList()) { MessageBox.Show(string.Format("Could not find any Processes for plugin {0}.  Please start an instance of one.",plugin.ToString())); }          //{
44              else { if (owner == null) { base.Show(); } else { base.Show(owner); } }          //    if (!this.RefreshList()) { MessageBox.Show(string.Format("Could not find any Processes for plugin {0}.  Please start an instance of one.",plugin.ToString())); }
45          }          //    else { if (owner == null) { base.Show(); } else { base.Show(owner); } }
46          private DialogResult PreInitDialog(IWin32Window owner)          //}
47          {          private void PreInitShow(DockPanel panel)
48              if (!this.RefreshList()) { MessageBox.Show(string.Format("Could not find any Processes for plugin {0}.  Please start an instance of one.", plugin.ToString())); return DialogResult.Cancel; }          {
49              else { if (owner == null) { return base.ShowDialog(); } else { return base.ShowDialog(owner); } }              //if (panel == null) return;
50          }              if (!this.RefreshList()) { MessageBox.Show(string.Format("Could not find any Processes for plugin {0}.  Please start an instance of one.", plugin.ToString())); }
51                else { if (panel == null) { base.Show(); } else { base.Show(panel); } }
52            }
53            //private DialogResult PreInitDialog(IWin32Window owner)
54            //{
55            //    if (!this.RefreshList()) { MessageBox.Show(string.Format("Could not find any Processes for plugin {0}.  Please start an instance of one.", plugin.ToString())); return DialogResult.Cancel; }
56            //    else { if (owner == null) { return base.ShowDialog(); } else { return base.ShowDialog(owner); } }
57            //}
58          private void btnLargeIcon_Click(object sender, EventArgs e) { this.lstProcessList.View = View.LargeIcon; }          private void btnLargeIcon_Click(object sender, EventArgs e) { this.lstProcessList.View = View.LargeIcon; }
59          private void btnDetails_Click(object sender, EventArgs e) { this.lstProcessList.View = View.Details; }          private void btnDetails_Click(object sender, EventArgs e) { this.lstProcessList.View = View.Details; }
60          private void btnSmallIcon_Click(object sender, EventArgs e) { this.lstProcessList.View = View.SmallIcon; }          private void btnSmallIcon_Click(object sender, EventArgs e) { this.lstProcessList.View = View.SmallIcon; }
# Line 53  namespace RomCheater Line 65  namespace RomCheater
65          {          {
66              if (!(lstProcessList.SelectedItems.Count > 0)) return;              if (!(lstProcessList.SelectedItems.Count > 0)) return;
67              this.SelectedPid = Convert.ToInt32(lstProcessList.SelectedItems[0].SubItems[1].Text);              this.SelectedPid = Convert.ToInt32(lstProcessList.SelectedItems[0].SubItems[1].Text);
68              this.Close();              //this.Close();
69                if (this.OnSelectedProcessChanged != null)
70                {
71                    this.OnSelectedProcessChanged(this, new ProcessChangedEventArgs(this.SelectedPid));
72                }
73          }          }
74    
75          private void btnCancel_Click(object sender, EventArgs e)          //private void btnCancel_Click(object sender, EventArgs e)
76          {          //{
77              this.SelectedPid = -1;          //    this.SelectedPid = -1;
78              this.Close();          //    //this.Close();
79          }          //}
80    
81          private void btnRefresh_Click(object sender, EventArgs e)          private void btnRefresh_Click(object sender, EventArgs e)
82          {          {
# Line 153  namespace RomCheater Line 169  namespace RomCheater
169    
170          }          }
171      }      }
172    
173        #region eventargs
174        public class ProcessChangedEventArgs : EventArgs
175        {
176            public ProcessChangedEventArgs() : this(-1) { }
177            public ProcessChangedEventArgs(int pid) { this.ProcessID = pid; }
178            public int ProcessID { get; private set; }
179        }
180        #endregion
181  }  }
182    

Legend:
Removed from v.110  
changed lines
  Added in v.151

  ViewVC Help
Powered by ViewVC 1.1.22