/// <summary>
 /// Enable/Set focus on Config tab
 /// </summary>
 /// <param name="sender">Event source</param>
 /// <param name="e">Event arguments</param>
 private void menuConfig_Click(object sender, RoutedEventArgs e)
 {
     Configuration config = new Configuration();
     if (config.ShowDialog() == true)
     {
         if (Bluetooth != null)
         {
             Bluetooth.Close();
         }
         Bluetooth = new BluetoothDevice(Configuration.OutgoingPort, Configuration.OutgoingBaudrate);
         if (Bluetooth.Open() == 0)
         {
             MessageBox.Show("Bluetooth connetion fail.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
 } 
 /// <summary>
 /// Check for configuration
 /// </summary>
 /// <returns></returns>
 public bool CheckConfig() 
 {
     if (Configuration.Initiated) return true;
     MessageBoxResult result = MessageBox.Show("No Configuration was made. \nDo you want to config now?", "Configuration required", MessageBoxButton.YesNo,
                     MessageBoxImage.Question);
     if (result == MessageBoxResult.Yes)
     {
         Configuration config = new Configuration();
         if (config.ShowDialog() == true)
         {
             Bluetooth = new BluetoothDevice(Configuration.OutgoingPort, Configuration.OutgoingBaudrate);
             if (Bluetooth.Open() == 1)
             {
                 return true;
             }
             MessageBox.Show("Bluetooth connetion fail.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
             Configuration.Initiated = false;
         }
     }
     return false;
 }
 /// <summary>
 /// Check for configuration
 /// </summary>
 /// <returns></returns>
 public bool CheckConfig() 
 {
     if (Configuration.Initiated) return true;
     MessageBoxResult result = MessageBox.Show("No Configuration was made. \nDo you want to config now?", "Configuration required", MessageBoxButton.YesNo,
                     MessageBoxImage.Question);
     if (result == MessageBoxResult.Yes)
     {
         Configuration config = new Configuration();
         if (config.ShowDialog() == true)
         {
             Bluetooth = new BluetoothDevice(Configuration.OutgoingPort, Configuration.OutgoingBaudrate);
             //Bluetooth.ComPort.DataReceived += (sender,args) =>
             //{
             //    MessageBox.Show(Bluetooth.ComPort.ReadByte().ToString());
             //};
             if (Bluetooth.Open() == 1)
             {
                 return true;
             }
             MessageBox.Show("Bluetooth connetion fail.");
             Configuration.Initiated = false;
         }
     }
     return false;
 }