private void UpdateNbStatus() { try { // test the connection delVerifyConnection dlgt = new delVerifyConnection(VerifyConnection); IAsyncResult iasr = dlgt.BeginInvoke(Config.NbDefault, null, null); if (iasr.AsyncWaitHandle.WaitOne(THREAD_GUIREFRESHSTATUS_INTERVAL)) { si = (ServerInfo)dlgt.EndInvoke(iasr); if (si != null) { ifDisconnectedFromNB = false; } else { ifDisconnectedFromNB = true; } } Application.DoEvents(); if (lockNbStatus || !ifDisconnectedFromNB) return; lockNbStatus = true; delHandleNbStatus d = new delHandleNbStatus(HandleNbStatus); this.BeginInvoke(d); } catch { } finally { } }
private void tsNetBrokers_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) { string selectedEnvironment = e.ClickedItem.ToString(); tsNetBrokers.Text = selectedEnvironment; Config.NbDefault = tsNetBrokers.Text; log.InfoFormat("User selected NB instance {0}", selectedEnvironment); si = null; ifDisconnectedFromNB = true; Application.DoEvents(); if (lockNbStatus || !ifDisconnectedFromNB) return; lockNbStatus = true; delHandleNbStatus d = new delHandleNbStatus(HandleNbStatus); this.BeginInvoke(d); }