pshaw
Posts: 7
Joined: Mon Dec 08, 2008 8:21 pm
Location: USA

Discovery After form closes

Sun Jun 28, 2009 4:27 pm

I am using the Find and Connect form in my application to find BT hardware and add them to a database for later use. The only thing I have changed is I removed the Dispose() from the On_Closing event of the form and dispose when the application closes. The problem I have is the first time I open the discovery form and do a discovery it works perfectly. If I close the form and reopen it the discovery finds nothing. I don't get an error message, just a empty device list. If I close the app add reopen it everything works fine again...until I close the form and re-open it. What am I missing?

Jonas
Posts: 2319
Joined: Mon Jan 09, 2006 2:20 pm
Location: Sweden

RE: Discovery After form closes

Sun Jun 28, 2009 8:03 pm

Depends on how you re-open the window. Maybe you are missing some event handlers which are initialized on startup but not when you open the window again?

Regards,
Jonas

pshaw
Posts: 7
Joined: Mon Dec 08, 2008 8:21 pm
Location: USA

RE: Discovery After form closes

Mon Jun 29, 2009 12:19 pm

The events are started on the discover button click event...just like the sample.
private void cmdDiscover_Click(object sender, EventArgs e)
{
//deviceList.Items.Clear();
try
{

Franson.Guide.SharedNetwork sharedNetwork = SharedNetwork.GetSharedNetwork();

sharedNetwork.Network.CancelDeviceDiscovery();

sharedNetwork.AddEvent(this, EventType.DeviceDiscoveryStarted, new Franson.BlueTools.BlueToolsEventHandler(DeviceDiscoveryStarted));
sharedNetwork.AddEvent(this, EventType.DeviceDiscovered, new Franson.BlueTools.BlueToolsEventHandler(DeviceDiscovered));
sharedNetwork.AddEvent(this, EventType.DeviceDiscoveryCompleted, new Franson.BlueTools.BlueToolsEventHandler(DeviceDiscoveryCompleted));

sharedNetwork.Network.DiscoverDevicesAsync();

}
catch (Exception exc)
{
MessageBox.Show(exc.Message);
}

}

natgs18
Posts: 3
Joined: Thu Mar 04, 2010 5:30 am

RE: Discovery After form closes

Sat Mar 06, 2010 8:30 pm

Hi Pshaw, how did you solve that problem?
Regards,
n.

pshaw
Posts: 7
Joined: Mon Dec 08, 2008 8:21 pm
Location: USA

RE: Discovery After form closes

Mon Mar 08, 2010 8:56 am

Hi n, yes I solved it by using m_network.DiscoverDevicesAsync(); instead of events. I still have the issue of Application.Exit doesn't close the application down after the Discovery is made. If you need the code PM me.

Return to “BlueTools”