private void btnGetDiscoveryMode_Click(object sender, EventArgs e) { try { DeviceClient service = GetService(); DiscoveryMode discoveryMode = service.GetDiscoveryMode(); ShowStatusMessage("Done"); service.Close(); if (cbShowResult.Checked) { string methodInfo = "Result from GetDiscoveryMode"; QuickWatchForm form = new QuickWatchForm(methodInfo, discoveryMode); form.Show(); } } catch (Exception ex) { ShowStatusMessage("Operation failed"); TraceException(ex); MessageBox.Show(ex.Message); } }