public ObservableCollection <AbMediaContent> getLinkedMedia(AbMediaContent media) { ObservableCollection <AbMediaContent> linkedMediaInfo = new ObservableCollection <AbMediaContent>(); cardMediaLinks.TryGetValue(media, out linkedMediaInfo); return(linkedMediaInfo); }
public ObservableCollection <AbMediaContent> getLinkedMedia(AbMediaContent media) { if (!cardMediaLinks.ContainsKey(media.filePath)) { cardMediaLinks[media.filePath] = new ObservableCollection <AbMediaContent>(); } return(cardMediaLinks[media.filePath]); }
public static void removeMediaFromCards(AbMediaContent media) { foreach (Card card in allCardsDict.Values) { if (card.containsMedia(media)) { card.removeMedia(media); } } }
public static bool cardContainsMedia(AbMediaContent media) { foreach (Card card in allCardsDict.Values) { if (card.containsMedia(media)) { return(true); } } return(false); }
public bool linkExists(AbMediaContent aMedia, AbMediaContent bMedia) { ObservableCollection <AbMediaContent> links; cardMediaLinks.TryGetValue(aMedia.filePath, out links); if (links == null) { return(false); } return(links.Contains(bMedia)); }
private async static Task <List <AbMediaContent> > deserializeMediaFilesAsync(IFolder dir) { IList <IFile> files = await dir.GetFilesAsync(); List <AbMediaContent> filesRead = new List <AbMediaContent>(files.Count); foreach (IFile file in files) { filesRead.Add(AbMediaContent.createMediaContent(FileUtilities.filePathToMediaType(file.Path), file.Path)); } return(filesRead); }
public void removeLink(AbMediaContent rootMedia, AbMediaContent otherMedia) { ObservableCollection <AbMediaContent> links; cardMediaLinks.TryGetValue(rootMedia.filePath, out links); if (links == null) { links = new ObservableCollection <AbMediaContent>(); } if (links.Contains(otherMedia)) { links.Remove(otherMedia); } cardMediaLinks[rootMedia.filePath] = links; }
public void addLink(AbMediaContent rootMedia, AbMediaContent otherMedia) { ObservableCollection <AbMediaContent> links; cardMediaLinks.TryGetValue(rootMedia, out links); if (links == null) { links = new ObservableCollection <AbMediaContent>(); } //Create new media content to reference to if (!links.Contains(otherMedia)) { links.Add(AbMediaContent.createMediaContent(otherMedia.getMediaType(), otherMedia.filePath)); } cardMediaLinks[rootMedia] = links; }
public void removeMedia(AbMediaContent audioMedia) { mediaCount--; mediaList.Remove(audioMedia); }
public void addNewMedia(AbMediaContent audioMedia) { mediaCount++; mediaList.Add(audioMedia); }
public override bool Equals(object obj) { AbMediaContent otherMedia = obj as AbMediaContent; return(otherMedia.filePath == this.filePath); }
private async static Task <SortedDictionary <DateTime, DayMediaObservableCollection> > readDayMediaAsync() { allMedia = new List <AbMediaContent>(); allMediaDict = new SortedDictionary <DateTime, DayMediaObservableCollection>(); List <AbMediaContent> sortedMedia = await readMediaSortAsync(); if (sortedMedia.Count == 0) { return(allMediaDict); } // temp create multiple days int startIndex = 0; List <AbMediaContent> curMediaList = new List <AbMediaContent>(); DateTime curDateTime = sortedMedia[0].creationTime; /* * if (sortedMedia.Count > 10) * { * for(int i = 0; i<5; i++) * { * curMediaList.Add(sortedMedia[i]); * } * allMediaDict.Add( curDateTime.AddDays(-2), new DayMediaObservableCollection(curDateTime.AddDays(-2), curMediaList)); * curMediaList = new List<AbMediaContent>(); * * for (int i = 5; i<10; i++) * { * curMediaList.Add(sortedMedia[i]); * } * allMediaDict.Add(curDateTime.AddDays(-1), new DayMediaObservableCollection(curDateTime.AddDays(-1), curMediaList)); * curMediaList = new List<AbMediaContent>(); * * startIndex = 10; * } */ // Media sorted from earliest to latest for (int i = startIndex; i < sortedMedia.Count; i++) { AbMediaContent media = sortedMedia[i]; allMedia.Add(media); if (media.creationTime.Date == curDateTime.Date) { curMediaList.Add(media); } else { allMediaDict.Add(curDateTime.Date, new DayMediaObservableCollection(curDateTime, curMediaList)); curDateTime = media.creationTime; curMediaList = new List <AbMediaContent> { media }; } } allMediaDict.Add(curDateTime.Date, new DayMediaObservableCollection(curDateTime, curMediaList)); return(allMediaDict); }