本文整理汇总了C#中System.Windows.Forms.Control.ThrowIfNull方法的典型用法代码示例。如果您正苦于以下问题:C# Control.ThrowIfNull方法的具体用法?C# Control.ThrowIfNull怎么用?C# Control.ThrowIfNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Control
的用法示例。
在下文中一共展示了Control.ThrowIfNull方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetTabControlComparer
public void SetTabControlComparer(Control control, TabControlComparer tabControlComparer)
{
control.ThrowIfNull("control");
tabControlComparer.ThrowIfNull("tabControlComparer");
_controlOverrides[control] = tabControlComparer;
}
示例2: BeginInvoke
/// <summary>
/// Invokes asynchronously the specified action for this control.
/// </summary>
/// <param name="control">The control.</param>
/// <param name="action">The action.</param>
public static void BeginInvoke(Control control, Action action)
{
control.ThrowIfNull("control");
action.ThrowIfNull("action");
if (!control.Created || control.IsDisposed || !control.IsHandleCreated) return;
control.BeginInvoke(action);
}
示例3: Invoke
/// <summary>
/// Invokes the specified action for this control.
/// </summary>
/// <param name="control">The control.</param>
/// <param name="action">The action.</param>
public static void Invoke(Control control, Action action)
{
control.ThrowIfNull("control");
action.ThrowIfNull("action");
if (!control.Created || control.IsDisposed || !control.IsHandleCreated) return;
try
{
control.Invoke(action);
}
catch (ObjectDisposedException ex)
{
logger.LogError("Control {0} disposed while trying to process an Invoke on it".InvariantFormat(control.Name));
logger.LogException(ex);
}
catch (InvalidOperationException ioe)
{
logger.LogError("Invalid operation exception triggered by {0} control while trying to invoke".InvariantFormat(control.Name));
logger.LogException(ioe);
}
}
示例4: TabOrderManager
/// <summary>
/// Constructor
/// </summary>
/// <param name="container">The container whose tab order we manage.</param>
public TabOrderManager(Control container)
{
container.ThrowIfNull("container");
_mainContainer = container;
}