/// <summary>
/// Safely set the <see cref="ToolStripItem.Text"/> of the ToolStripItem across threads.
/// </summary>
/// <param name="toolStripItem"></param>
/// <param name="value"></param>
public static void Text( this ToolStripItem toolStripItem, String value ) {
if ( null == toolStripItem ) {
return;
}
if ( toolStripItem.IsDisposed ) {
return;
}
toolStripItem.OnThread( () => {
if ( toolStripItem.IsDisposed ) {
return;
}
toolStripItem.Text = value;
toolStripItem.Invalidate();
} );
}
No comments:
Post a Comment