Esempio n. 1
0
 public InterceptKeyboardSetting(string methodName, bool needsAsync, OriginalKey key, int[] modifiers)
 {
     this.methodName = methodName;
     this.needsAsync = needsAsync;
     this.key        = key;
     this.modifiers  = modifiers;
 }
 /// <summary>
 /// Compare against another key.
 /// </summary>
 /// <returns></returns>
 public bool Equals(EditCurveKey other)
 {
     return(
         other != null &&
         Id == other.Id &&
         OriginalKey.Equals(other.OriginalKey)
         );
 }
        /// <summary>
        /// Clone this Key.
        /// </summary>
        /// <returns></returns>
        public EditCurveKey Clone()
        {
            EditCurveKey a = new EditCurveKey(Id, OriginalKey.Clone());

            a.Selection      = Selection;
            a.TangentInType  = TangentInType;
            a.TangentOutType = TangentOutType;

            return(a);
        }
        protected override IntPtr KeyUpFunction(OriginalKey upKey, bool isVirtualInput, Func <IntPtr> defaultReturnFunc)
        {
            if (inkeys.ContainsKey(upKey))
            {
                var inkey = inkeys[upKey];
                inkeys.Remove(upKey);
                input.KeyUp(inkey);
            }

            return(base.KeyUpFunction(upKey, isVirtualInput, defaultReturnFunc));
        }
Esempio n. 5
0
        /// <summary>
        /// Input the Key.
        /// </summary>
        /// <param name="pushedKey">Actually pushed key</param>
        /// <param name="destKey">Converted key</param>
        /// <returns></returns>
        protected IntPtr InputKey(OriginalKey pushedKey, OriginalKey destKey)
        {
            var inputKey = KeyMapConverter.KeyToCode(destKey);
            var inkey    = input.KeyDown(inputKey);

            if (!inkeys.ContainsKey(pushedKey))
            {
                inkeys.Add(pushedKey, inkey);
            }
            return(new IntPtr(1));
        }
Esempio n. 6
0
        public void SanitizeMeasurementsTrimsLeadingAndTrailingSpaceInKeyNames()
        {
            const string OriginalKey   = " key with spaces ";
            const double OriginalValue = 42.0;
            var          original      = new Dictionary <string, double> {
                { OriginalKey, OriginalValue }
            };

            original.SanitizeMeasurements();

            string sanitizedKey = OriginalKey.Trim();

            Assert.Equal(new[] { new KeyValuePair <string, double>(sanitizedKey, OriginalValue) }, original);
        }
Esempio n. 7
0
        public void SanitizePropertiesTrimsLeadingAndTrailingSpaceInKeyNames()
        {
            const string OriginalKey   = " key with spaces ";
            const string OriginalValue = "Test Value";
            var          original      = new Dictionary <string, string> {
                { OriginalKey, OriginalValue }
            };

            original.SanitizeProperties();

            string sanitizedKey = OriginalKey.Trim();

            Assert.Equal(new[] { new KeyValuePair <string, string>(sanitizedKey, OriginalValue) }, original);
        }
        protected override IntPtr KeyDownFunction(OriginalKey pushedKey, bool isVirtualInput, Func <IntPtr> defaultReturnFunc)
        {
            if (!isVirtualInput && IsProcessName())
            {
                if (pushedKey == OriginalKey.None)
                {
                    return(new IntPtr(1));
                }

                if (KeyMap.ContainsKey(pushedKey))
                {
                    var input = KeyMap[pushedKey];
                    return(InputKey(pushedKey, input));
                }
            }

            return(base.KeyDownFunction(pushedKey, isVirtualInput, defaultReturnFunc));
        }
Esempio n. 9
0
 /// <summary>
 /// Convert OriginalKey to int keycode.
 /// </summary>
 /// <param name="key">OriginalKey</param>
 /// <returns></returns>
 public static int KeyToCode(OriginalKey key)
 {
     return((int)key);
 }
 public override int GetHashCode()
 {
     return(OriginalKey.GetHashCode());
 }
Esempio n. 11
0
 protected void OnKeyUpEvent(int keyCode, OriginalKey key, bool isVirtualInput)
 {
     KeyUpEvent?.Invoke(this, new OriginalKeyEventArg(keyCode, key, isVirtualInput));
 }
Esempio n. 12
0
 public OriginalKeyEventArg(int keyCode, OriginalKey key, bool isVirtualInput)
 {
     KeyCode        = keyCode;
     Key            = key;
     IsVirtualInput = isVirtualInput;
 }
Esempio n. 13
0
 /// <summary>
 /// KeyUp method. It is a method for override.
 /// </summary>
 /// <param name="upKey">Converted key</param>
 protected virtual IntPtr KeyUpFunction(OriginalKey upKey, bool isVirtualInput, Func <IntPtr> defaultReturnFunc)
 {
     return(defaultReturnFunc());
 }
Esempio n. 14
0
            /**
             * <summary>
             * 指定されたキーコード、修飾キーが押されたかを判別する
             * </summary>
             */
            public bool Equals(OriginalKey key, int[] modifiers)
            {
                var originalKey = KeyMapConverter.KeyCodeToKey(this.KeyCode);

                return(key == originalKey && this.EqualsModifiers(modifiers));
            }