public void PilotButton_Click(object sender, RoutedEventArgs e)
        {
            //_T();
            if (((ToggleButton)sender)?.IsChecked ?? false)
            {
                if (Pilot != null)
                {
                    Pilot.OnPilotReceive -= Pilot_OnReceive;
                    Pilot.Close();
                }

                Pilot = Pilot.Factory(PilotString);
                Pilot.OnPilotReceive += Pilot_OnReceive;
            }
            else
            {
                if (Pilot != null)
                {
                    Pilot.Close();
                    Pilot.OnPilotReceive -= Pilot_OnReceive;
                }
            }

            CommStatus = Pilot.CommStatus;
        }
 void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     Pilot?.Close();
     SaveVars();
 }