Exemplo n.º 1
0
        public ObservableCollection <AbMediaContent> getLinkedMedia(AbMediaContent media)
        {
            ObservableCollection <AbMediaContent> linkedMediaInfo = new ObservableCollection <AbMediaContent>();

            cardMediaLinks.TryGetValue(media, out linkedMediaInfo);

            return(linkedMediaInfo);
        }
Exemplo n.º 2
0
        public ObservableCollection <AbMediaContent> getLinkedMedia(AbMediaContent media)
        {
            if (!cardMediaLinks.ContainsKey(media.filePath))
            {
                cardMediaLinks[media.filePath] = new ObservableCollection <AbMediaContent>();
            }

            return(cardMediaLinks[media.filePath]);
        }
Exemplo n.º 3
0
 public static void removeMediaFromCards(AbMediaContent media)
 {
     foreach (Card card in allCardsDict.Values)
     {
         if (card.containsMedia(media))
         {
             card.removeMedia(media);
         }
     }
 }
Exemplo n.º 4
0
 public static bool cardContainsMedia(AbMediaContent media)
 {
     foreach (Card card in allCardsDict.Values)
     {
         if (card.containsMedia(media))
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 5
0
        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));
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        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;
        }
Exemplo n.º 8
0
        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;
        }
Exemplo n.º 9
0
 public void removeMedia(AbMediaContent audioMedia)
 {
     mediaCount--;
     mediaList.Remove(audioMedia);
 }
Exemplo n.º 10
0
 public void addNewMedia(AbMediaContent audioMedia)
 {
     mediaCount++;
     mediaList.Add(audioMedia);
 }
Exemplo n.º 11
0
        public override bool Equals(object obj)
        {
            AbMediaContent otherMedia = obj as AbMediaContent;

            return(otherMedia.filePath == this.filePath);
        }
Exemplo n.º 12
0
        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);
        }