/// <summary> /// Executes the result using the specified context. /// </summary> /// <param name="context">The context.</param> public void Execute(ActionExecutionContext context) { // Zugriff auf Parameter wie in folgenden Zeilen: // Parameter parameter = context.Message.Parameters[0]; // Bakup(parameter.Value); Backup(); }
/// <summary> /// Executes the result using the specified context. /// </summary> /// <param name="context">The context.</param> public void Execute(ActionExecutionContext context) { if(DialogResponse.OK == DialogService.ShowMessage(Message, Title, DialogButtons , DialogImage)) { Completed(this, new ResultCompletionEventArgs{ WasCancelled = false }); } else { Completed(this, new ResultCompletionEventArgs(){ WasCancelled = true, Error = new InvalidOperationException("Das geht ja gaaar nicht...") }); DialogService.ShowMessage("Der Vorgang wurde abgebrochen", "Benutzerabruch", DialogButton.OK, DialogImage.Information); } }
/// <summary> /// Executes a coroutine. /// </summary> /// <param name="coroutine">The coroutine to execute.</param> /// <param name="context">The context to execute the coroutine within.</param> /// /// <param name="callback">The completion callback for the coroutine.</param> public static void BeginExecute(IEnumerator<IResult> coroutine, ActionExecutionContext context = null, EventHandler<ResultCompletionEventArgs> callback = null) { Log.Info("Executing coroutine."); var enumerator = CreateParentEnumerator(coroutine); IoC.BuildUp(enumerator); if (callback != null) enumerator.Completed += callback; enumerator.Completed += Completed; enumerator.Execute(context ?? new ActionExecutionContext()); }
/// <summary> /// Determines the parameters that a method should be invoked with. /// </summary> /// <param name="context">The action execution context.</param> /// <param name="requiredParameters">The parameters required to complete the invocation.</param> /// <returns>The actual parameter values.</returns> public static object[] DetermineParameters(ActionExecutionContext context, ParameterInfo[] requiredParameters) { var providedValues = context.Message.Parameters.Select(x => x.Value).ToArray(); var finalValues = new object[requiredParameters.Length]; for (int i = 0; i < requiredParameters.Length; i++) { var parameterType = requiredParameters[i].ParameterType; var parameterValue = providedValues[i]; var parameterAsString = parameterValue as string; if (parameterAsString != null) finalValues[i] = CoerceValue(parameterType, EvaluateParameter(parameterAsString, parameterType, context)); else finalValues[i] = CoerceValue(parameterType, parameterValue); } return finalValues; }
/// <summary> /// Executes the result using the specified context. /// </summary> /// <param name="context">The context.</param> public void Execute(ActionExecutionContext context) { this.context = context; ChildCompleted(null, new ResultCompletionEventArgs()); }