Ejemplo n.º 1
0
    public override int Run(EmptyCommandOptions options, InvocationContext context)
    {
        ActivityEngine.Dispatch(new DetectAgentsActivity(AgentsDetector));

        EventEngine.On <AgentsDetectedEvent>(detectionEvent =>
        {
            FormatAndWriteToConsole(detectionEvent.AgentsAndLocations ?? new Dictionary <string, string>());
        });

        ActivityEngine.Wait();

        return(0);
    }
Ejemplo n.º 2
0
    private int WaitForCacheDestroyEvents(InvocationContext context)
    {
        var exitCode = true.ToExitCode();

        EventEngine.On <CacheDestroyFailedEvent>(destroyEvent =>
        {
            context.Console.Error.WriteLine(destroyEvent.ResultMessage);
            exitCode = false.ToExitCode();
        });

        EventEngine.On <CacheDestroyedEvent>(destroyEvent => { exitCode = destroyEvent.ExitCode; });

        ActivityEngine.Wait();

        return(exitCode);
    }