public BindingSource Listen( BindingListenOptions listenOptions, InputDevice device )
		{
			if (!listenOptions.IncludeKeys)
			{
				return null;
			}

			if (detectFound.Count > 0)
			{
				if (!detectFound.IsPressed)
				{
					if (detectPhase == 2)
					{
						var bindingSource = new KeyBindingSource( detectFound );
						Reset();
						return bindingSource;
					}
				}
			}

			var keyCombo = KeyCombo.Detect( listenOptions.IncludeModifiersAsFirstClassKeys );
			if (keyCombo.Count > 0)
			{
				if (detectPhase == 1)
				{
					detectFound = keyCombo;
					detectPhase = 2; // Wait for release.
				}
			}
			else
			{
				if (detectPhase == 0)
				{
					detectPhase = 1; // Wait for press.
				}
			}

			return null;
		}
 public KeyBindingSource( params Key[] keys )
 {
     this.keyCombo = new KeyCombo( keys );
 }
 public KeyBindingSource( KeyCombo keyCombo )
 {
     this.keyCombo = keyCombo;
 }
Пример #4
0
 public KeyBindingSource(params Key[] keys)
 {
     Control = new KeyCombo(keys);
 }
Пример #5
0
 public KeyBindingSource(KeyCombo keyCombo)
 {
     Control = keyCombo;
 }
Пример #6
0
 /// <summary>
 /// A convenience method for adding a KeyBindingSource to the default bindings.
 /// </summary>
 /// <param name="keyCombo">A KeyCombo for the binding source.</param>
 public void AddDefaultBinding(KeyCombo keyCombo)
 {
     AddDefaultBinding(new KeyBindingSource(keyCombo));
 }
		public KeyBindingSource( params Key[] keys )
		{
			Control = new KeyCombo( keys );
		}
		public KeyBindingSource( KeyCombo keyCombo )
		{
			Control = keyCombo;
		}
		internal override void Load( BinaryReader reader )
		{
			// Have to do this because it's a struct property? Weird.
			var temp = new KeyCombo();
			temp.Load( reader );
			Control = temp;
		}
Пример #10
0
		public static KeyCombo Detect( bool modifiersAsKeys )
		{
			var keyCombo = new KeyCombo();

			if (modifiersAsKeys)
			{
				for (var i = 1; i < 5; i++)
				{
					if (KeyInfo.KeyList[i].IsPressed)
					{
						keyCombo.AddInt( i );
					}
				}
			}
			else
			{
				for (var i = 5; i < 13; i++)
				{
					if (KeyInfo.KeyList[i].IsPressed)
					{
						keyCombo.AddInt( i );
						return keyCombo;
					}
				}
			}

			for (var i = 13; i < KeyInfo.KeyList.Length; i++)
			{
				if (KeyInfo.KeyList[i].IsPressed)
				{
					keyCombo.AddInt( i );
					return keyCombo;
				}
			}

			keyCombo.Clear();
			return keyCombo;
		}