public static void ClickButton(ButtonBase button) { ButtonBaseAutomationPeer peer = FrameworkElementAutomationPeer.CreatePeerForElement(button) as ButtonBaseAutomationPeer; IInvokeProvider invoker = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; invoker.Invoke(); DispatcherHelper.UpdateLayoutAndDoEvents(button); }
public virtual void EnqueDelayOrWaitForObject(Func<object> getObject, Action<object> setObject, int delayInMillisceconds) { EnqueueCallback(() => { DateTime start = DateTime.Now; while(TimeSpan.FromMilliseconds(delayInMillisceconds) > DateTime.Now - start) { object obj = getObject(); if(obj != null) { setObject(obj); return; } DispatcherHelper.UpdateLayoutAndDoEvents(Window); } }); }
public virtual void EnqueWaitForObject(Func<object> getObject, Action<object> setObject, DispatcherPriority priority) { EnqueueCallback(() => { DateTime start = DateTime.Now; while(TimeSpan.FromSeconds(TimeoutInSeconds) > DateTime.Now - start) { object obj = getObject(); if(obj != null) { setObject(obj); return; } DispatcherHelper.UpdateLayoutAndDoEvents(Window, priority); } throw new Exception(GetTimeOutMessage(null, () => false)); }); }
public virtual void EnqueueWindowUpdateLayout(DispatcherPriority priority) { EnqueueCallback(delegate { DispatcherHelper.UpdateLayoutAndDoEvents(Window, priority); }); }
public override void Show() { base.Show(); DispatcherHelper.UpdateLayoutAndDoEvents(this); }