/// <summary> /// Initializes a new instance of the <see cref="T:DesktopSprites.Core.ExceptionDialog"/> class. /// </summary> /// <param name="ex">The exception to report.</param> /// <param name="text">The text to display in the dialog.</param> /// <param name="caption">The text to display in the title bar of the dialog.</param> /// <param name="fatal">A value indicating if the exception is fatal to the process, which is reflected in the icon used.</param> /// <param name="owner">The owner of the dialog (optional).</param> private ExceptionDialog(Exception ex, string text, string caption, bool fatal, IWin32Window owner = null) { InitializeComponent(); var screen = owner != null?Screen.FromHandle(owner.Handle) : Screen.FromControl(this); MaximumSize = Rectangle.Intersect(screen.WorkingArea, screen.Bounds).Size; ExceptionText.Text = ex.ToString(); if (!Runtime.IsMono) { Size oldSize = Size.Empty; Size preferredSize = ExceptionText.GetPreferredSize(Size.Empty); while (oldSize != ExceptionText.Size && preferredSize != ExceptionText.Size) { oldSize = ExceptionText.Size; ExceptionText.Size = preferredSize; preferredSize = ExceptionText.GetPreferredSize(ExceptionText.Size); } } else { ExceptionText.Size = new Size(750, 350); } MessageLabel.Text = text; Text = caption; Icon = fatal ? SystemIcons.Error : SystemIcons.Exclamation; iconBitmap = Icon.ToBitmap(); IconBox.Image = iconBitmap; TimeLabel.Text = DateTime.UtcNow.ToString("u", CultureInfo.CurrentCulture); }
public override int GetHashCode() { unchecked { var result = (Message != null ? Message.GetHashCode() : 0); result = (result * 397) ^ (ExceptionText != null ? ExceptionText.GetHashCode() : 0); result = (result * 397) ^ (CorrelationId != null ? CorrelationId.GetHashCode() : 0); return(result); } }