private void buttonOK_Click(object sender, EventArgs e) { Log("diagnostics, instantiate"); var diagnostics = new DiagnosticsServiceClient(); try { Log("diagnostics, open"); diagnostics.Open(); Log("diagnostics, state: " + diagnostics.State); Log("diagnostics, endpoint binding: " + diagnostics.Endpoint.Address.ToString()); Log("diagnostics, client credentials user name: " + diagnostics.ClientCredentials.UserName.UserName); Log("diagnostics, inner channel: " + diagnostics.InnerChannel.ToString()); Log("diagnostics, system information local computer name : " + SystemInformation.ComputerName); Application.DoEvents(); Log("diagnostics, ping test: " + diagnostics.PingTest().ToString()); Application.DoEvents(); Log("diagnostics, system information remote computer name : " + diagnostics.ComputerName()); Application.DoEvents(); Log("diagnostics, database: " + diagnostics.Database()); Application.DoEvents(); // log the login Log("login, add activity login"); var activity = new DefaultUserActivityServiceClient(); Application.DoEvents(); Singleton.Instance.UserId = activity.Login(textBoxUserName.Text); activity.AddActivityAsync( Singleton.Instance.UserId, DefaultUserActivityTypeRef.Login, textBoxUserName.Text, Dns.GetHostName() ); Log("login, closing activity"); activity.Close(); //_parent.ShowUserInfo(); Log("login, get system settings"); Singleton.Instance.RefreshSystemSettings(); Singleton.Instance.CheckForm(this); Singleton.Instance.CheckForm(this.MdiParent); } catch (Exception ex) { Log("exception: " + ex.Message); if (ex.InnerException != null) { Log("exception inner: " + ex.InnerException.Message); } } finally { Log("login, closing diagnostics"); diagnostics.Close(); Log("login, closing login"); } }
private void buttonPingTest_Click(object sender, EventArgs e) { var diagnostics = new DiagnosticsServiceClient(); try { DateTime startTime = DateTime.UtcNow; for (int loop = 0; loop < 100; loop++) { diagnostics.PingTest(); } Log("diagnostics, ping test: " + DateTime.UtcNow.Subtract(startTime).ToString()); } catch (Exception ex) { Log("exception: " + ex.Message); if (ex.InnerException != null) { Log("exception inner: " + ex.InnerException.Message); } } finally { Log("login, closing diagnostics"); diagnostics.Close(); Log("login, closing login"); } }