public static ToggleState GetCheckState(IntPtr controlHandle) { try { AutomationElement control = CommonUIAPatternHelpers.Prologue(TogglePattern.Pattern, controlHandle); StaticEvents.RegisterEvent(TogglePattern.ToggleStateProperty, control); ToggleState ret = TogglePatternHelper.GetToggleState(control); if (ret == ToggleState.Indeterminate) { /* Otherwise, retry with native method */ ret = ProdCheckBoxNative.GetCheckStateNative(controlHandle); } LogController.ReceiveLogMessage(new LogMessage(control.Current.Name)); return(ret); } 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); } }
internal static ToggleState NativeGetToggleState(BaseProdControl control) { return(ProdCheckBoxNative.GetCheckStateNative((IntPtr)control.UIAElement.Current.NativeWindowHandle)); }