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();
        }
Exemplo 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 TriColorFragmentProvider(TriColorControl control, IRawElementProviderFragmentRoot root, TriColorValue value)
            : base((IRawElementProviderFragment)root /* parent */, root /* fragmentRoot */)
        {
            _control = control;
            _value   = value;

            // Populate static properties
            //
            // In a production app, Name should be localized
            AddStaticProperty(UIA_PropertyIds.UIA_NamePropertyId, _value.ToString());
            AddStaticProperty(UIA_PropertyIds.UIA_ControlTypePropertyId, UIA_ControlTypeIds.UIA_CustomControlTypeId);
            // In a production app, LocalizedControlType should be localized
            AddStaticProperty(UIA_PropertyIds.UIA_LocalizedControlTypePropertyId, "tri-color item");
            AddStaticProperty(UIA_PropertyIds.UIA_ProviderDescriptionPropertyId, "UIASamples: Tri-Color Fragment Provider");
            AddStaticProperty(UIA_PropertyIds.UIA_AutomationIdPropertyId, _value.ToString());
            AddStaticProperty(UIA_PropertyIds.UIA_IsKeyboardFocusablePropertyId, false);
            AddStaticProperty(UIA_PropertyIds.UIA_IsControlElementPropertyId, true);
            AddStaticProperty(UIA_PropertyIds.UIA_IsContentElementPropertyId, false);
        }
        public TriColorFragmentProvider(TriColorControl control, IRawElementProviderFragmentRoot root, TriColorValue value)
            : base((IRawElementProviderFragment) root /* parent */, root /* fragmentRoot */)
        {
            _control = control;
            _value = value;

            // Populate static properties
            //
            // In a production app, Name should be localized
            AddStaticProperty(UIA_PropertyIds.UIA_NamePropertyId, _value.ToString());
            AddStaticProperty(UIA_PropertyIds.UIA_ControlTypePropertyId, UIA_ControlTypeIds.UIA_CustomControlTypeId);
            // In a production app, LocalizedControlType should be localized
            AddStaticProperty(UIA_PropertyIds.UIA_LocalizedControlTypePropertyId, "tri-color item");
            AddStaticProperty(UIA_PropertyIds.UIA_ProviderDescriptionPropertyId, "UIASamples: Tri-Color Fragment Provider");
            AddStaticProperty(UIA_PropertyIds.UIA_AutomationIdPropertyId, _value.ToString());
            AddStaticProperty(UIA_PropertyIds.UIA_IsKeyboardFocusablePropertyId, false);
            AddStaticProperty(UIA_PropertyIds.UIA_IsControlElementPropertyId, true);
            AddStaticProperty(UIA_PropertyIds.UIA_IsContentElementPropertyId, false);
        }