public void Post(Message message) { lock (_writer) { Trace.TraceInformation("[ProcessingQueue]: Post({0})", message); _writer.Write(JsonConvert.SerializeObject(message)); } }
public void InitProject(int id, string path) { var payload = new Outgoing.InitializeMessage { ProjectFolder = path, TargetFramework = "net45" }; var msg = new Message { ContextId = id, HostId = _hostId, MessageType = "Initialize", Payload = JToken.FromObject(payload) }; if (_host != null) _host.Post(msg); }
private void OnReceive(Message obj) { switch (obj.MessageType) { case "Configurations": var configurations = obj.Payload.ToObject<Incomming.ConfigurationsMessage>(); OnConfigurations(new ConfigurationsEventArgs(obj.ContextId, configurations)); break; case "References": var references = obj.Payload.ToObject<Incomming.ReferencesMessage>(); OnReferences(new ReferencesEventArgs(obj.ContextId, references)); break; default: if (Debugger.IsAttached) Debugger.Break(); break; } }
private void OnReceive(Message obj) { switch (obj.MessageType) { case "Configurations": var configurations = obj.Payload.ToObject<Incomming.ConfigurationsMessage>(); OnConfigurations(new ConfigurationsEventArgs(obj.ContextId, configurations)); break; case "References": var references = obj.Payload.ToObject<Incomming.ReferencesMessage>(); OnReferences(new ReferencesEventArgs(obj.ContextId, references)); break; case "Diagnostics": var diagnostics = obj.Payload.ToObject<Incomming.DiagnosticsMessage>(); OnDiagnostics(new DiagnosticsEventArgs(obj.ContextId, diagnostics)); break; case "Sources": var sources = obj.Payload.ToObject<Incomming.SourcesMessage>(); OnSources(new SourcesEventArgs(obj.ContextId, sources)); break; case "Error": var error = obj.Payload.ToObject<Incomming.ErrorMessage>(); OnError(new HostErrorEventArgs(obj.ContextId, error)); break; default: if (Debugger.IsAttached) Debugger.Break(); break; } }