示例#1
0
        private void Broadcast(JObject json)
        {
            string type = json["type"].ToString();

            switch (type)
            {
            case "cluster_created":
                OnClusterCreated?.Invoke(this, json.ToObject <ClusterEventArgs <ClusterCreated> >());
                break;

            case "processing_started":
                OnProcessingStarted?.Invoke(this, json.ToObject <ClusterEventArgs <ProcessingStarted> >());
                break;

            case "job_status_changed":
                OnJobStatusChanged?.Invoke(this, json.ToObject <ClusterEventArgs <JobStatusChanged> >());
                break;

            case "processing_done":
                OnProcessingDone?.Invoke(this, json.ToObject <ClusterEventArgs <ProcessingDone> >());
                break;

            case "cluster_finalized":
                OnClusterFinalized?.Invoke(this, json.ToObject <ClusterEventArgs <ClusterFinalized> >());
                break;

            case "log_message":
                OnLogMessage?.Invoke(this, json.ToObject <ClusterEventArgs <LogMessage> >());
                break;

            default:
                break;
            }
        }
 void SendJobStatus(int index, JobStatus status)
 {
     OnJobStatusChanged?.Invoke(
         this,
         new ClusterEventArgs <JobStatusChanged>(
             DateTime.Now,
             new JobStatusChanged(index, status)));
 }