Esempio n. 1
0
 /// <summary>
 /// Receive event for the MQTT topics
 /// </summary>
 /// <param name="sender">Sender.</param>
 /// <param name="e">E.</param>
 private void client_MqttMsgPublishReceived(object sender, MqttMsgPublishEventArgs e)
 {
     try {
         InfoItem item = InfoItemFactory.createInfoItem(e.Topic, e.Message);
         item.updateGui(this.mainWindow);
     }
     catch (MqttMessageParsingException exception) {
         Console.WriteLine(exception.Message);
     }
 }
        public static InfoItem createInfoItem(string topic, byte[] message)
        {
            switch (topic)
            {
            case "/news":
                return(InfoItemFactory.createNewsItemFromMessage(message));

            default:
                throw new NotImplementedException();
            }
        }