protected async Task NotifyExecutionAsync(params object[] eventArguments) { await OnBeforeNotifyExecution(); CallCount++; Executed?.Invoke(this, eventArguments); }
public void Rollback() { while (Executed.Count > 0) { try { Context.Current = Executed.Dequeue(); var undoable = Context.Current as ICanUndo; if (undoable != null) { undoable.Undo(); } } catch (Exception e) { if (Context.ErrorHandler != null) { Context.ErrorHandler.OnError(e); } } Unexecuted.Enqueue(Context.Current); } Context.State = TranscationStates.Cancelled; }
public void Execute(object parameter) { bool muted = ((AnimationTagRail)parameter).Muted; ((AnimationTagRail)parameter).Muted = !muted; Executed?.Invoke(this, parameter); }
/// <exception cref="DockerException"/> public async Task <string> ExecuteAsync(string command) { var processStartInfo = CreateProcessStartInfo(command); using var process = Process.Start(processStartInfo); Executed?.Invoke(this, $"docker {command}"); string output = await process.StandardOutput.ReadToEndAsync(); if (!string.IsNullOrEmpty(output)) { Output?.Invoke(this, output); } string error = await process.StandardError.ReadToEndAsync(); if (!string.IsNullOrEmpty(error)) { Error?.Invoke(this, error); } int exitCode = await process.WaitForExitAsync().ConfigureAwait(false); if (exitCode != 0) { throw new DockerException(error, process.ExitCode); } return(output); }
public void Begin(object parameters = null) { Context = new TranscationContext() { TranID = Guid.NewGuid(), State = TranscationStates.Executing }; while (Unexecuted.Count > 0) { try { Context.Current = Unexecuted.Dequeue(); Context.Current.Execute(parameters); } catch (Exception e) { if (Context.ErrorHandler != null) { Context.ErrorHandler.OnError(e); } } Executed.Enqueue(Context.Current); } }
public void Execute(object parameter = null) { Refresh(); _execute(parameter); Executed?.Invoke(this, parameter); Refresh(); }
public Int32 InsertRoutineExecuted(Executed ExecutedRoutine) { var maxPK = db.Table <Executed>().OrderByDescending(c => c.ID).FirstOrDefault(); if (maxPK != null) { rExecuted = new Executed() { ID = (maxPK == null ? 1 : (maxPK.ID + 1)), RoutineID = ExecutedRoutine.RoutineID, ExerciseID = ExecutedRoutine.ExerciseID, Date = ExecutedRoutine.Date, Reps = ExecutedRoutine.Reps, Sets = ExecutedRoutine.Sets, lbs = ExecutedRoutine.lbs }; } else { db.CreateTable <Executed>(); rExecuted = new Executed() { ID = 0, RoutineID = ExecutedRoutine.RoutineID, ExerciseID = ExecutedRoutine.ExerciseID, Date = ExecutedRoutine.Date, Reps = ExecutedRoutine.Reps, Sets = ExecutedRoutine.Sets, lbs = ExecutedRoutine.lbs }; } return(DataLinkLayer.DBinsert <Executed>(rExecuted)); }
private void OnExecuted(JobInfo jobInfo) { Executed?.Invoke(this, new JobOperationEventArgs { Job = jobInfo }); }
protected void OnExecuted() { if (Executed != null) { Executed.Invoke(this, new EventArgs()); } }
/// <summary> /// Returns true if Action instances are equal /// </summary> /// <param name="other">Instance of Action to be compared</param> /// <returns>Boolean</returns> public bool Equals(Action other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Index == other.Index || Index.Equals(other.Index) ) && ( Type == other.Type || Type.Equals(other.Type) ) && ( Executed == other.Executed || Executed.Equals(other.Executed) ) && ( Requestor == other.Requestor || Requestor.Equals(other.Requestor) )); }
public BLRoutineShow() { db = DataLinkLayer.DBconnect(); bLPlanned = new BLPlanned(); bLExecuted = new BLExecuted(); Executed executed = new Executed() { ID = 1, RoutinePlannedID = 0, RoutineID = 0, ExerciseID = 0, Date = "01:01:01", Reps = "0", Sets = 2, lbs = "0" }; // db.CreateTable<Executed>(); //bLExecuted.InsertRoutineExecuted(executed); //db.DropTable<Exercise>(); //db.CreateTable<Exercise>(); //BLExercise bl = new BLExercise(); //bl.InsertExcercise(new Exercise()); //db.DropTable<Routine>(); //db.CreateTable<Routine>(); //BLRoutine bL = new BLRoutine(); //bL.InsertRoutine(new Routine()); //db.DropTable<Planned>(); //db.CreateTable<Planned>(); }
public void Execute(object parameter) { var selectedWindowEntry = _getEntryAt(int.Parse((string)parameter) - 1); selectedWindowEntry?.Select(); Executed?.Invoke(this, new EventArgs()); }
protected void InvokeExecuted(CommandEventArgs args) { // Вызвать все события ThreadManager.Instance.InvokeUI((arg) => { Executed?.Invoke(this, arg); }, args); }
/// <summary> /// Raises the <see cref="Executed" /> event. /// </summary> /// <param name="parameter">The parameter.</param> /// <returns>Task.</returns> protected virtual void RaiseExecuted(object parameter) { var action = new Action(() => { var eventArgs = new CommandExecutedEventArgs(this, parameter); Executed?.Invoke(this, eventArgs); }); AutoDispatchIfRequired(action); }
/// <summary> /// Raises the Executed event and clears the operation cache. /// </summary> /// <param name="e">The ExecutableEventArgs.</param> protected virtual void OnExecuted(ExecutableEventArgs e) { if (clearCache && e.Executable is IOperation operation) { OperationCache cache = new OperationCache(operation); cache.Clear(); } Executed?.Invoke(this, e); }
public override void Invoke() { if ((Execute || ExecuteOnLoad && Wrapper.LoadedFrame) && !WasExecuted(Wrapper.BrowserId)) { OnBeforeExecute?.Invoke(this, Wrapper); Operation(Wrapper); Executed.UpdateGeneric(Wrapper.BrowserId, true); OnAfterExecute?.Invoke(this, Wrapper); } }
public void Run() { OnExecuting?.Invoke(this, new SimulatorEventArgs(_args)); foreach (var battery in _args.Batteries) { Discharge(battery, _args.GetDischargeCurrent(battery.Uid), _args.CycleDuration); } Executed?.Invoke(this, new SimulatorEventArgs(_args)); }
private void OnExecuted() { try { Executed?.Invoke(this, EventArgs.Empty); } catch (Exception) { // ignored } }
/// <summary> /// Raises the <see cref="Executed" /> event. /// </summary> /// <param name="parameter">The parameter.</param> /// <returns>Task.</returns> protected Task RaiseExecutedAsync(object parameter) { var action = new Func <Task>(async() => { var eventArgs = new CommandExecutedEventArgs(this, parameter); Executed.SafeInvoke(this, eventArgs); await ExecutedAsync.SafeInvokeAsync(this, eventArgs); }); return(AutoDispatchIfRequiredAsync(action)); }
/// <summary> /// UnExecutes the command /// </summary> public void UnExecute() { if (type == typeof(Vertex)) { target.VerticesColor = oldColor; } else { target.ArcsColor = oldColor; } Executed?.Invoke(oldColor, null); }
/// <summary> /// Исполнение /// </summary> /// <param name="parameter">Параметр</param> public void Execute(object parameter) { try { _execute(parameter); Executed?.Invoke(this, new EventArgs()); } catch (Exception exception) { _exceptionAction(exception); } }
protected override void OnTouchTap(TouchEventArgs args) { base.OnTouchTap(args); EventArgs e = EventArgsPool.Instance.Take(); OnExecuted(e); Executed?.Invoke(this, e); EventArgsPool.Instance.Release(e); args.Handled = true; }
/// <summary> /// Wird aufgerufen, wenn mit der linken Maustaste auf das Steuerelement geklickt wird. /// </summary> /// <param name="args">Weitere Informationen zum Ereignis.</param> protected override void OnLeftMouseClick(MouseEventArgs args) { base.OnLeftMouseClick(args); EventArgs e = EventArgsPool.Instance.Take(); OnExecuted(e); Executed?.Invoke(this, e); EventArgsPool.Instance.Release(e); args.Handled = true; }
public void Run() { OnExecuting?.Invoke(this, new SimulatorEventArgs(_args)); if (!_args.NetworkOutdated) { return; } CalculateDistances(); CalculateOrientations(); _args.NetworkOutdated = false; Executed?.Invoke(this, new SimulatorEventArgs(_args)); }
public void Execute(object parameter) { try { _executing = true; CanExecuteChanged?.Invoke(this, new EventArgs()); Executed?.Invoke(parameter); } finally { _executing = false; CanExecuteChanged?.Invoke(this, new EventArgs()); } }
/// <inheritdoc /> /// <summary> /// Executes the command from the specified caster. /// </summary> /// <param name="caster">The caster.</param> /// <param name="args">The arguments.</param> public void Execute(ICharacterSpawn caster, params string[] args) { ExecutingCommandEventArgs executingCommandEventArgs = new ExecutingCommandEventArgs(caster, args); Executing?.Invoke(this, executingCommandEventArgs); if (executingCommandEventArgs.Cancel) { return; } ExecuteCommand(executingCommandEventArgs.Caster, executingCommandEventArgs.Args); ExecutedCommandEventArgs executedCommandEventArgs = new ExecutedCommandEventArgs(executingCommandEventArgs.Caster, executingCommandEventArgs.Args); Executed?.Invoke(this, executedCommandEventArgs); }
/// <summary> /// Wird aufgrefufen, wenn eine Taste gedrückt wird. /// </summary> /// <param name="args">Ein <see cref="KeyEventArgs"/>-Objekt mit weiteren Informationen zum Event</param> protected override void OnKeyPress(KeyEventArgs args) { base.OnKeyPress(args); if (Focused == TreeState.Active && (args.Key == Keys.Enter || args.Key == Keys.Space)) { EventArgs e = EventArgsPool.Instance.Take(); OnExecuted(e); Executed?.Invoke(this, e); EventArgsPool.Instance.Release(e); args.Handled = true; } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; // Suitable nullity checks etc, of course :) hashCode = hashCode * 59 + Index.GetHashCode(); hashCode = hashCode * 59 + Type.GetHashCode(); hashCode = hashCode * 59 + Executed.GetHashCode(); hashCode = hashCode * 59 + Requestor.GetHashCode(); return(hashCode); } }
// The command execution. void ICommand.Execute(object parameter) { Executing?.Invoke(this, EventArgs.Empty); Action action = _action; Action <object> parameterizedAction = _parameterizedAction; if (action != null) { action(); } else { parameterizedAction?.Invoke(parameter); } Executed?.Invoke(this, EventArgs.Empty); }
public void ExecutePlugins(IFrame frame, PluginEnvironment environment, bool includeDisabled) { if (includeDisabled) { ScriptLoader.ExecuteScript(frame, PluginScriptGenerator.GenerateConfig(Config), "gen:pluginconfig"); } List <string> failedPlugins = new List <string>(1); foreach (Plugin plugin in Plugins) { string path = plugin.GetScriptPath(environment); if (string.IsNullOrEmpty(path) || (!includeDisabled && !Config.IsEnabled(plugin)) || !plugin.CanRun) { continue; } string script; try{ script = File.ReadAllText(path); }catch (Exception e) { failedPlugins.Add(plugin.Identifier + " (" + Path.GetFileName(path) + "): " + e.Message); continue; } int token; if (tokens.ContainsValue(plugin)) { token = GetTokenFromPlugin(plugin); } else { token = GenerateToken(); tokens[token] = plugin; } ScriptLoader.ExecuteScript(frame, PluginScriptGenerator.GeneratePlugin(plugin.Identifier, script, token, environment), "plugin:" + plugin); } Executed?.Invoke(this, new PluginErrorEventArgs(failedPlugins)); }
protected void UnaryOperator_CreateExecutedSupport(StillOneScriptCore.EntityModel.CustomFunctionModel.Support.ExecutedFunctionContext context, Executed.UnaryOperator item) { item.Left = mLeft.CreateExecuted(context); }