private void btnTest_Click(object sender, EventArgs e) { if (CheckProps() && CheckCreds()) { var tempSavedServer = new SavedServer(); SetServerProperties(tempSavedServer); var tempRemoteServer = new RemoteServer(tempSavedServer); tempRemoteServer.TestConnection().Show(); } }
private void TestConnection(ServerListItem item) { var remoteServer = new RemoteServer(item.Server); item.TestConnectionResult = remoteServer.TestConnection(); if (this.IsHandleCreated) { try { Invoke(new Action(() => ShowTestResult(item))); } catch (Exception ex) { // User probably closed the form. Debug.WriteLine("Exception: {0}", ex); } } else { // User probably closed the form. Debug.WriteLine("Form has no handle."); } }