Example #1
0
 public static bool UndoChangesInRepositoryItem(RepositoryItemBase item, bool isLocalBackup = false, bool clearBackup = true)
 {
     if (Reporter.ToUser(eUserMsgKey.AskIfToUndoItemChanges, item.ItemName) == eUserMsgSelection.Yes)
     {
         try
         {
             Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
             Reporter.ToStatus(eStatusMsgKey.StaticStatusProcess, null, string.Format("Undoing changes for '{0}'...", item.ItemName));
             item.RestoreFromBackup(isLocalBackup, clearBackup);
             return(true);
         }
         catch (Exception ex)
         {
             Reporter.ToUser(eUserMsgKey.StaticWarnMessage, string.Format("Failed to undo changes to the item '{0}', please view log for more details", item.ItemName));
             Reporter.ToLog(eLogLevel.ERROR, string.Format("Failed to undo changes to the item '{0}'", item.ItemName), ex);
             return(false);
         }
         finally
         {
             Reporter.HideStatusMessage();
             Mouse.OverrideCursor = null;
         }
     }
     else
     {
         return(false);
     }
 }