void stopConnector() { if (_connector == null) { return; } addLog("STOP connector..."); _connector.Dispose(); _connector = null; if (_wifi != null) { _wifi.Dispose(); _wifi = null; } addLog("connector stopped."); }
void startConnector() { if (_connector != null) { stopConnector(); } //_connector = new connector(new string[] { "SUPPORT", "Intermec" }); try { addLog("starting connector..."); _connector = new connector(); _connector.connectorChangedEvent += new connector.connectorChangeEventHandler(_connector_connectorChangedEvent); addLog("connector started"); } catch (NotSupportedException ex) { MessageBox.Show(ex.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); } if (_connector == null) { btnStart.Enabled = false; btnStop.Enabled = false; btnTrySwitch.Enabled = false; mnuGetProfiles.Enabled = false; } updateGrid(); dataGrid2.DataSource = _wifi._accesspoints; timer1 = new Timer(); timer1.Tick += new EventHandler(timer1_Tick); timer1.Interval = 30000; //all 30 seconds // timer1.Enabled = true; }