private void button1_Click(object sender, EventArgs e) { if (Storage.settingsData.serverManager.clearConnections()) { // The following call is done async to prevent blocking of the UI thread while networking stuff happens. connectDelegate = new boolMessageLogDelegate(Storage.settingsData.serverManager.connectAllEnabledServer); AsyncCallback connectDoneCallback = new AsyncCallback(callBack); connectAsyncResult = connectDelegate.BeginInvoke(addMessageLogText, connectDoneCallback, null); } else { addMessageLogText(this, new MessageEvent("Unable to access server manager, as a network connection is currently being attempted.")); } }