private void buttonOptions_Click(object sender, System.EventArgs e) { ContentSourceInfo selectedContentSource = GetSelectedPlugin(); if (selectedContentSource != null) { if (selectedContentSource.WriterPluginHasEditableOptions) { try { selectedContentSource.Instance.EditOptions(FindForm()); } catch (NotImplementedException ex) { ContentSourceManager.DisplayContentRetreivalError(FindForm(), ex, selectedContentSource); } catch (Exception exception) { Trace.Fail(exception.ToString()); DisplayableException dex = new DisplayableException( Res.Get(StringId.UnexpectedErrorPluginTitle), string.Format(CultureInfo.CurrentCulture, Res.Get(StringId.UnexpectedErrorPluginDescription), selectedContentSource.Name, exception.Message)); DisplayableExceptionDisplayForm.Show(FindForm(), dex); } } } }
/// <summary> /// Notify the user that an error has occurred. /// </summary> /// <param name="title">Error title (used as the error caption).</param> /// <param name="description">Error description (displayed within a scrolling /// text-box so can be longer and/or display diagnostic information).</param> public static void DisplayError(string title, string description) { LogError(String.Format(CultureInfo.CurrentCulture, "{0}: {1}", title, description)); DisplayableException displayableException = new DisplayableException(title, description); using (DisplayableExceptionDisplayForm form = new DisplayableExceptionDisplayForm(displayableException)) form.ShowDialog(Win32WindowImpl.ForegroundWin32Window); }
public Message(DisplayableException ex) { InitializeComponent(); Title = ex.Message; PrimaryButtonText = "OK"; SecondaryButtonText = ""; textBlock.Text = ex.Description; }
public static bool SafeDeleteLocalPost(string blogId, string postId) { try { PostEditorFile post = PostEditorFile.FindPost(PostEditorFile.RecentPostsFolder, blogId, postId); if (post != null) { post.Delete(); } return(true); } catch (Exception ex) { DisplayableException displayableException = new DisplayableException( StringId.ErrorOccurredDeletingDraft, StringId.ErrorOccurredDeletingDraftDetails, ex.Message); DisplayableExceptionDisplayForm.Show(Win32WindowImpl.ForegroundWin32Window, displayableException); return(false); } }
public static bool SafeDeleteLocalPost(FileInfo postFile) { try { PostEditorFile postEditorFile = PostEditorFile.GetExisting(postFile); if (postEditorFile != null) { postEditorFile.Delete(); } return(true); } catch (Exception ex) { DisplayableException displayableException = new DisplayableException( StringId.ErrorOccurredDeletingDraft, StringId.ErrorOccurredDeletingDraftDetails, ex.Message); DisplayableExceptionDisplayForm.Show(Win32WindowImpl.ForegroundWin32Window, displayableException); return(false); } }
public AfterPublishFileUploadFailedForm(Exception ex, bool isPage) { // // Required for Windows Form Designer support // InitializeComponent(); string itemName = isPage ? Res.Get(StringId.PageLower) : Res.Get(StringId.PostLower); this.Text = Res.Get(StringId.PostPublishFileUploadErrorTitle); this.labelCaption1.Text = String.Format(CultureInfo.CurrentCulture, Res.Get(StringId.PostPublishFileUploadErrorCaption1), itemName); this.labelCaption2.Text = String.Format(CultureInfo.CurrentCulture, Res.Get(StringId.PostPublishFileUploadErrorCaption2), itemName); this.buttonOK.Text = Res.Get(StringId.OKButtonText); if (ex is DisplayableException) { DisplayableException displayableEx = ex as DisplayableException; textBoxDetails.Text = String.Format(CultureInfo.CurrentCulture, "{0}\r\n\r\n{1}", displayableEx.Title, displayableEx.Text); } else { textBoxDetails.Text = ex.ToString(); } }
/// <summary> /// Initialize w/ required values /// </summary> public DisplayableExceptionDisplayForm(Exception exception) { // // Required for Windows Form Designer support // InitializeComponent(); this.labelMessage.Font = Res.GetFont(FontSize.Large, FontStyle.Bold); this.buttonOK.Text = Res.Get(StringId.OKButtonText); // initialize controls Icon = ApplicationEnvironment.ProductIcon; pictureBoxIcon.Image = errorBitmap; DisplayableException displayableException = exception as DisplayableException; if (displayableException != null) { Text = EnsureStringValueProvided(displayableException.Title); labelMessage.Text = EnsureStringValueProvided(displayableException.Title); textBoxDetails.Text = EnsureStringValueProvided(displayableException.Text); // log the error Trace.WriteLine(String.Format(CultureInfo.InvariantCulture, "DisplayableException occurred: {0}", displayableException.ToString())); } else { // log error Trace.WriteLine("Non DisplayableException-derived exception thrown. Subsystems need to handle these exceptions and convert them to WriterExceptions:\r\n" + exception.ToString()); // give the user a full data dump Text = Res.Get(StringId.UnexpectedErrorTitle); labelMessage.Text = exception.GetType().Name; textBoxDetails.Text = exception.ToString(); } }