Ejemplo n.º 1
0
        private object ConvertSource(BotResultsCollection collection)
        {
            if (collection == null)
            {
                return(null);
            }
            else if (collection.All(x => x is InlineQueryResultSticker) || collection.All(x => x.IsMedia()))
            {
                if (ScrollingHost.ItemsPanel != VerticalGrid)
                {
                    ScrollingHost.ItemsPanel           = VerticalGrid;
                    ScrollingHost.ItemTemplate         = null;
                    ScrollingHost.ItemTemplateSelector = MediaTemplateSelector;

                    FluidGridView.Update(ScrollingHost);
                }
            }
            else if (ScrollingHost.ItemsPanel != VerticalStack)
            {
                ScrollingHost.ItemsPanel           = VerticalStack;
                ScrollingHost.ItemTemplate         = ResultTemplate;
                ScrollingHost.ItemTemplateSelector = null;
            }

            return(new object());
        }
Ejemplo n.º 2
0
        private object ConvertSource(BotResultsCollection collection)
        {
            if (collection == null)
            {
                return(null);
            }
            else if (collection.All(x => x.IsMedia()) /* animation, photo, video without title */)
            {
                Repeater.Layout       = Resources["MosaicLayout"] as Layout;
                Repeater.ItemTemplate = Resources["MediaTemplate"];
            }
            else if (collection.All(x => x is InlineQueryResultSticker))
            {
                Repeater.Layout       = Resources["GridLayout"] as Layout;
                Repeater.ItemTemplate = Resources["StickerTemplate"];
            }
            else
            {
                Repeater.Layout       = Resources["StackLayout"] as Layout;
                Repeater.ItemTemplate = Resources["ResultTemplate"];
            }

            return(new object());
        }