private void RaiseOnProcessStart(string id, int processId) { if (cts.IsCancellationRequested) { return; } UpdateProcessId(id, processId); if (processes.TryGetValue(id, out var context) && context.Client != null) { taskManager .WithAsync(async ctx => { var client = ctx.Client; var data = new NotificationData( client.GetRemoteTarget <IProcessNotifications>(), RpcProcessEventArgs.Get(ctx.Process)); await data.notifications.ProcessOnStart(data.StartArgs); return(0); }, context, TaskAffinity.Custom) .Start(context.Notifications); } }
private void RaiseProcessOnStart(RpcProcessEventArgs args) { if (!wrappers.TryGetValue(args.Process.Id, out var list) || !schedulers.TryGetValue(args.Process.Id, out var scheduler)) { throw new InvalidOperationException( $"OnStart for process {args.Process.Id} was called but there's no record of it in the process list."); } foreach (var wrapper in list) { scheduler.Schedule(s => wrapper.OnProcessStart((RpcProcessEventArgs)s), args, cts.Token); } }
public void OnProcessStart(RpcProcessEventArgs args) { ProcessId = args.Process.ProcessId; RaiseOnStart(); }
public NotificationData(IProcessNotifications notifications, RpcProcessEventArgs args) { this.notifications = notifications; this.args = args; }
public Task ProcessOnStart(RpcProcessEventArgs args) { manager.RaiseProcessOnStart(args); return(Task.CompletedTask); }