Exemplo n.º 1
0
        internal static UIProperty Get(AutomationProperty property)
        {
            lock (lockObject) {
                if (_automationPropertyTable == null)
                {
                    _automationPropertyTable = new Dictionary <AutomationProperty, UIProperty>(capacity: _propertyTable.Count);
                    foreach (var uiProperty in _propertyTable.Values)
                    {
                        _automationPropertyTable.Add(key: uiProperty.Property, value: uiProperty);
                    }
                }
            }

            try {
                return(_automationPropertyTable[key : property]);
            } catch (KeyNotFoundException ex) {
                throw new UIQueryException(message: StringResource.Get(id: "PropertyNotFound_1", (object)property.ToString()));
            }
        }
Exemplo n.º 2
0
        void SendKeys(string text)
        {
            lock (sendKeysLock) {
                List <IInputAction> inputs;
                if (!ParseText(text: text, inputs: out inputs))
                {
                    throw new ArgumentException(message: StringResource.Get(id: "SendKeysStringMalformed"), paramName: nameof(text));
                }
                if (TurnOffToggleKeys)
                {
                    List <IInputAction> turnOffLockInputs;
                    List <IInputAction> restoreLockInputs;
                    GetLockToggleInputs(turnOffLockInputs: out turnOffLockInputs, restoreLockInputs: out restoreLockInputs);
                    inputs.InsertRange(index: 0, collection: turnOffLockInputs);
                    inputs.AddRange(collection: restoreLockInputs);
                }

                this.inputQueue.Process(inputDevice: this.inputDevice, inputList: inputs);
            }
        }
 public UIObjectNotFoundException()
     : base(message: StringResource.Get(id: "UIObjectNotFound"))
 {
 }
Exemplo n.º 4
0
 public void Clear()
 {
     throw new NotSupportedException(message: StringResource.Get(id: "CannotModifyCollection"));
 }
Exemplo n.º 5
0
 public bool Remove(I item)
 {
     throw new NotSupportedException(message: StringResource.Get(id: "CannotModifyCollection"));
 }
Exemplo n.º 6
0
 I IList <I> .this[int index] {
     get { return(this[index : index]); }
     set { throw new NotSupportedException(message: StringResource.Get(id: "CannotModifyCollection")); }
 }
Exemplo n.º 7
0
 public void Insert(int index, I item)
 {
     throw new NotSupportedException(message: StringResource.Get(id: "CannotModifyCollection"));
 }
Exemplo n.º 8
0
 public void RemoveAt(int index)
 {
     throw new NotSupportedException(message: StringResource.Get(id: "CannotModifyCollection"));
 }
Exemplo n.º 9
0
        internal static Provider Read(RegistryKey providersKey, string friendlyName)
        {
            var  registryKey = providersKey.OpenSubKey(name: friendlyName);
            var  description = registryKey.GetValue(name: "Description", defaultValue: string.Empty) as string;
            bool result;
            var  typeName = bool.TryParse(value: registryKey.GetValue(name: "OnByDefault", defaultValue: string.Empty) as string, result: out result) ? registryKey.GetValue(name: "RegistrarType", defaultValue: string.Empty) as string : throw new InvalidOperationException(message: StringResource.Get(id: "InvalidProviderEntry"));
            var  type     = !string.IsNullOrEmpty(value: typeName) ? Type.GetType(typeName: typeName, throwOnError: false) : throw new InvalidOperationException(message: StringResource.Get(id: "InvalidProviderEntry"));

            if ((object)type == null)
            {
                throw new InvalidOperationException(message: StringResource.Get(id: "InvalidProviderEntry"));
            }
            return(new Provider(type: type, friendlyName: friendlyName, onByDefault: result, description: description));
        }
Exemplo n.º 10
0
        static RIMNativeMethods.MOUSE_EVENT_FLAGS MouseButtonsToMouseInputs(
            PointerButtons physicalButton,
            bool isMouseFlagsDown)
        {
            var mouseEventFlags = RIMNativeMethods.MOUSE_EVENT_FLAGS.NONE;

            if (isMouseFlagsDown)
            {
                if ((physicalButton & PointerButtons.PhysicalLeft) != PointerButtons.None)
                {
                    mouseEventFlags |= RIMNativeMethods.MOUSE_EVENT_FLAGS.LEFTDOWN;
                }
                if ((physicalButton & PointerButtons.PhysicalRight) != PointerButtons.None)
                {
                    mouseEventFlags |= RIMNativeMethods.MOUSE_EVENT_FLAGS.RIGHTDOWN;
                }
                if ((physicalButton & PointerButtons.Middle) != PointerButtons.None)
                {
                    mouseEventFlags |= RIMNativeMethods.MOUSE_EVENT_FLAGS.MIDDLEDOWN;
                }
                if ((physicalButton & PointerButtons.XButton1) != PointerButtons.None || (physicalButton & PointerButtons.XButton2) != PointerButtons.None)
                {
                    mouseEventFlags |= RIMNativeMethods.MOUSE_EVENT_FLAGS.XDOWN;
                }
            }
            else
            {
                if ((physicalButton & PointerButtons.PhysicalLeft) != PointerButtons.None)
                {
                    mouseEventFlags |= RIMNativeMethods.MOUSE_EVENT_FLAGS.LEFTUP;
                }
                if ((physicalButton & PointerButtons.PhysicalRight) != PointerButtons.None)
                {
                    mouseEventFlags |= RIMNativeMethods.MOUSE_EVENT_FLAGS.RIGHTUP;
                }
                if ((physicalButton & PointerButtons.Middle) != PointerButtons.None)
                {
                    mouseEventFlags |= RIMNativeMethods.MOUSE_EVENT_FLAGS.MIDDLEUP;
                }
                if ((physicalButton & PointerButtons.XButton1) != PointerButtons.None || (physicalButton & PointerButtons.XButton2) != PointerButtons.None)
                {
                    mouseEventFlags |= RIMNativeMethods.MOUSE_EVENT_FLAGS.XUP;
                }
            }

            return(mouseEventFlags != RIMNativeMethods.MOUSE_EVENT_FLAGS.NONE ? mouseEventFlags : throw new ArgumentException(message: StringResource.Get(id: "InvalidMouseButtonEnum"), paramName: "mouseInputs"));
        }