private async void btExchangeVersion_Click(object sender, EventArgs e) { string version = "Unknown"; btExchangeVersion.Enabled = false; ExchangeServerException ex = null; await Task.Run(() => { try { version = ExchangeServer.GetInstalledVersion(); } catch (ExchangeServerException exe) { ex = exe; } }); btExchangeVersion.Enabled = true; if (ex != null) { ShowMessageBox("Exchange Version Error", "Couldn't determine installed Exchange Version: " + ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error); } char[] values = version.ToCharArray(); string result = ""; foreach (char letter in values) { // Get the integral value of the character. int value = Convert.ToInt32(letter); // Convert the decimal value to a hexadecimal value in string form. string hexOutput = String.Format("{0:X}", value); result += "'" + letter + "'" + " -> " + hexOutput + "\n"; } string configVersion = Version.Parse(FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).ProductVersion).ToString().Substring(0, 5); result = "My version: " + configVersion + "\nExchange\n" + result; ShowMessageBox("Exchange Version Debug", result, MessageBoxButtons.OK, MessageBoxIcon.Information); }
/// <summary> /// Check the Microsoft Exchange Transport Service Status /// </summary> private async void CheckExchangeInstalled() { progressInstall.Style = ProgressBarStyle.Marquee; await Task.Run(() => exchangeVersion = ExchangeServer.GetInstalledVersion()); lblExchangeVersionWait.Hide(); btInstall.Enabled = IsBtInstallEnabled(); // If the source for install have been specified in command line if (zipUrl != null || performInstall) { Install(); } }
/// <summary> /// Check the Microsoft Exchange Transport Service Status /// </summary> private async void CheckExchangeInstalled() { string version = "Unknown"; ExchangeServerException ex = null; await Task.Run(() => { try { version = ExchangeServer.GetInstalledVersion(); } catch (ExchangeServerException e) { ex = e; } }); if (ex != null) { ShowMessageBox("Exchange Version Error", "Couldn't determine installed Exchange Version: " + ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error); } txtExchangeInstalled.Text = version; // Uptade Microsft Exchange Transport Service stuatus btConfigureTransportService.Enabled = (version != null && version != "Not installed"); if (!btConfigureTransportService.Enabled) { txtExchangeStatus.Text = "Unavailable"; } SetUpgradeButton(); }