public void OnMessageReceived(WCFServiceReference.OSAEWCFMessage message) { logging.AddToLog("Message received: " + message.Type + " - " + message.Message, false); //this.Invoke((MethodInvoker)delegate //{ switch (message.Type) { case WCFServiceReference.OSAEWCFMessageType.PLUGIN: string[] split = message.Message.Split('|'); bool enabled = false; if (split[1].Trim() == "True") enabled = true; foreach (PluginDescription plugin in pluginList) { if ((plugin.Type == split[5].Trim() && Common.ComputerName == split[6].Trim()) || plugin.Name == split[0].Trim()) { plugin.Status = split[3].Trim(); plugin.Enabled = enabled; plugin.Name = split[0].Trim(); if (split[4].Trim() != "") plugin.Upgrade = split[4].Trim(); else plugin.Upgrade = ""; logging.AddToLog("updated plugin: " + plugin.Name + "|" + plugin.Version + "|" + plugin.Upgrade + "|" + plugin.Status + "| " + plugin.Enabled.ToString(), true); break; } } break; case WCFServiceReference.OSAEWCFMessageType.CMDLINE: string[] param = message.Message.Split('|'); if (param[2].Trim() == Common.ComputerName) { Process pr = new Process(); pr.StartInfo.FileName = param[0].Trim(); pr.StartInfo.Arguments = param[1].Trim(); pr.Start(); } break; case WCFServiceReference.OSAEWCFMessageType.SERVICE: string[] serv = message.Message.Split('|'); if (serv[0] != serv[1] && txblNewVersion.Visibility == Visibility.Hidden) { ShowNewVersion("Version " + serv[1] + " Available"); } break; } //}); }
private void messageHost(WCFServiceReference.OSAEWCFMessageType msgType, string message) { try { if (wcfObj.State == CommunicationState.Opened) wcfObj.messageHost(msgType, message, osae.ComputerName); else { if (connectToService()) wcfObj.messageHost(msgType, message, osae.ComputerName); } } catch (Exception ex) { logging.AddToLog("Error messaging host: " + ex.Message, true); } }