本文整理汇总了C#中System.Action.ThrowIfNull方法的典型用法代码示例。如果您正苦于以下问题:C# Action.ThrowIfNull方法的具体用法?C# Action.ThrowIfNull怎么用?C# Action.ThrowIfNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Action
的用法示例。
在下文中一共展示了Action.ThrowIfNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MessageInputHandler
public MessageInputHandler(WorldInstance worldInstance, MessageRendererState messageRendererState, TimeSpan totalTime, Action<IXnaGameTime> messageClosingDelegate)
{
worldInstance.ThrowIfNull("worldInstance");
messageRendererState.ThrowIfNull("messageRendererState");
messageClosingDelegate.ThrowIfNull("messageClosingDelegate");
_worldInstance = worldInstance;
_messageRendererState = messageRendererState;
_messageClosingDelegate = messageClosingDelegate;
_answerKeyboardStateHelper = new KeyboardStateHelper(
KeyDown,
null,
null,
TextAdventure.Xna.Constants.MessageRenderer.Input.AcceptKey,
TextAdventure.Xna.Constants.MessageRenderer.Input.NextAnswerKey,
TextAdventure.Xna.Constants.MessageRenderer.Input.PreviousAnswerKey);
_scrollKeyboardStateHelper = new KeyboardStateHelper(
_scrollKeyboardRepeatHelper,
TextAdventure.Xna.Constants.MessageRenderer.Input.ScrollUpKey,
TextAdventure.Xna.Constants.MessageRenderer.Input.ScrollDownKey,
TextAdventure.Xna.Constants.MessageRenderer.Input.HomeKey,
TextAdventure.Xna.Constants.MessageRenderer.Input.EndKey,
TextAdventure.Xna.Constants.MessageRenderer.Input.PageUpKey,
TextAdventure.Xna.Constants.MessageRenderer.Input.PageDownKey);
_scrollKeyboardRepeatHelper.InitialInterval = TextAdventure.Xna.Constants.MessageRenderer.Input.ScrollKeyboardInterval;
_scrollKeyboardRepeatHelper.RepeatingInterval = TextAdventure.Xna.Constants.MessageRenderer.Input.ScrollKeyboardInterval;
}
示例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: CssCommentaryInterpreter
public CssCommentaryInterpreter(Action<Int32, Int32> onOpen, Action<String, Int32, Int32> onClose)
{
onOpen.ThrowIfNull("onOpen");
onClose.ThrowIfNull("onClose");
this.onOpen = onOpen;
this.onClose = onClose;
}
示例4: ReactiveCommand
public ReactiveCommand(
Action<object> execute,
Func<object, bool> canExecute,
params INotifyPropertyChanged[] canExecuteNotifiers)
{
_execute = execute.ThrowIfNull();
_canExecute = canExecute.ThrowIfNull();
_canExecuteNotifiers = canExecuteNotifiers;
_canExecuteNotifiers.ForEach(x => x.SubscribeWeakly(this, (c, s, e) => c.NotifyCanExecuteChanged()));
}
示例5: WeakAction
public WeakAction(Action action)
{
action.ThrowIfNull("action");
_method = action.GetMethodInfo();
if (action.GetMethodInfo().IsStatic)
{
_staticAction = action;
}
if (action.Target != null)
{
_actionTargetReference = new WeakReference(action.Target);
}
}
示例6: MessageFadeOutAndScaleUpdater
public MessageFadeOutAndScaleUpdater(MessageRendererState messageRendererState, TimeSpan totalTime, Action completeDelegate)
{
messageRendererState.ThrowIfNull("messageRendererState");
completeDelegate.ThrowIfNull("completeDelegate");
if (totalTime < TimeSpan.Zero)
{
throw new ArgumentOutOfRangeException("totalTime");
}
_messageRendererState = messageRendererState;
_completeDelegate = completeDelegate;
_timedLerpHelper = new TimedLerpHelper(totalTime, TextAdventure.Xna.Constants.MessageRenderer.FadeOutDuration, 1f, 0f);
}
示例7: TimerHelper
public TimerHelper(TimeSpan startTotalTime, TimeSpan duration, Action completedDelegate)
{
completedDelegate.ThrowIfNull("completedDelegate");
if (startTotalTime < TimeSpan.Zero)
{
throw new ArgumentOutOfRangeException("startTotalTime");
}
if (duration < TimeSpan.Zero)
{
throw new ArgumentOutOfRangeException("duration");
}
_duration = duration;
_startTotalTime = startTotalTime;
_completedDelegate = completedDelegate;
}
示例8: 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);
}
}
示例9: Transaction
private void Transaction(Action<IDbConnection, IDbTransaction> action)
{
action.ThrowIfNull("action");
using(var conn = this.GetConnection()) {
using(var tx = conn.BeginTransaction()) {
try {
action(conn, tx);
tx.Commit();
} catch {
tx.Rollback();
throw;
}
}
}
}
示例10: RelayCommand
public RelayCommand(Action<object> execute, Predicate<object> canExecute)
{
this.execute = execute.ThrowIfNull();
this.canExecute = canExecute;
}
示例11: RelayCommand
public RelayCommand(Action<object> execute, Predicate<object> canExecute)
{
execute.ThrowIfNull("execute");
_execute = execute; _canExecute = canExecute;
}
示例12: DelegateAuthenticator
/// <summary>
/// Creates a new DelegateAuthenticator.
/// </summary>
/// <param name="modifyRequest">Delegate used to modify the webrequest.</param>
public DelegateAuthenticator(Action<HttpWebRequest> modifyRequest)
{
modifyRequest.ThrowIfNull("modifyRequest");
ModifyRequestDelegate = modifyRequest;
}
示例13: OnDisposeAction
/// <summary>
/// Initializes a new instance of the <see cref="Disposable"/> class.
/// </summary>
/// <param name="action">The action.</param>
public OnDisposeAction(Action action)
{
action.ThrowIfNull("action");
Action = action;
}
示例14: Command
public Command(Action<object> action, Predicate<object> canExecute)
{
this.action = action.ThrowIfNull("Command : action null");
this.canExecute = canExecute.ThrowIfNull("Command : canExecute null");
}
示例15: Command
public Command(Action<object> action, Predicate<object> canExecute = null)
{
this.action = action.ThrowIfNull("Command : action null");
this.canExecute = canExecute;
this.isEnabled = true;
}