private void MouseDownFocusLogTextBox(object sender, MouseButtonEventArgs e)
 {
     try
     {
         TextBoxLogFarmingPanel.Focus();
     }
     catch (Exception ex)
     {
         Common.ShowErrorMessageBox(ex);
     }
 }
        private void NotifySwitchChanges(HashSet <object> switches)
        {
            try
            {
                //Set focus to this so that virtual keypresses won't affect settings
                Dispatcher?.BeginInvoke((Action)(() => TextBoxLogFarmingPanel.Focus()));
                foreach (var farmingPanelKey in switches)
                {
                    var key = (FarmingPanelKey)farmingPanelKey;

                    if (_farmingSidePanel.ForwardPanelEvent)
                    {
                        if (!string.IsNullOrEmpty(_farmingSidePanel.GetKeyPressForLoggingPurposes(key)))
                        {
                            Dispatcher?.BeginInvoke(
                                (Action)
                                (() =>
                                 TextBoxLogFarmingPanel.Text =
                                     TextBoxLogFarmingPanel.Text.Insert(0, _farmingSidePanel.GetKeyPressForLoggingPurposes(key) + "\n")));
                        }
                    }
                    else
                    {
                        Dispatcher?.BeginInvoke(
                            (Action)
                            (() =>
                             TextBoxLogFarmingPanel.Text =
                                 TextBoxLogFarmingPanel.Text = TextBoxLogFarmingPanel.Text.Insert(0, "No action taken, panel events Disabled.\n")));
                    }
                }
                SetGraphicsState(switches);
            }
            catch (Exception ex)
            {
                Dispatcher?.BeginInvoke(
                    (Action)
                    (() =>
                     TextBoxLogFarmingPanel.Text = TextBoxLogFarmingPanel.Text.Insert(0, "0x16" + ex.Message + ".\n")));
                Common.ShowErrorMessageBox(ex);
            }
        }