private void Window_Loaded(object sender, RoutedEventArgs e) { // set title and message this.Title = _caption; textMessage.Text = AddServiceErrorToMessage(_message, _serviceError); labelException.Visibility = Visibility.Collapsed; textBoxException.Visibility = Visibility.Collapsed; if (_showDontShow) { checkBoxDontShowAgain.Visibility = Visibility.Visible; } else { checkBoxDontShowAgain.Visibility = Visibility.Collapsed; } // set exception if (_exception == null) { textBlockShowDetail.Visibility = Visibility.Collapsed; } else { textBoxException.Text = string.Format(CultureInfo.CurrentCulture, "{0}\r\n\r\n{1}\r\n\r\nService Error Code: {2}", DiagnosticsHelper.GetExceptionText(_exception), DiagnosticsHelper.EnvironmentInfo, _serviceError); } // set icon string relativePath; switch (_icon) { case StackHashMessageBoxIcon.Information: default: relativePath = @"Help\information32.png"; System.Media.SystemSounds.Asterisk.Play(); break; case StackHashMessageBoxIcon.Question: relativePath = @"Help\question32.png"; System.Media.SystemSounds.Question.Play(); break; case StackHashMessageBoxIcon.Warning: relativePath = @"Help\warning32.png"; System.Media.SystemSounds.Exclamation.Play(); break; case StackHashMessageBoxIcon.Error: relativePath = @"Help\error32.png"; System.Media.SystemSounds.Hand.Play(); break; } imageIcon.Source = new BitmapImage(new Uri(relativePath, UriKind.Relative)); // set buttons switch (_type) { case StackHashMessageBoxType.Ok: button1.Content = Properties.Resources.Ok; button1.IsDefault = true; button2.Visibility = Visibility.Collapsed; break; case StackHashMessageBoxType.OkCancel: button1.Content = Properties.Resources.Cancel; button1.IsCancel = true; button2.Content = Properties.Resources.Ok; button2.IsDefault = true; break; case StackHashMessageBoxType.OkOpenFolder: button1.Content = Properties.Resources.Ok; button1.IsDefault = true; button2.Content = Properties.Resources.OpenFolder; button2.Width = 110; break; case StackHashMessageBoxType.YesNo: button1.Content = Properties.Resources.No; button1.IsCancel = true; button2.Content = Properties.Resources.Yes; button2.IsDefault = true; break; case StackHashMessageBoxType.RetryExit: button1.Content = Properties.Resources.Exit; button1.IsCancel = true; button2.Content = Properties.Resources.Retry; button2.IsDefault = true; break; case StackHashMessageBoxType.RetryCancel: button1.Content = Properties.Resources.Cancel; button1.IsCancel = true; button2.Content = Properties.Resources.Retry; button2.IsDefault = true; break; } }