private void Test3(IEnumerable <object> items, bool isPending) { if (items == null) { return; } var shareWith = new List <SharedWithViewModel> { new SharedWithViewModel("*****@*****.**", ShareWithStatus.Accepted), new SharedWithViewModel("*****@*****.**", ShareWithStatus.Declined), new SharedWithViewModel("*****@*****.**", ShareWithStatus.Pending) }; var lst = items.Count() > 2 ? items.ToList().GetRange(0, 2) : items.ToList(); var pendingFolder = new ShareFolderViewModel("1", "First folder", null, true); var subFolder = new ShareFolderViewModel("2", "Sub-folder", null, true); foreach (var subItem in lst) { subFolder.AddSubItem(subItem); } pendingFolder.AddSubItem(subFolder); foreach (var subItem in lst) { pendingFolder.AddSubItem(subItem); } var pendingShareWithSubFolder = new SharedByMeViewModel(Guid.NewGuid().ToString(), "Share with sub-folder", true, lst, shareWith, true); pendingShareWithSubFolder.AddItem(pendingFolder); //shared with me var sharedSubItems = new SharedWithMeItemShareViewModel(Guid.NewGuid().ToString(), "First sub-item", isPending, lst, false, new DateTime(2016, 3, 23), SharedWithMeItemState.Pending); sharedSubItems.AddItem(subFolder); var sharedSubItems2 = new SharedWithMeItemShareViewModel(Guid.NewGuid().ToString(), "Second sub-item", isPending, lst, false, new DateTime(2016, 5, 22), SharedWithMeItemState.Waiting); var shareWithMe = new SharedWithMeViewModel(Guid.NewGuid().ToString(), "sender-email-address.com", isPending, new List <object> { sharedSubItems, sharedSubItems2 }, false); if (isPending) { AddPendingByMeItem(pendingShareWithSubFolder); } else { AddCurrentByMeItem(pendingShareWithSubFolder); AddCurrentWithMeItem(shareWithMe); } }
private ShareFolderViewModel CreateShareFromFolder(string folderId, string folderName, string rootFolderId) { var items = _pbData.GetSecureItemsByFolderId(folderId); var folder = new ShareFolderViewModel(folderId, folderName, null, false, rootFolderId); foreach (var secureItem in items) { var item = _addItems.FirstOrDefault(x => x.ItemType == secureItem.Type); var secureItemVm = Activator.CreateInstance(item.CreateItemType, secureItem, item.BackgoundColor, item.Icon) as SecureItemViewModel; folder.AddSubItem(secureItemVm); } return(folder); }