//checkBluetooth checks if bluetooth is enabled on the current device. private void checkBluetooth() { if (!(BluetoothRadio.IsSupported)) { EnableBluetoothForm enableBTForm = new EnableBluetoothForm(); enableBTForm.Show(); enableBTForm.Activate(); } }
//The begin button's onClick. Starts bluetoothThread if it has not been started already. private void button1_Click(object sender, EventArgs e) { //Checks to see if Bluetooth is enabled. if (!(BluetoothRadio.IsSupported)) { EnableBluetoothForm enableBTForm = new EnableBluetoothForm(); enableBTForm.Show(); enableBTForm.Activate(); } else if (startedTransfer != true) { this.transferMessage.Text = "Starting Transfer"; this.beginButton.Enabled = false; this.beginButton.Visible = false; centerText(this.transferMessage); this.transferProgressBar.Visible = true; this.progressMessage.Visible = true; bluetoothThread = new Thread(new ThreadStart(doTransfer)); bluetoothThread.Start(); startedTransfer = true; } }