misu – Diff between revs 1 and 7

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 1 Rev 7
Line 1... Line 1...
1 using System; 1 using System;
2 using System.Collections.Generic; 2 using System.Collections.Generic;
-   3 using System.Collections.Specialized;
3 using System.Drawing; 4 using System.Drawing;
4 using System.Linq; 5 using System.Linq;
5 using System.Windows.Forms; 6 using System.Windows.Forms;
6 using Configuration; -  
7 using Gma.System.MouseKeyHook; 7 using Gma.System.MouseKeyHook;
-   8 using misu.Properties;
Line 8... Line 9...
8   9  
9 namespace misu 10 namespace misu
10 { 11 {
11 public partial class BindKeyForm : Form 12 public partial class BindKeyForm : Form
Line 14... Line 15...
14   15  
Line 15... Line 16...
15 public event EventHandler<KeyBoundEventArgs> KeyBound; 16 public event EventHandler<KeyBoundEventArgs> KeyBound;
Line 16... Line -...
16   -  
17 #endregion -  
18   -  
19 #region Public Enums, Properties and Fields -  
20   -  
21 public Settings Settings { get; set; } -  
22   17  
Line 23... Line 18...
23 #endregion 18 #endregion
Line 24... Line 19...
24   19  
Line 40... Line 35...
40 public BindKeyForm(IKeyboardMouseEvents globalHook) : this() 35 public BindKeyForm(IKeyboardMouseEvents globalHook) : this()
41 { 36 {
42 GlobalHook = globalHook; 37 GlobalHook = globalHook;
43 } 38 }
Line 44... Line -...
44   -  
45 public BindKeyForm(IKeyboardMouseEvents globalHook, Settings settings) : this(globalHook) -  
46 { -  
47 Settings = settings; -  
48 } -  
49   39  
Line 50... Line 40...
50 #endregion 40 #endregion
Line 51... Line 41...
51   41  
Line 59... Line 49...
59 button1.BackColor = SystemColors.Control; 49 button1.BackColor = SystemColors.Control;
Line 60... Line 50...
60   50  
61 e.Handled = true; 51 e.Handled = true;
Line -... Line 52...
-   52 e.SuppressKeyPress = true;
62 e.SuppressKeyPress = true; 53  
63   54 Settings.Default.Keys = new StringCollection();
64 var distinct = new List<Keys>(BoundKeys.Distinct()); 55 foreach (var key in BoundKeys.Distinct())
-   56 {
Line 65... Line 57...
65   57 Settings.Default.Keys.Add(key.ToString());
Line 66... Line 58...
66 Settings.Binding.Keys = distinct; 58 }
Line 67... Line 59...
67   59  
68 this.Execute(() => { textBox1.Text = Settings.Binding.ToString(); }); 60 this.Execute(() => { textBox1.Text = string.Join(" ", Settings.Default.Keys.OfType<string>()); });
Line 69... Line 61...
69   61  
Line 93... Line 85...
93 GlobalHook.KeyUp += GlobalHook_KeyUp; 85 GlobalHook.KeyUp += GlobalHook_KeyUp;
94 } 86 }
Line 95... Line 87...
95   87  
96 private void OnFormLoad(object sender, EventArgs e) 88 private void OnFormLoad(object sender, EventArgs e)
-   89 {
-   90 if (Settings.Default.Keys != null)
97 { 91 {
-   92 textBox1.Text = string.Join(" ", Settings.Default.Keys.OfType<string>());
98 textBox1.Text = Settings.Binding.ToString(); 93 }
Line 99... Line 94...
99 } 94 }
100   95  
101 #endregion 96 #endregion
102 } 97 }