Пример #1
0
 private void menuItemCreateMQTTEvent_Click(object sender, EventArgs e)
 {
     if (mouseLocation != null)
     {
         int row = mouseLocation.RowIndex;
         dataGridView1.Rows[row].Selected = true;
         MQTTMessage msg = (MQTTMessage)dataGridView1.Rows[row].DataBoundItem;
         CreateMQTTEvent(msg.Topic, msg.Message);
     }
 }
Пример #2
0
 private void MqttClient_MqttMsgPublishReceived(object sender, uPLibrary.Networking.M2Mqtt.Messages.MqttMsgPublishEventArgs e)
 {
     // This callback is on a different thread
     dataGridView1.Invoke(new Action(() =>
     {
         System.Diagnostics.Debug.WriteLine("Got msg: " + e.Topic + " " + e.Message.ToString());
         MQTTMessage msg           = new MQTTMessage(e.Topic, Encoding.ASCII.GetString(e.Message));
         int index                 = mqttMessages.Add(msg);
         dataGridView1.CurrentCell = dataGridView1.Rows[index].Cells[0];
     }));
 }