public void AddOrUpdateFolderItem(FolderItem item) { if (FolderCollection.Contains(item)) { int sourceIndex = FolderCollection.IndexOf(item); FolderCollection.Remove(item); FolderCollection.Insert(sourceIndex, item); if (CurrentSelectedFolder != null && CurrentSelectedFolder.Equals(item)) { CurrentSelectedFolderChanged?.Invoke(this, item); } IsFolderListChanged = true; } else { FolderCollection.Add(item); IsFolderListChanged = true; } }
public async Task RemoveFolder(FolderItem item) { if (FolderCollection.Count == 1) { ShowPopup(LanguageName.NeedOneFolder, true); return; } var confirmDialog = new ConfirmDialog(LanguageName.ConfirmRemoveFolder); confirmDialog.PrimaryButtonClick += (_s, _e) => { FolderCollection.Remove(item); AllHistoryList.RemoveAll(p => p.FolderId == item.Id); if (CurrentSelectedFolder.Equals(item)) { var first = FolderCollection.First(); CurrentSelectedFolder = first; } IsFolderListChanged = true; IsHistoryListChanged = true; }; await confirmDialog.ShowAsync(); }