public ErrorProvider() { _icon = DefaultIcon; _blinkRate = DefaultBlinkRate; _blinkStyle = DefaultBlinkStyle; _currentChanged = new EventHandler(ErrorManager_CurrentChanged); }
/// <summary> /// Resets the error provider, error messages. I've noticed that when /// you click on an error provider, while its tool tip is displayed, /// the tool tip doesn't return. It will return if the text is reset, or /// if the user is able to hover over anohter error provider message for /// that errorProvider instance. /// /// Todo: I would like to find an easier way to fix this... /// Email me at: [email protected] /// </summary> private void RefreshProviderErrors() { Hashtable hashRes = (Hashtable)GetFieldValue(mTheErrorProvider, "items"); foreach (Control control in hashRes.Keys) { if (hashRes[control] == null) { break; } if (!(bool)GetFieldValue(hashRes[control], "toolTipShown")) { if (mTheErrorProvider.GetError(control) != null && mTheErrorProvider.GetError(control).Length > 0) { string str = mTheErrorProvider.GetError(control); ErrorBlinkStyle prev = mTheErrorProvider.BlinkStyle; mTheErrorProvider.BlinkStyle = ErrorBlinkStyle.NeverBlink; mTheErrorProvider.SetError(control, ""); mTheErrorProvider.SetError(control, str); mTheErrorProvider.BlinkStyle = prev; } } } }
public ErrorProvider() { this.items = new Hashtable(); this.windows = new Hashtable(); this.icon = DefaultIcon; this.showIcon = true; this.icon = DefaultIcon; this.blinkRate = 250; this.blinkStyle = ErrorBlinkStyle.BlinkIfDifferentError; this.currentChanged = new EventHandler(this.ErrorManager_CurrentChanged); }
public void ErrorProvider_BlinkStyle_Set_GetReturnsExpected(ErrorBlinkStyle value) { var provider = new ErrorProvider { BlinkStyle = value }; Assert.Equal(value, provider.BlinkStyle); Assert.Equal(250, provider.BlinkRate); // Set same. provider.BlinkStyle = value; Assert.Equal(value, provider.BlinkStyle); Assert.Equal(250, provider.BlinkRate); }
public void ErrorProvider_BlinkStyle_SetWithZeroBlinkRate_GetReturnsExpected(ErrorBlinkStyle value) { var provider = new ErrorProvider { BlinkRate = 0, BlinkStyle = value }; Assert.Equal(ErrorBlinkStyle.NeverBlink, provider.BlinkStyle); Assert.Equal(0, provider.BlinkRate); // Set same. provider.BlinkStyle = value; Assert.Equal(ErrorBlinkStyle.NeverBlink, provider.BlinkStyle); Assert.Equal(0, provider.BlinkRate); }
public void ErrorProvider_SetError_Invoke_GetErrorReturnsExpected(ErrorBlinkStyle blinkStyle, string value, string expected) { var provider = new ErrorProvider { BlinkStyle = blinkStyle }; var control = new Control(); provider.SetError(control, value); Assert.Equal(expected, provider.GetError(control)); // Call again. provider.SetError(control, value); Assert.Equal(expected, provider.GetError(control)); // Set empty. provider.SetError(control, string.Empty); Assert.Empty(provider.GetError(control)); }
public void ErrorProvider_BlinkRate_Set_GetReturnsExpected(int value, ErrorBlinkStyle expectedBlinkStyle) { var provider = new ErrorProvider { BlinkRate = value }; Assert.Equal(value, provider.BlinkRate); Assert.Equal(expectedBlinkStyle, provider.BlinkStyle); // Set same. provider.BlinkRate = value; Assert.Equal(value, provider.BlinkRate); Assert.Equal(expectedBlinkStyle, provider.BlinkStyle); // Set blink style. provider.BlinkStyle = ErrorBlinkStyle.BlinkIfDifferentError; Assert.Equal(value, provider.BlinkRate); Assert.Equal(expectedBlinkStyle, provider.BlinkStyle); }
public ErrorProvider() { controls = new Hashtable(); blinkrate = 250; blinkstyle = ErrorBlinkStyle.BlinkIfDifferentError; icon = ResourceImageLoader.GetIcon("errorProvider.ico"); tooltip = new ToolTip.ToolTipWindow(); //UIA Framework: Event used to indicate the ToolTip is shown/hidden. tooltip.VisibleChanged += delegate(object sender, EventArgs args) { if (tooltip.Visible == true) { OnUIAPopup(this, new PopupEventArgs(UIAControl, UIAControl, false, Size.Empty)); } else if (tooltip.Visible == false) { OnUIAUnPopup(this, new PopupEventArgs(UIAControl, UIAControl, false, Size.Empty)); } }; }
public void ErrorProvider_BlinkStyle_SetInvalidValue_ThrowsInvalidEnumArgumentException(ErrorBlinkStyle value) { var provider = new ErrorProvider(); Assert.Throws <InvalidEnumArgumentException>("value", () => provider.BlinkStyle = value); }
public void ErrorProvider_Items_CallEvents_Success(ErrorBlinkStyle blinkStyle, SubControl control, string error, string expected) { bool originalVisible = control.Visible; var originalParent = new Control(); var newParent = new Control(); using (var provider = new ErrorProvider { BlinkStyle = blinkStyle }) { provider.SetError(control, error); Assert.Equal(expected, provider.GetError(control)); // Call event properties - without handle. control.Location = new Point(1, 2); Assert.Equal(new Point(1, 2), control.Location); control.Size = new Size(2, 3); Assert.Equal(new Size(2, 3), control.Size); control.Visible = !originalVisible; Assert.Equal(!originalVisible, control.Visible); control.Visible = originalVisible; Assert.Equal(originalVisible, control.Visible); control.Parent = newParent; Assert.Same(newParent, control.Parent); control.Parent = null; Assert.Null(control.Parent); control.Parent = originalParent; Assert.Same(originalParent, control.Parent); // Call event methods - without handle. control.OnHandleCreated(EventArgs.Empty); control.OnHandleDestroyed(EventArgs.Empty); control.OnLocationChanged(EventArgs.Empty); control.OnSizeChanged(EventArgs.Empty); control.OnVisibleChanged(EventArgs.Empty); control.OnParentChanged(EventArgs.Empty); // Call event properties - with handle. Assert.NotEqual(IntPtr.Zero, control.Handle); control.Location = new Point(2, 3); Assert.Equal(new Point(2, 3), control.Location); control.Size = new Size(4, 5); Assert.Equal(new Size(4, 5), control.Size); control.Visible = !originalVisible; Assert.Equal(!originalVisible, control.Visible); control.Visible = originalVisible; Assert.Equal(originalVisible, control.Visible); control.Parent = newParent; Assert.Same(newParent, control.Parent); control.Parent = null; Assert.Null(control.Parent); control.Parent = originalParent; Assert.Same(originalParent, control.Parent); // Call event methods - with handle. control.OnHandleCreated(EventArgs.Empty); control.OnHandleDestroyed(EventArgs.Empty); control.OnLocationChanged(EventArgs.Empty); control.OnSizeChanged(EventArgs.Empty); control.OnVisibleChanged(EventArgs.Empty); control.OnParentChanged(EventArgs.Empty); control.Dispose(); } }
public ErrorProvider() { controls = new Hashtable(); blinkrate = 250; blinkstyle = ErrorBlinkStyle.BlinkIfDifferentError; icon = ResourceImageLoader.GetIcon ("errorProvider.ico"); tooltip = new ToolTip.ToolTipWindow(); #if NET_2_0 //UIA Framework: Event used to indicate the ToolTip is shown/hidden. tooltip.VisibleChanged += delegate (object sender, EventArgs args) { if (tooltip.Visible == true) OnUIAPopup (this, new PopupEventArgs (UIAControl, UIAControl, false, Size.Empty)); else if (tooltip.Visible == false) OnUIAUnPopup (this, new PopupEventArgs (UIAControl, UIAControl, false, Size.Empty)); }; #endif }
// // CONSTRUCTOR // /// <include file='doc\ErrorProvider.uex' path='docs/doc[@for="ErrorProvider.ErrorProvider"]/*' /> /// <devdoc> /// Default constructor. /// </devdoc> public ErrorProvider() { icon = DefaultIcon; blinkRate = defaultBlinkRate; blinkStyle = defaultBlinkStyle; currentChanged = new EventHandler(ErrorManager_CurrentChanged); }