示例#1
0
 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);
     }
 }
示例#2
0
 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);
     }
 }