public void Disconnect_Click(object sender, RoutedEventArgs e)
 {
     this.breakresponse.Stop();
     this.autorespond.Stop();
     if (!this.UserProgStart.IsEnabled)
     {
         this.WriteSerialData(OBD.ResetPCM(), false);
         Thread.Sleep(100);
     }
     this.WriteSerialData(OBD.AVTRestart(), true);
     MainWindow._serialPort.Close();
     this.resetoptions();
     this.consolemessage("Serial port closed");
 }
 private void ResetPCM_Click(object sender, RoutedEventArgs e)
 {
     if (this.searchforframe != "PCM_READY")
     {
         this.consolemessage("PCM busy/not in flash mode");
         return;
     }
     if (MessageBox.Show("Exit flash mode and reset, are you sure?", "Confirm", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes) != MessageBoxResult.Yes)
     {
         this.consolemessage("Reset cancelled");
         return;
     }
     this.rxserialbuffer = null;
     this.WriteSerialData(OBD.ResetPCM(), false);
     Thread.Sleep(100);
     this.WriteSerialData(OBD.AVTNormalSpeed(), true);
     this.Serialout.Clear();
     this.searchforframe = "VERIFY_EXIT";
 }