public void Execute(object parameter) { if (ExecuteAction != null) { ExecuteAction.Invoke(parameter); } }
public void Execute(object parameter) { if (ExecuteAction == null) { return; } ExecuteAction.Invoke(parameter); }
public async void Execute(object parameter) { if (CanExecute(parameter)) { ExecuteAction?.Invoke(parameter); await ExecuteAsync(parameter); } }
/// <summary> /// Execute command /// </summary> public DebugCommandStatus Execute(string[] args) { if (ExecuteAction == null) { return(DebugCommandStatus.ACTION_IS_NULL_ERROR); } return(ExecuteAction.Invoke(this, args)); }
public void Execute(object parameter) { if (parameter == null) { ExecuteAction?.Invoke(); } else { ExecuteActionArg?.Invoke(parameter); } }
public void Execute(object parameter) { if (ExecuteAction is null) { return; } if (ConvertToType(parameter, out var convertedValue)) { ExecuteAction?.Invoke(convertedValue); } }
private int Execute(ExecuteAction executeAction, Action <Exception> notifyAction) { int result = -1; if (ExceptionHandled) { try { result = executeAction.Invoke(); } catch (Exception ex) { notifyAction.Invoke(ex); } } else { result = executeAction.Invoke(); notifyAction.Invoke(null); } return(result); }
public void Execute(Object parameter) { if (ExecuteAction is not null) { ExecuteAction.Invoke(); return; } if (ExecuteActionWithParameter is not null) { ExecuteActionWithParameter.Invoke(parameter); return; } }
private void ProcessOperations() { while (_actions.Count > 0 && _actions.FindMin().DueTime <= Clock.Now) { var scheduledTask = _actions.DeleteMin(); // Check if we should fire the action. var args = new ActionSchedulerEventArgs(); args.State = scheduledTask.State; ExecuteAction?.Invoke(this, args); if (!args.RescheduleAt.HasValue) { scheduledTask.Action(scheduledTask.State); } else // Reschedule { ScheduleAction(args.RescheduleAt.Value, scheduledTask.State, scheduledTask.Action); } } }
public void Execute(object parameter) { ExecuteAction?.Invoke(parameter); }
public void Execute(Object parameter) => ExecuteAction?.Invoke((T)parameter);
public virtual void Execute(object parameter) { Action A = () => { #if DEBUG execInTry = false; #endif if (execInTry) { try { if (UseTask && OnTaskStart != null) { System.Windows.Application.Current.Dispatcher.Invoke(OnTaskStart, parameter); } ExecuteAction?.Invoke(parameter); if (UseTask && OnTaskEnd != null) { System.Windows.Application.Current.Dispatcher.Invoke(OnTaskEnd, parameter); } } catch (Exception ex) { System.Windows.Application.Current.Dispatcher.Invoke((() => { MessageBox.Show(ex.Message, this.ToString(), MessageBoxButton.OK, MessageBoxImage.Error); })); } finally { try { finaly?.Invoke(); } catch (Exception ex) { System.Windows.Application.Current.Dispatcher.Invoke(() => { MessageBox.Show(ex.Message, this.ToString(), MessageBoxButton.OK, MessageBoxImage.Error); }); } } } else { if (UseTask && OnTaskStart != null) { System.Windows.Application.Current.Dispatcher.Invoke(OnTaskStart, parameter); } ExecuteAction?.Invoke(parameter); if (UseTask && OnTaskEnd != null) { System.Windows.Application.Current.Dispatcher.Invoke(OnTaskEnd, parameter); } finaly?.Invoke(); } }; if (UseTask) { Task.Factory.StartNew(A); } else { A(); } }