private void Fhem_client_FHEMMessageEvent(object sender, FHEMMessageEventArgs e) { if (e.Device == settings.FHEM_status_dev + "-StreamDeckValue") { Console.WriteLine("> received this message: {0} - {1} - {2}", e.Device, e.Value1, e.Value2); Connection.SetTitleAsync(e.Value1); } }
void OnFHEMMessageEvent(FHEMMessageEventArgs e) { // Make a temporary copy of the event to avoid possibility of // a race condition if the last subscriber unsubscribes // immediately after the null check and before the event is raised. EventHandler <FHEMMessageEventArgs> handler = FHEMMessageEvent; // Event will be null if there are no subscribers if (handler != null) { // Use the () operator to raise the event. handler(this, e); } }