private async void ListView_ItemTapped(object sender, ItemTappedEventArgs e)
        {
            AbMediaContent media = e.Item as AbMediaContent;

            // If clicked media is a card open card page
            if (media.mediaType == MediaContentType.Card)
            {
                Card card = FSManager.getCard(media.name);
                await Navigation.PushAsync(new CardPage(card));

                return;
            }

            // If clicked media is media box toggle
            if (media.mediaType == MediaContentType.MediaCount)
            {
                MediaCountBox mediaBox = media as MediaCountBox;
                mediaBox.toggleOpen();
                return;
            }

            if (card != null)
            {
                // TODO temp this should just have the card's media
                await Navigation.PushAsync(new CardMediaCarouselPage(media, MediaManager.allMedia));
            }
            else
            {
                await Navigation.PushAsync(new CardMediaCarouselPage(media, MediaManager.allMedia));
            }
        }
        private async void flowListView_FlowItemTapped(object sender, ItemTappedEventArgs e)
        {
            AbMediaContent media = e.Item as AbMediaContent;

            if (media.mediaType == MediaContentType.MediaCount)
            {
                MediaCountBox mediaBox = media as MediaCountBox;
                mediaBox.toggleOpen();
            }
            else
            {
                mediaSelectPageOpen = true;
                bool mediaPrevSelected = media.isSelected;

                // Use wait handle so code only runs after MediaSelectPage disappears
                MediaSelectPage selectPage = new MediaSelectPage(media);
                EventWaitHandle waitHandle = new EventWaitHandle(false, EventResetMode.AutoReset);

                selectPage.Disappearing += (s, v) =>
                {
                    waitHandle.Set();
                };

                await Navigation.PushAsync(selectPage);

                await Task.Run(() => waitHandle.WaitOne());

                if (media.isSelected != mediaPrevSelected)
                {
                    toggleLinkMedia(media);
                    await Navigation.PopAsync();
                }
            }
        }
Ejemplo n.º 3
0
        public void initialize()
        {
            List <AbMediaContent> mediaList = parentLinkCollection.ToList <AbMediaContent>();

            //Create card count box
            List <AbMediaContent> cardList = mediaList.Where
                                                 (media =>
                                                 media.mediaType == MediaContentType.Card).ToList <AbMediaContent>();

            cardBox = new MediaCountBox("CardIcon.png", cardList, this);

            if (cardBox.mediaCount > 0)
            {
                Add(cardBox);
            }

            mediaList = mediaList.Where
                            (media =>
                            media.mediaType != MediaContentType.Card).ToList <AbMediaContent>();


            foreach (AbMediaContent media in mediaList)
            {
                Add(media);
            }

            parentLinkCollection.CollectionChanged += collectionChanged;
        }
Ejemplo n.º 4
0
        private void FlowListView_FlowItemTapped(object sender, ItemTappedEventArgs e)
        {
            if (IsVisible)
            {
                AbMediaContent media = e.Item as AbMediaContent;

                if (media.mediaType == MediaContentType.MediaCount)
                {
                    MediaCountBox mediaBox = media as MediaCountBox;
                    mediaBox.toggleOpen();
                }
                else
                {
                    selectMedia(media);
                }
            }
        }
Ejemplo n.º 5
0
        // TODO perhaps move behavior to DayMediaObservableCollection
        private async void flowListView_FlowItemTapped(object sender, ItemTappedEventArgs e)
        {
            AbMediaContent media = e.Item as AbMediaContent;

            if (!isSelecting)
            {
                if (media.mediaType == MediaContentType.MediaCount)
                {
                    MediaCountBox mediaBox = media as MediaCountBox;
                    mediaBox.toggleOpen();
                }
                else // NOTE: reusing CardMediaCarouselPage will break disappear logic in MediaDisplayView
                {
                    await Navigation.PushAsync(new CardMediaCarouselPage(media, MediaManager.allMedia));
                }
            }
        }
Ejemplo n.º 6
0
        public void toggleMediaBoxOpen(MediaCountBox mediaBox)
        {
            if (mediaBox.isOpen)
            {
                int mediaBoxIndex = this.IndexOf(mediaBox) + 1;

                // TODO SLOW OPERATION
                List <AbMediaContent> mediaList = mediaBox.mediaList;
                for (int i = mediaBox.mediaList.Count - 1; i >= 0; i--)
                {
                    Insert(mediaBoxIndex, mediaList[i]);
                }
            }
            else
            {
                // TODO SLOW OPERATION
                foreach (AbMediaContent media in mediaBox.mediaList)
                {
                    Remove(media);
                }
            }
        }