private void sendFileButton_Click(object sender, EventArgs e)
        {
            if (device == null)
            {
                MessageBox.Show("Nie wybrano urządzenia!!!");
                return;
            }

            OpenFileDialog ofd = new OpenFileDialog();

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                device.Update();
                device.Refresh();
                device.SetServiceState(BluetoothService.ObexObjectPush, true);

                var file    = ofd.FileName;
                var uri     = new Uri("obex://" + device.DeviceAddress + "/" + file);
                var request = new ObexWebRequest(uri);
                request.ReadFile(file);

                ObexWebResponse response = null;
                try
                {
                    response = (ObexWebResponse)request.GetResponse();
                    MessageBox.Show(response.StatusCode.ToString());
                    response.Close();
                }catch (Exception)
                {
                    // check response.StatusCode
                    MessageBox.Show("Urządzenie nie odpowiedziło");
                }
            }
        }
Exemple #2
0
        private void btnBeam_Click(object sender, System.EventArgs e)
        {
            if (cbDevices.SelectedIndex > -1)
            {
                IrDADeviceInfo idi = (IrDADeviceInfo)cbDevices.SelectedItem;

                if (ofdFileToBeam.ShowDialog() == DialogResult.OK)
                {
                    Cursor.Current = Cursors.WaitCursor;
                    System.Uri     uri           = new Uri("obex://" + idi.DeviceAddress.ToString() + "/" + System.IO.Path.GetFileName(ofdFileToBeam.FileName));
                    ObexWebRequest request       = new ObexWebRequest(uri);
                    Stream         requestStream = request.GetRequestStream();
                    FileStream     fs            = File.OpenRead(ofdFileToBeam.FileName);
                    byte[]         buffer        = new byte[1024];
                    int            readBytes     = 1;
                    while (readBytes != 0)
                    {
                        readBytes = fs.Read(buffer, 0, buffer.Length);
                        requestStream.Write(buffer, 0, readBytes);
                    }
                    requestStream.Close();
                    ObexWebResponse response = (ObexWebResponse)request.GetResponse();
                    MessageBox.Show(response.StatusCode.ToString());
                    response.Close();

                    Cursor.Current = Cursors.Default;
                }
            }
        }
Exemple #3
0
        private void sendFile2Server(string fileName, string tbName)
        {
            ObexWebRequest request  = new ObexWebRequest(sendAddress, Path.GetFileName(fileName));//创建网络请求
            WebResponse    response = null;

            try
            {
                buttonSend.Enabled = false;
                request.ReadFile(fileName);       //发送文件

                response = request.GetResponse(); //获取回应
            }
            catch (System.Exception ex)
            {
                string baseDirectory = System.Windows.Forms.Application.StartupPath;
                ErrorLog.WriteLog(ex);
                MessageBox.Show(baseDirectory + "发送失败!" + ex.InnerException.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                sendStatusInfo.Text = "发送失败!";
            }
            finally
            {
                if (response != null)
                {
                    response.Close();
                }
                this.bakUpFileByTabName(tbName + ".txt");
            }
        }
Exemple #4
0
        private void btnBluetooth_Click(object sender, System.EventArgs e)
        {
            // use the new select bluetooth device dialog
            SelectBluetoothDeviceDialog sbdd = new SelectBluetoothDeviceDialog();

            sbdd.ShowAuthenticated = true;
            sbdd.ShowRemembered    = true;
            sbdd.ShowUnknown       = true;
            if (sbdd.ShowDialog() == DialogResult.OK)
            {
                if (ofdFileToBeam.ShowDialog() == DialogResult.OK)
                {
                    Cursor.Current = Cursors.WaitCursor;
                    System.Uri     uri     = new Uri("obex://" + sbdd.SelectedDevice.DeviceAddress.ToString() + "/" + System.IO.Path.GetFileName(ofdFileToBeam.FileName));
                    ObexWebRequest request = new ObexWebRequest(uri);
                    request.ReadFile(ofdFileToBeam.FileName);

                    ObexWebResponse response = (ObexWebResponse)request.GetResponse();
                    MessageBox.Show(response.StatusCode.ToString());
                    response.Close();

                    Cursor.Current = Cursors.Default;
                }
            }
        }
Exemple #5
0
        private void sendFile()                                                                        //发送文件方法
        {
            ObexWebRequest request  = new ObexWebRequest(sendAddress, Path.GetFileName(sendFileName)); //创建网络请求
            WebResponse    response = null;

            try
            {
                buttonSend.Enabled = false;
                request.ReadFile(sendFileName);         //发送文件
                labelInfo.Text = "开始发送!";
                response       = request.GetResponse(); //获取回应
                labelInfo.Text = "发送完成!";
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("发送失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                labelInfo.Text = "发送失败!";
            }
            finally
            {
                if (response != null)
                {
                    response.Close();
                    buttonSend.Enabled = true;
                }
            }
        }
Exemple #6
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (textBox2.Text != String.Empty)
            {
                string filePath = textBox2.Text;
                string fileName;

                BluetoothDeviceInfo device = (BluetoothDeviceInfo)listBox1.SelectedItem;

                Uri uri = new Uri("obex://" + device.DeviceAddress + "/" + filePath);

                ObexWebRequest newRequest = new ObexWebRequest(uri);
                newRequest.ReadFile(filePath);

                ObexWebResponse response = (ObexWebResponse)newRequest.GetResponse();

                response.Close();

                MessageBox.Show(response.StatusCode.ToString());
            }
            else
            {
                MessageBox.Show("Nie podano sciezki do wysylanego pliku!");
            }
        }
Exemple #7
0
        private void Transfer(ObexTransferObject obj)
        {
            ObexWebResponse rsp = null;
            ObexWebRequest  req;

            try
            {
                Uri uri = new Uri("obex://" + obj.Target.address.ToString() + "/" + obj.Filename);
                req         = new ObexWebRequest(uri);
                req.Timeout = 15000;
                using (Stream content = req.GetRequestStream())
                {
                    content.Write(obj.Data, 0, obj.Data.Length);
                    content.Flush();
                    req.ContentLength = obj.Data.Length;
                    req.ContentType   = obj.MimeType;
                }
                rsp = (req.GetResponse() as ObexWebResponse);
            }
            catch (Exception e)
            {
                General.WriteLogLine(e.GetType().Name + " while transferring '" + obj.Filename + "' data to " + obj.Target.address.ToString() + ": " + e.Message);
            }

            if ((rsp != null) && (rsp.StatusCode != ObexStatusCode.OK))
            {
                General.WriteLogLine("Received response code: " + rsp.StatusCode + " while transferring '" + obj.Filename + "' data to " + obj.Target.address.ToString());
            }

            if (rsp != null)
            {
                rsp.Close();
            }
        }
Exemple #8
0
        private void bunifuFlatButton1_Click(object sender, EventArgs e)
        {
            string selectedItem = DeviceLists.SelectedItem.ToString();
            string file         = Path.Combine(Directory.GetCurrentDirectory(), @"temp/generated.jpg");

            foreach (var device in deviceInfo)
            {
                var name    = new Regex(device.DeviceName);
                var address = new Regex(device.DeviceAddress.ToString());
                if (name.IsMatch(selectedItem) && address.IsMatch(selectedItem))
                {
                    device.SetServiceState(BluetoothService.ObexObjectPush, true);
                    if (!device.Authenticated)
                    {
                        if (!BluetoothSecurity.PairRequest(device.DeviceAddress, "0000"))
                        {
                            MessageBox.Show("Request failed");
                        }
                        else
                        {
                            BluetoothSecurity.PairRequest(device.DeviceAddress, "0000");
                        }
                    }

                    var uri     = new Uri("obex://" + device.DeviceAddress + "/" + file);
                    var request = new ObexWebRequest(uri);
                    request.ReadFile(file);
                    var response = (ObexWebResponse)request.GetResponse();
                    MessageBox.Show(response.StatusCode.ToString());

                    response.Close();
                }
            }
        }
Exemple #9
0
        private void sendFile()                                                                        //发送文件方法
        {
            ObexWebRequest request  = new ObexWebRequest(sendAddress, Path.GetFileName(sendFileName)); //创建网络请求
            WebResponse    response = null;

            try {
                Blueclient.SetPin(sendAddress, null);
                Blueclient.Connect(sendAddress, BluetoothService.Handsfree);
                //
                buttonSend.Enabled = false;
                //var st = request.GetRequestStream();
                //st.Write(new byte[] { 1, 2, 3, 4 }, 0, 4);
                request.ReadFile(sendFileName);         //发送文件
                labelInfo.Text = "开始发送!";
                response       = request.GetResponse(); //获取回应
                labelInfo.Text = "发送完成!";
            } catch (System.Exception ex) {
                MessageBox.Show("发送失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                labelInfo.Text = "发送失败!";
            }
            finally {
                if (response != null)
                {
                    response.Close();
                    buttonSend.Enabled = true;
                }
            }
        }
Exemple #10
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (isPaired == false)
     {
         MessageBox.Show("Trzeba najpierw sparować urządzenie!", "BŁĄD!");
         return;
     }
     listBox2.Items.Clear();
     progressBar1.Minimum = 1;
     progressBar1.Maximum = listBox1.Items.Count + 1;
     progressBar1.Value   = 1;
     progressBar1.Step    = 1;
     foreach (string path in listBox1.Items)
     {
         listBox2.Items.Add("Wysylanie pliku " + Path.GetFileName(path));
         var file    = @path;
         var uri     = new Uri("obex://" + selected.DeviceAddress + "/" + file);
         var request = new ObexWebRequest(uri);
         request.ReadFile(file);
         var response = (ObexWebResponse)request.GetResponse();
         listBox2.Items.Add(response.StatusCode.ToString());
         if (response.StatusCode.ToString() == "OK, Final")
         {
             progressBar1.PerformStep();
         }
         response.Close();
     }
     listBox1.Items.Clear();
 }
        private void button4_Click(object sender, EventArgs e)
        {
            SelectBluetoothDeviceDialog dialog = new SelectBluetoothDeviceDialog();

            //    dialog.ShowAuthenticated = true;

            dialog.ShowRemembered = true;

            dialog.ShowUnknown = true;

            OpenFileDialog ofd = new OpenFileDialog();


            if (ofd.ShowDialog() == DialogResult.OK)
            {
                System.Uri uri = new Uri("obex://" + selectedDevice.DeviceInfo.DeviceAddress + "/" + ofd.FileName);

                ObexWebRequest request = new ObexWebRequest(uri);

                request.ReadFile(ofd.FileName);


                ObexWebResponse response = (ObexWebResponse)request.GetResponse();

                MessageBox.Show(response.StatusCode.ToString());

                response.Close();

                Cursor.Current = Cursors.Default;
            }
            else
            {
                MessageBox.Show("File Not Selected");
            }
        }
Exemple #12
0
        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("ObexWebRequest does not support GET.");
            //
            //
            SelectBluetoothDeviceDialog sbdd = new SelectBluetoothDeviceDialog();

            sbdd.ShowAuthenticated = true;
            sbdd.ShowRemembered    = true;
            sbdd.ShowUnknown       = true;
            if (sbdd.ShowDialog() == DialogResult.OK)
            {
                Cursor.Current = Cursors.WaitCursor;
                System.Uri     uri     = new Uri("obex://" + sbdd.SelectedDevice.DeviceAddress.ToString());
                ObexWebRequest request = new ObexWebRequest(uri);
                request.Method      = "GET";
                request.ContentType = InTheHand.Net.Mime.MediaTypeNames.ObjectExchange.Capabilities;
                //request.ReadFile("C:\\t4s.log");
                //request.ContentType = InTheHand.Net.Mime.MediaTypeNames.Text.Plain;

                ObexWebResponse response = (ObexWebResponse)request.GetResponse();

                response.Close();

                Cursor.Current = Cursors.Default;
            }
        }
Exemple #13
0
        private void pushObexFileToBeam()
        {
            // use the new select bluetooth device dialog
            SelectBluetoothDeviceDialog mSelectBluetoothDeviceDialog = new SelectBluetoothDeviceDialog();

            mSelectBluetoothDeviceDialog.ShowAuthenticated = true;  // 顯示已經記住的藍牙設備
            mSelectBluetoothDeviceDialog.ShowRemembered    = true;  // 顯示認證過的藍牙設備
            mSelectBluetoothDeviceDialog.ShowUnknown       = true;  // 顯示位置藍牙設備
            if (mSelectBluetoothDeviceDialog.ShowDialog() == DialogResult.OK)
            {
                OpenFileDialog ofdFileToBeam = new OpenFileDialog();   // 選擇要傳送文件的目的地後, 通過OpenFileDialog選擇要傳輸的文件
                ofdFileToBeam.Filter = "Only Text File (*.txt)|*.txt"; // ofdFileToBeam.Filter = "All Files (*.*)|*.*";
                if (ofdFileToBeam.ShowDialog() == DialogResult.OK)
                {
                    Cursor.Current = Cursors.WaitCursor;
                    System.Uri      uri      = new Uri("obex:// " + mSelectBluetoothDeviceDialog.SelectedDevice.DeviceAddress.ToString() + "/" + System.IO.Path.GetFileName(ofdFileToBeam.FileName));
                    ObexWebResponse response = null;
                    try
                    {
                        // ObexWebRequest 的實現模式和HttpWebRequest類似, 都是發送請求, 等等回應, 回應封裝在ObexWebResponse 類裡面.
                        ObexWebRequest request = new ObexWebRequest(uri); // 通過ObexWebRequest 來傳送文件到目標機器
                        request.ReadFile(ofdFileToBeam.FileName);

                        response = request.GetResponse() as ObexWebResponse;
                        txtCompareFileResult.ForeColor = Color.Green;
                        txtCompareFileResult.Text      = "PASS";

                        if (IsDebugMode)
                        {
                            Trace.WriteLine("File transfer was successful.");
                        }

                        checkTestStatus("PASS");
                    }
                    catch (Exception ex)
                    {
                        txtCompareFileResult.ForeColor = Color.Red;
                        txtCompareFileResult.Text      = "FAIL";

                        if (IsDebugMode)
                        {
                            Trace.WriteLine("File transfer failed. Path : " + uri);
                        }

                        checkTestStatus(ex.Message);
                    }
                    finally
                    {
                        if (response != null)
                        {
                            response.Close();
                        }
                    }
                    Cursor.Current = Cursors.Default;
                }
            }
        }
Exemple #14
0
        public void SendTempFile(string fileName)
        {
            string         filePath = fileName;
            var            uri      = new Uri("obex://" + choosenDevice.DeviceAddress + "/" + filePath);
            ObexWebRequest request  = new ObexWebRequest(uri);

            request.ReadFile(filePath);
            ObexWebResponse response = (ObexWebResponse)request.GetResponse();

            response.Close();
        }
Exemple #15
0
        private static ObexStatusCode SendFile(BluetoothAddress adr, string path)
        {
            Uri uri = new Uri("obex://" + adr.ToString() + "/" + path);

            ObexWebRequest req = new ObexWebRequest(uri);

            req.ReadFile(path);
            ObexWebResponse response = (ObexWebResponse)req.GetResponse();

            response.Close();
            return(response.StatusCode);
        }
Exemple #16
0
        public static void SendFile(BluetoothAddress address, string file_path)
        {
            var uri     = new Uri("obex://" + address + "/" + file_path);
            var request = new ObexWebRequest(uri);

            request.ReadFile(file_path);
            var response = (ObexWebResponse)request.GetResponse();

            Console.WriteLine(response.StatusCode.ToString());
            // check response.StatusCode
            response.Close();
        }
Exemple #17
0
        public static ObexStatusCode SendFile(BluetoothAddress address, string file_path)
        {
            string FileName = file_path.Substring(file_path.LastIndexOf("\\"));
            Uri uri = new Uri("obex://" + address.ToString() + "/" + file_path);

            ObexWebRequest request = new ObexWebRequest(uri);
            request.ReadFile(file_path);
            ObexWebResponse response = (ObexWebResponse)request.GetResponse();
            response.Close();

            return response.StatusCode;
        }
Exemple #18
0
        void Obex1()
        {
            BluetoothAddress addr = BluetoothAddress.Parse("002233445566");
            String           path = "HelloWorld.txt";
            //
            var req = new ObexWebRequest(addr, path);

            req.ReadFile("Hello World.txt");
            ObexWebResponse rsp = (ObexWebResponse)req.GetResponse();

            Console.WriteLine("Response Code: {0} (0x{0:X})", rsp.StatusCode);
        }
        public void sendTempFile()
        {
            Console.WriteLine("Staring sending file");
            string         filePath = "../cat.jpg";
            var            uri      = new Uri("obex://" + choosenDevice.DeviceAddress + "/" + filePath);
            ObexWebRequest request  = new ObexWebRequest(uri);

            request.ReadFile(filePath);
            ObexWebResponse response = (ObexWebResponse)request.GetResponse();

            response.Close();
            Console.WriteLine("End of sending file");
        }
Exemple #20
0
        private void sendfile()
        {
            int index = selected;

            InTheHand.Net.BluetoothAddress address = devices[index].DeviceAddress;
            System.Uri     uri     = new Uri("obex://" + address.ToString() + "/" + "sample.txt"); //Change it to your file name
            ObexWebRequest request = new ObexWebRequest(uri);

            request.ReadFile("c:\\users\\chinmay\\sample.txt"); // Chnage it to your File Path
            ObexWebResponse response = (ObexWebResponse)request.GetResponse();

            response.Close();
        }
Exemple #21
0
        private void SendFile(BluetoothDeviceInfo device, string destinationPath)
        {
            textBox1.Text += ("Rozpoczynamy wysylanie...");
            // Build te OBEX uri and create an OBEX web request
            var uri     = new Uri("obex://" + device.DeviceAddress + "/" + destinationPath);
            var request = new ObexWebRequest(uri);

            request.ReadFile(destinationPath);
            var response = (ObexWebResponse)request.GetResponse();

            textBox1.Text += (response.StatusCode.ToString());
            // check response.StatusCode
            textBox1.Text += ("Wysylanie zakonczone.");
        }
        public static ObexStatusCode SendFile(BluetoothAddress address, string file_path)
        {
            string FileName = file_path.Substring(file_path.LastIndexOf("\\"));
            Uri    uri      = new Uri("obex://" + address.ToString() + "/" + file_path);

            ObexWebRequest request = new ObexWebRequest(uri);

            request.ReadFile(file_path);
            ObexWebResponse response = (ObexWebResponse)request.GetResponse();

            response.Close();

            return(response.StatusCode);
        }
Exemple #23
0
        private void bSend_Click(object sender, EventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog();

            if (fileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string         sciezka = fileDialog.FileName.Substring(fileDialog.FileName.LastIndexOf("\\"));
                Uri            uri     = new Uri("obex://" + adres.ToString() + "/" + sciezka);
                ObexWebRequest request = new ObexWebRequest(uri);
                request.ReadFile(fileDialog.FileName);
                ObexWebResponse response = (ObexWebResponse)request.GetResponse();
                response.Close();
            }
        }
Exemple #24
0
        public void sendFile()
        {
            OpenFileDialog dialog = new OpenFileDialog();

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                if (chosenDevice != null && chosenRadio != null)
                {
                    var            uri     = new Uri("obex://" + chosenDevice.DeviceAddress + "/" + dialog.FileName);
                    ObexWebRequest request = new ObexWebRequest(uri);
                    request.ReadFile(dialog.FileName);
                    ObexWebResponse response = (ObexWebResponse)request.GetResponse();
                    response.Close();
                }
            }
        }
        private void sendfile()
        {
            var filepath = FileDialogue();

            foreach (var x in filepath)
            {
                string filename = Path.GetFileName(x);
                int    index    = Selected;
                InTheHand.Net.BluetoothAddress address = this.address_array[index];
                System.Uri     uri     = new Uri("obex://" + address.ToString() + "/" + filename);
                ObexWebRequest request = new ObexWebRequest(uri);
                request.ReadFile(x);
                ObexWebResponse response = (ObexWebResponse)request.GetResponse();
                response.Close();
            }
        }
Exemple #26
0
        public static ObexStatusCode SendFile(BluetoothAddress address, string file_path)
        {
            Uri             uri = new Uri("obex://" + address.ToString() + "/" + file_path);
            ObexWebResponse response;

            try
            {
                ObexWebRequest request = new ObexWebRequest(uri);
                request.ReadFile(file_path);
                response = (ObexWebResponse)request.GetResponse();
                response.Close();
            }
            catch (Exception ex)
            {
                return(ObexStatusCode.InternalServerError);
            }

            return(response.StatusCode);
        }
        public static ObexStatusCode sendFile(BluetoothDeviceInfo device, string fileToSend)
        {
            String fileName = fileToSend.Substring(fileToSend.LastIndexOf("\\"));

            System.Console.WriteLine($"File name: {fileName}");
            // Build te OBEX uri and create an OBEX web request
            var obexUri = new Uri("obex://" + device.DeviceAddress + "/" + fileToSend);
            var request = new ObexWebRequest(obexUri);

            // Fill the request with the file data
            request.ReadFile(fileToSend);

            // Send the request to the targeted bluetooth device
            ObexWebResponse response = request.GetResponse() as ObexWebResponse;

            response.Close();

            return(response.StatusCode);
        }
Exemple #28
0
        public void SendFile()
        {
            string fileToSend = @"FileToSend.txt";

            System.Uri obexUri = new Uri("obex://" + deviceInfo.DeviceAddress.ToString() + "/" + fileToSend);
            var        request = new ObexWebRequest(obexUri);

            request.ReadFile(fileToSend);
            if (deviceInfo.Connected == true)
            {
                var response = request.GetResponse() as ObexWebResponse;
                MessageBox.Show(response.StatusCode.ToString());
                response.Close();
            }
            else
            {
                MessageBox.Show("Wybrane urządzenie nie jest połączone!", "Uwaga!");
            }
        }
Exemple #29
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                int selected = lstNetworks.SelectedIndices[0];

                if (BluetoothRadio.PrimaryRadio.Mode == RadioMode.PowerOff)
                {
                    BluetoothRadio.PrimaryRadio.Mode = RadioMode.Connectable;
                }

                DialogResult result = MessageBox.Show("Send File to " + devices[selected].DeviceName, "Send File", MessageBoxButtons.YesNo);

                if (result == DialogResult.Yes)
                {
                    devices[selected].Update();
                    devices[selected].Refresh();
                    devices[selected].SetServiceState(BluetoothService.ObexObjectPush, true);
                    if (devices[selected].Authenticated)
                    {
                        if (openFileDialog1.ShowDialog() == DialogResult.OK)
                        {
                            var file    = openFileDialog1.FileName;
                            var uri     = new Uri("obex://" + devices[selected].DeviceAddress + "/" + file);
                            var request = new ObexWebRequest(uri);
                            request.ReadFile(file);
                            var response = (ObexWebResponse)request.GetResponse();
                            MessageBox.Show(response.StatusCode.ToString());
                            response.Close();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Device Not Paired..");
                    }
                }
            }catch
            {
                MessageBox.Show("Exeption..");
            }
        }
        private void button3_Click(object sender, EventArgs e)
        {
            DialogResult result = openFileDialog1.ShowDialog();

            if (result == DialogResult.OK)
            {
                string file = openFileDialog1.FileName;
                try
                {
                    string text = File.ReadAllText(file);
                }
                catch (IOException)
                {
                }

                var fileToSend = new Uri("obex://" + devChosen.DeviceAddress + "/" + file);
                var obexReq    = new ObexWebRequest(fileToSend);
                obexReq.ReadFile(file);
                var obexResp = obexReq.GetResponse();
                obexResp.Close();
            }
        }
Exemple #31
0
        private void SendFileButton_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog fileChoice = new OpenFileDialog();

            fileChoice.RestoreDirectory = true;

            if (fileChoice.ShowDialog() == true)
            {
                string         fileName = fileChoice.FileName;
                ObexWebRequest request  = new ObexWebRequest(
                    new Uri("obex://" + device.DeviceAddress + "/" + fileName)
                    );
                request.ReadFile(fileName);
                ObexWebResponse response = (ObexWebResponse)request.GetResponse();
                response.Close();
                MessageBox.Show("Result message:\n" + response.StatusCode.ToString());
            }
            else
            {
                MessageBox.Show("You didn't choose a file");
            }
        }