/[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 362 by william, Sun Jun 10 01:35:18 2012 UTC revision 363 by william, Sun Jun 10 02:24:09 2012 UTC
# Line 13  using RomCheater.Logging; Line 13  using RomCheater.Logging;
13  using WeifenLuo.WinFormsUI.Docking;  using WeifenLuo.WinFormsUI.Docking;
14  using RomCheater.PluginFramework.Events;  using RomCheater.PluginFramework.Events;
15  using System.Management;  using System.Management;
16    using System.Reflection;
17    
18  namespace RomCheater.Docking  namespace RomCheater.Docking
19  {  {
# Line 67  namespace RomCheater.Docking Line 68  namespace RomCheater.Docking
68          //    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; }          //    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; }
69          //    else { if (owner == null) { return base.ShowDialog(); } else { return base.ShowDialog(owner); } }          //    else { if (owner == null) { return base.ShowDialog(); } else { return base.ShowDialog(owner); } }
70          //}          //}
71          private void btnLargeIcon_Click(object sender, EventArgs e) { this.lstProcessList.View = View.LargeIcon; }          //private void SetControlBackColor(Control control, KnownColor color) { SetControlBackColor(control, Color.FromKnownColor(color)); }
72          private void btnDetails_Click(object sender, EventArgs e) { this.lstProcessList.View = View.Details; }          //private void SetControlBackColor(Control control, Color color) { control.BackColor = color; }
73          private void btnSmallIcon_Click(object sender, EventArgs e) { this.lstProcessList.View = View.SmallIcon; }          private void SetControlBackColor<T>(T component, KnownColor color) { SetControlBackColor(component, Color.FromKnownColor(color)); }
74          private void btnList_Click(object sender, EventArgs e) { this.lstProcessList.View = View.List; }          private void SetControlBackColor<T>(T component, Color color)
75          private void btnTile_Click(object sender, EventArgs e) { this.lstProcessList.View = View.Tile; }          {
76                Type ComponentType = component.GetType();
77                PropertyInfo pBackColor = ComponentType.GetProperty("BackColor");
78                pBackColor.SetValue(component, color, null);
79            }
80            private void SetViewForProcessListView(View view)
81            {
82                KnownColor DefaultColor = KnownColor.GradientActiveCaption;
83                Color s = Color.FromKnownColor(DefaultColor);
84                Color c = Color.FromArgb(s.A, s.R, s.G+10, s.B+10);
85                ResetViewButtonControls();
86                switch (view)
87                {
88                    case View.Details: SetControlBackColor(btnDetails, c); break;
89                    case View.LargeIcon: SetControlBackColor(btnLargeIcon, c); break;
90                    case View.List: SetControlBackColor(btnList, c); break;
91                    case View.SmallIcon: SetControlBackColor(btnSmallIcon, c); break;
92                    case View.Tile: SetControlBackColor(btnTile, c); break;
93                }
94                lstProcessList.View = view;
95            }
96            private void ResetViewButtonControls()
97            {
98                KnownColor DefaultColor = KnownColor.Control;
99                SetControlBackColor(btnLargeIcon, DefaultColor);
100                SetControlBackColor(btnDetails, DefaultColor);
101                SetControlBackColor(btnSmallIcon, DefaultColor);
102                SetControlBackColor(btnList, DefaultColor);
103                SetControlBackColor(btnTile, DefaultColor);
104            }
105            private void btnLargeIcon_Click(object sender, EventArgs e) { SetViewForProcessListView(View.LargeIcon); }
106            private void btnDetails_Click(object sender, EventArgs e) { SetViewForProcessListView(View.Details); }
107            private void btnSmallIcon_Click(object sender, EventArgs e) { SetViewForProcessListView(View.SmallIcon); }
108            private void btnList_Click(object sender, EventArgs e) { SetViewForProcessListView(View.List); }
109            private void btnTile_Click(object sender, EventArgs e) { SetViewForProcessListView(View.Tile); }
110    
111          private void PerformListViewItemSelect(ListViewItem li)          private void PerformListViewItemSelect(ListViewItem li)
112          {          {
# Line 210  namespace RomCheater.Docking Line 245  namespace RomCheater.Docking
245              if (AcceptedPlugin == null || this.DesignMode) return;              if (AcceptedPlugin == null || this.DesignMode) return;
246              txtstatus_Pid.Text = "";              txtstatus_Pid.Text = "";
247              txtstatus_Filename.Text = "";              txtstatus_Filename.Text = "";
248              lstProcessList.View = View.List;              ResetViewButtonControls();
249                SetControlBackColor(btnList, KnownColor.ActiveCaption);
250                SetViewForProcessListView(View.List);
251              this.RefreshList();              this.RefreshList();
252          }          }
253    

Legend:
Removed from v.362  
changed lines
  Added in v.363

  ViewVC Help
Powered by ViewVC 1.1.22