예제 #1
0
        public static void SelectRadio(IntPtr controlHandle)
        {
            try
            {
                AutomationElement control = CommonUIAPatternHelpers.Prologue(SelectionPattern.Pattern, controlHandle);
                StaticEvents.RegisterEvent(SelectionItemPattern.ElementSelectedEvent, control);

                TogglePatternHelper.SetToggleState(control, ToggleState.On);

                LogController.ReceiveLogMessage(new LogMessage(control.Current.Name));
            }
            catch (InvalidOperationException err)
            {
                throw new ProdOperationException(err.Message, err);
            }
            catch (ElementNotAvailableException err)
            {
                throw new ProdOperationException(err.Message, err);
            }
            catch (ArgumentException err)
            {
                throw new ProdOperationException(err.Message, err);
            }
        }
        public static void SetCheckState(IntPtr controlHandle, ToggleState isChecked)
        {
            try
            {
                AutomationElement control = CommonUIAPatternHelpers.Prologue(TogglePattern.Pattern, controlHandle);
                StaticEvents.RegisterEvent(TogglePattern.ToggleStateProperty, control);

                TogglePatternHelper.SetToggleState(control, isChecked);

                LogController.ReceiveLogMessage(new LogMessage(control.Current.Name));
            }
            catch (InvalidOperationException err)
            {
                throw new ProdOperationException(err.Message, err);
            }
            catch (ElementNotAvailableException err)
            {
                throw new ProdOperationException(err.Message, err);
            }
            catch (ArgumentException err)
            {
                throw new ProdOperationException(err.Message, err);
            }
        }
        public static void SetCheckState(ProdWindow prodwindow, string automationId, ToggleState isChecked)
        {
            try
            {
                AutomationElement control = InternalUtilities.GetHandlelessElement(prodwindow, automationId);
                StaticEvents.RegisterEvent(TogglePattern.ToggleStateProperty, control);

                TogglePatternHelper.SetToggleState(control, isChecked);

                LogController.ReceiveLogMessage(new LogMessage(control.Current.Name));
            }
            catch (InvalidOperationException err)
            {
                throw new ProdOperationException(err.Message, err);
            }
            catch (ElementNotAvailableException err)
            {
                throw new ProdOperationException(err.Message, err);
            }
            catch (ArgumentException err)
            {
                throw new ProdOperationException(err.Message, err);
            }
        }
예제 #4
0
 private static void UiaSetToggleState(BaseProdControl control, ToggleState checkstate)
 {
     AutomationEventVerifier.Register(new EventRegistrationMessage(control, TogglePatternIdentifiers.ToggleStateProperty));
     LogController.ReceiveLogMessage(new LogMessage(checkstate.ToString()));
     TogglePatternHelper.SetToggleState(control.UIAElement, checkstate);
 }