private void NotifyButtonChanges(HashSet <object> buttons) { try { //Set focus to this so that virtual keypresses won't affect settings Dispatcher?.BeginInvoke((Action)(() => TextBoxLogStreamDeck.Focus())); foreach (var button in buttons) { var streamDeckButton = (StreamDeckButton)button; if (_streamDeckPanel.ForwardPanelEvent) { if (!string.IsNullOrEmpty(_streamDeckPanel.GetKeyPressForLoggingPurposes(streamDeckButton))) { Dispatcher?.BeginInvoke( (Action) (() => TextBoxLogStreamDeck.Text = TextBoxLogStreamDeck.Text.Insert(0, _streamDeckPanel.GetKeyPressForLoggingPurposes(streamDeckButton) + "\n"))); } } else { Dispatcher?.BeginInvoke( (Action) (() => TextBoxLogStreamDeck.Text = TextBoxLogStreamDeck.Text.Insert(0, "No action taken, panel events Disabled.\n"))); } } } catch (Exception ex) { Dispatcher?.BeginInvoke((Action)(() => Common.ShowErrorMessageBox(ex))); } }