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