Declaration of the pattern schema, with all of the information UIA needs about this property.
Inheritance: ManagedUiaCustomizationCore.CustomPatternSchemaBase
Esempio n. 1
0
        public void Dispatch(object pTarget, uint index, UIAutomationParameter[] pParams, uint cParams)
        {
            // Parse the provider and parameter list
            var provider  = (ITestProvider)pTarget;
            var paramList = new UiaParameterListHelper(pParams);

            var member = TestSchema.GetInstance().GetMemberByIndex(index);

            if (member != null)
            {
                member.DispatchCallToProvider(provider, paramList);
                return;
            }

            // Dispatch the method/property calls
            if (index == TestSchema.GetInstance().GetBoolValueMethod.Index)
            {
                paramList[0] = provider.BoolValue;
            }
            else if (index == TestSchema.GetInstance().GetDoubleValueMethod.Index)
            {
                paramList[0] = provider.DoubleValue;
            }
            else if (index == TestSchema.GetInstance().GetElementValueMethod.Index)
            {
                paramList[0] = provider.ElementValue;
            }
            else
            {
                throw new InvalidOperationException();
            }
        }
Esempio n. 2
0
        public TriColorProvider(TriColorControl control)
        {
            _control = control;

            // Populate static properties
            //
            AddStaticProperty(UIA_PropertyIds.UIA_ControlTypePropertyId, UIA_ControlTypeIds.UIA_CustomControlTypeId);
            AddStaticProperty(UIA_PropertyIds.UIA_LocalizedControlTypePropertyId, "tri-color picker");
            AddStaticProperty(UIA_PropertyIds.UIA_ProviderDescriptionPropertyId, "UIASamples: Tri-Color Provider");
            AddStaticProperty(UIA_PropertyIds.UIA_HelpTextPropertyId,
                              "This is a color picker for a choice of three colors.  Use Up and Down arrows to move the selection between the colors.");
            // The WinForm name for this control makes a good Automation ID.
            AddStaticProperty(UIA_PropertyIds.UIA_AutomationIdPropertyId, _control.Name);
            AddStaticProperty(UIA_PropertyIds.UIA_IsKeyboardFocusablePropertyId, true);
            AddStaticProperty(UIA_PropertyIds.UIA_IsControlElementPropertyId, true);
            AddStaticProperty(UIA_PropertyIds.UIA_IsContentElementPropertyId, true);

            // Some properties are provided for me already by HWND provider
            // NativeWindowHandle, ProcessId, FrameworkId, IsEnabled, HasKeyboardFocus

            // Register for custom property
            ReadyStateSchema.GetInstance().Register();

            // Register for custom pattern
            ColorSchema.GetInstance().Register();

            // TEST: Register for test schema
            TestSchema.GetInstance().Register();
        }
        public void PassIntParam(int value, out int retVal)
        {
            // Create and init a parameter list
            // We can't just use the CallMethod helper because we have out-parameters
            var paramList = new UiaParameterListHelper(TestSchema.GetInstance().PassIntParamMethod);

            paramList[0] = value;

            // Call through
            PatternInstance.CallMethod(TestSchema.GetInstance().PassIntParamMethod.Index, paramList.Data, paramList.Count);

            // Get the out-parameter
            retVal = (int)paramList[1];
        }
Esempio n. 4
0
        public override object GetPatternProvider(int patternId)
        {
            // We just respond with ourself for the patterns we support.
            if (patternId == UIA_PatternIds.UIA_ValuePatternId ||
                patternId == UIA_PatternIds.UIA_SelectionPatternId ||
                patternId == ColorSchema.GetInstance().PatternId)
            {
                return(this);
            }

            // TEST: Respond with a test schema object on request
            if (patternId == TestSchema.GetInstance().PatternId)
            {
                return(new TestPatternProvider(this));
            }

            return(base.GetPatternProvider(patternId));
        }