public bool MoveFolderUp(TFolder folder) { bool skipNotification = ShouldSkipChangeNotifications; ShouldSkipChangeNotifications = true; int folderIndex = _subFolders.IndexOf(folder); if (folderIndex == -1) { foreach (TFolder subFolder in _subFolders) { if (subFolder.MoveFolderUp(folder)) { ShouldSkipChangeNotifications = skipNotification; return(true); } } ShouldSkipChangeNotifications = skipNotification; return(false); } if (folderIndex == 0) { ShouldSkipChangeNotifications = skipNotification; return(true); } _subFolders.RemoveAt(folderIndex); _subFolders.Insert(folderIndex - 1, folder); ShouldSkipChangeNotifications = skipNotification; return(true); }
public bool MoveFolderUp(TFolder folder) { int folderIndex = _subFolders.IndexOf(folder); if (folderIndex == -1) { foreach (TFolder subFolder in _subFolders) { if (subFolder.MoveFolderUp(folder)) { return(true); } } return(false); } if (folderIndex == 0) { return(true); } _subFolders.RemoveAt(folderIndex); _subFolders.Insert(folderIndex - 1, folder); return(true); }