/// <summary> /// Determine if specified button states match, using timeout to allow for event updating /// </summary> /// <param name="button"></param> /// <param name="expectedState"></param> /// <param name="timeOutToUse"></param> /// <exception cref="">if state still does not match after timeout</exception> public void ValidateSingleButtonState(AddinRibbonButton button, RibbonButtonState expectedState, TimeSpan timeOutToUse) { RefreshRibbonPreRead(); var sw = Stopwatch.StartNew(); do { if (GetButtonStateRaw(button) == expectedState) { return; } Thread.Sleep(TimeSpan.FromMilliseconds(100)); //be cpu-friendly }while (sw.Elapsed < timeOutToUse); throw new ApplicationException("Button '" + button + "' did not get to expected state '" + expectedState + "' within " + AddinTestUtility.DialogControlEventStateUpdateTimeout.TotalSeconds + "sec"); }
/// <summary> /// Determine if specified button states match, using timeout to allow for event updating /// </summary> /// <param name="button"></param> /// <param name="expectedState"></param> /// <param name="timeOutToUse"></param> /// <exception cref="">if state still does not match after timeout</exception> public void ValidateSingleButtonState(AddinRibbonButton button, RibbonButtonState expectedState, TimeSpan timeOutToUse) { RefreshRibbonPreRead(); var sw = Stopwatch.StartNew(); do { if (GetButtonStateRaw(button) == expectedState) { return; } Thread.Sleep(TimeSpan.FromMilliseconds(100)); //be cpu-friendly } while (sw.Elapsed < timeOutToUse); throw new ApplicationException("Button '" + button + "' did not get to expected state '" + expectedState + "' within " + AddinTestUtility.DialogControlEventStateUpdateTimeout.TotalSeconds + "sec"); }
public void ValidateSingleButtonState(AddinRibbonButton button, RibbonButtonState expectedState) { ValidateSingleButtonState(button, expectedState, AddinTestUtility.RibbonButtonsBecomeActivatedTimeout); }