示例#1
0
 public void Post(Message message)
 {
     lock (_writer)
     {
         Trace.TraceInformation("[ProcessingQueue]: Post({0})", message);
         _writer.Write(JsonConvert.SerializeObject(message));
     }
 }
示例#2
0
文件: Host.cs 项目: khellang/Runt
        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);
        }
示例#3
0
文件: Host.cs 项目: khellang/Runt
        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;
            }
        }
示例#4
0
文件: Host.cs 项目: Runt-Editor/Runt
        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;
            }
        }