Ejemplo n.º 1
0
 public void ParseCtrl()
 {
     key = HotKey.Parse("Ctrl+F11");
     Assert.IsTrue(key.Ctrl);
     Assert.IsFalse(key.Alt);
     Assert.IsFalse(key.Shift);
     Assert.IsFalse(key.Win);
 }
Ejemplo n.º 2
0
 public void ParseAllModifiers()
 {
     key = HotKey.Parse("Ctrl+Alt+Shift+Win+A");
     Assert.IsTrue(key.Ctrl);
     Assert.IsTrue(key.Alt);
     Assert.IsTrue(key.Shift);
     Assert.IsTrue(key.Win);
 }
Ejemplo n.º 3
0
 public static HotKey Parse(string str)
 {
     HotKey hotKey = new HotKey();
     hotKey.Ctrl = str.Contains("Ctrl");
     hotKey.Alt = str.Contains("Alt");
     hotKey.Shift = str.Contains("Shift");
     hotKey.Win = str.Contains("Win");
     string[] definitions = str.Split('+');
     string key = definitions[definitions.Length - 1];
     KeysConverter converter = new KeysConverter();
     try
     {
         hotKey.Key = (Keys)converter.ConvertFromString(key);
     }
     catch
     { hotKey.Key = DefaultKey; }
     return hotKey;
 }
Ejemplo n.º 4
0
 public void ToStringWithNumKey()
 {
     key = HotKey.Parse("Ctrl+1");
     Assert.AreEqual("Ctrl+1", key.ToString());
 }
Ejemplo n.º 5
0
 public void ToStringWithModifiers()
 {
     key = HotKey.Parse("Win+Ctrl+Alt+Shift+R");
     Assert.AreEqual("Win+Ctrl+Alt+Shift+R", key.ToString());
 }
Ejemplo n.º 6
0
 public void ToStringSimple()
 {
     key = HotKey.Parse("F5");
     Assert.AreEqual("F5", key.ToString());
 }
Ejemplo n.º 7
0
 public void ParseKey()
 {
     key = HotKey.Parse("Shift+1");
     Assert.AreEqual(Keys.D1, key.Key);
 }
Ejemplo n.º 8
0
 public void KeyCode()
 {
     key = HotKey.Parse("5");
     Assert.AreEqual((int)Keys.D5, key.Code);
 }
Ejemplo n.º 9
0
 public void BadKey()
 {
     key = HotKey.Parse("BadKey");
     Assert.AreEqual(Keys.F12, key.Key);
 }
Ejemplo n.º 10
0
 public void Register()
 {
     manager.Register(null, 1, HotKey.Parse("Ctrl+F12"));
 }