.NET Components for Mobility

I have a big problem

Last post 05-10-2009 11:56 AM by alanjmcf. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 05-10-2009 4:15 AM

    I have a big problem

     Dear All,

     

    Guys I wrote a code which was working verywell during the last month until yesterday, the code is make a connection to bluetooth device then he send a text file through obex.

     

    what I get now is the following message "An error message can't be displayed because an optional resource assembly containing it can't be found"

     

    this message appears once I call the connect method in the bluetoothclient.

     Here is the full code that I used.....

     

    BluetoothRadio.PrimaryRadio.Mode = RadioMode.Discoverable;
                bluetoothClient = new BluetoothClient();
                Cursor.Current = Cursors.WaitCursor;
                bluetoothDeviceInfo = bluetoothClient.DiscoverDevices(10);
                comboBox1.DataSource = bluetoothDeviceInfo;
                comboBox1.DisplayMember = "DeviceName";
                comboBox1.ValueMember = "DeviceAddress";
                comboBox1.Focus();
                Cursor.Current = Cursors.Default;
                BluetoothRadio [ br = BluetoothRadio.AllRadios;
                Manufacturer devMan = br[0].Manufacturer;

                BluetoothDeviceInfo K610Device = null;
                foreach(BluetoothDeviceInfo myDevice in bluetoothDeviceInfo)
                {
                    if (myDevice.DeviceName.ToUpper() == "K610I")
                    {
                        K610Device = myDevice;
                        break;
                    }
                }

                Guid[ MyServices = K610Device.InstalledServices;

                foreach (Guid k in MyServices)
                {
                    MessageBox.Show(BluetoothService.GetName(k));
                }

                try
                {

                    // the exception appears here "The messaqge that I mentioned above"
                    bluetoothClient.Connect(new BluetoothEndPoint(K610Device.DeviceAddress, service));
                    MessageBox.Show("Connected");
                }
                catch (Exception exp)
                {
                    MessageBox.Show(exp.Message.ToString());
                }

                 string strPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
                string FilePath = Path.Combine(strPath, "test.txt");
                FileStream SrcFile = File.OpenRead(FilePath);
                ObexClientSession MySession = new ObexClientSession(bluetoothClient.GetStream(), UInt16.MaxValue);
                ObexHeaderCollection headers = new ObexHeaderCollection();

                headers.Add(ObexHeaderId.Count, 1);
                MySession.Connect(headers);

                string name = Path.GetFileName("test.txt");
                long length = SrcFile.Length;

                MySession.PutFrom(SrcFile, name, null, length);

    The device is SGH-i900 "Samsung", windows mobile 6

     

    What's the solution guys????? yesterday it was working.................................

     

    I'm waiting ur responses ASAP

  • 05-10-2009 11:56 AM In reply to

    Re: I have a big problem

    What exception is it?  SocketException?  If so what's the value of the ErrorCode property?

     What's the value of "service", BluetoothService.ObexObjectPush?

    What happens if you try sending to the phone from your PC?  For instance use the Windows' built-in "Bluetooth File Transfer Wizard" app (fsquirt.exe)?

Page 1 of 1 (2 items)
Copyright © 2001-2012 In The Hand Ltd. All rights reserved. Terms of Use and Privacy Policy. OrcsWeb's Windows Cloud Server Hosting