Example #1
0
        async void LoadImage(PredictionContainer p)
        {
            //bool reload = false;

            //if (!NetworkDatabase.ShowIDs.ContainsKey(p.show.Name) && Application.Current.Properties.ContainsKey("SHOWID " + p.show.Name))
            //    reload = true;

            var ID = await NetworkDatabase.GetShowID(p.show.Name, p.network.name);

            if (ID > 0)
            {
                if (Device.RuntimePlatform == Device.UWP)
                {
                    var uri = await NetworkDatabase.GetImageURI(ID);

                    ShowImageUri = uri.AbsoluteUri;

                    ShowImage.BindingContext = this;
                    ShowImage.SetBinding(ImageEffect.TextProperty, new Binding("ShowImageUri"));

                    p.IsLoaded          = true;
                    ShowImage.IsVisible = true;
                    //ImageLoading.IsVisible = false;
                }
                else
                {
                    ShowImage.Source = new UriImageSource
                    {
                        Uri            = await NetworkDatabase.GetImageURI(ID),
                        CachingEnabled = true,
                        CacheValidity  = new TimeSpan(90, 0, 0, 0)
                    };

                    if (ShowImage.Source != null)
                    {
                        p.IsLoaded             = true;
                        ShowImage.IsVisible    = true;
                        ImageLoading.IsVisible = false;
                    }
                }

                p.Overview = NetworkDatabase.ShowDescriptions[ID];
            }

            //if (reload)
            //{
            //    ID = await NetworkDatabase.GetShowID(p.show.Name, p.network.name, true);

            //    if (ID > 0)
            //    {
            //        ShowImage.Source = new UriImageSource
            //        {
            //            Uri = await NetworkDatabase.GetImageURI(ID),
            //            CachingEnabled = true,
            //            CacheValidity = new TimeSpan(90, 0, 0, 0)
            //        };

            //        p.Overview = NetworkDatabase.ShowDescriptions[ID];
            //    }
            //}

            var TMDBText  = "This product uses the TMDb API but is not endorsed or certified by TMDb.";
            var Formatted = new FormattedString();

            Formatted.Spans.Add(new Span {
                Text = TMDBText
            });

            if (NetworkDatabase.TMDBerror)
            {
                Formatted.Spans.Add(new Span()
                {
                    Text      = "Error connecting to TMDB! Some show details and/or images may temporarily be unavailable.",
                    TextColor = Color.DarkRed
                });
            }

            TMDBNotice.FormattedText = Formatted;

            DelayedScroll.Elapsed  += DelayedScroll_Elapsed;
            DelayedScroll.AutoReset = false;
            ScrollTo();

            CheckVisible.Elapsed += CheckVisible_Elapsed;
        }
Example #2
0
        protected override async void OnSizeAllocated(double dblWidth, double dblHeight)
        {
            base.OnSizeAllocated(dblWidth, dblHeight);

            var tmpDesktop = isDesktop;

            isDesktop            = dblWidth > (960);
            SideColumn.IsVisible = isDesktop;

            if (isDesktop != tmpDesktop)
            {
                if (isDesktop)
                {
                    FirstColumn.Width  = new GridLength(1, GridUnitType.Star);
                    SecondColumn.Width = new GridLength(1, GridUnitType.Star);
                    if (PreviousItem != null)
                    {
                        PreviousItem.ShowDetails = false;
                        ShowImage.Source         = null;
                        ImageLoading.IsVisible   = true;
                        //bool reload = false;

                        //if (!NetworkDatabase.ShowIDs.ContainsKey(PreviousItem.Name) && Application.Current.Properties.ContainsKey("SHOWID " + PreviousItem.Name))
                        //    reload = true;

                        var ID = await NetworkDatabase.GetShowID(PreviousItem.Name, PreviousItem.network.name);

                        if (ID > 0)
                        {
                            if (Device.RuntimePlatform == Device.UWP)
                            {
                                var uri = await NetworkDatabase.GetImageURI(ID);

                                ShowImageUri = uri.AbsoluteUri;

                                ShowImage.BindingContext = this;
                                ShowImage.SetBinding(ImageEffect.TextProperty, new Binding("ShowImageUri"));

                                PreviousItem.IsLoaded = true;
                                ShowImage.IsVisible   = true;
                                //ImageLoading.IsVisible = false;
                            }
                            else
                            {
                                ShowImage.Source = new UriImageSource
                                {
                                    Uri            = await NetworkDatabase.GetImageURI(ID),
                                    CachingEnabled = true,
                                    CacheValidity  = new TimeSpan(90, 0, 0, 0)
                                };

                                if (ShowImage.Source != null)
                                {
                                    PreviousItem.IsLoaded  = true;
                                    ShowImage.IsVisible    = true;
                                    ImageLoading.IsVisible = false;
                                }
                            }

                            PreviousItem.Overview = NetworkDatabase.ShowDescriptions[ID];
                        }
                    }
                }
                else
                {
                    FirstColumn.Width  = new GridLength(1, GridUnitType.Star);
                    SecondColumn.Width = new GridLength(0);
                    if (PreviousItem != null)
                    {
                        PreviousItem.ShowDetails = true;
                    }
                }
            }
        }
Example #3
0
        private async void ShowsList_ItemTapped(object sender, ItemTappedEventArgs e)
        {
            var p = ShowsList.SelectedItem as PredictionContainer;

            if (PreviousItem != null && PreviousItem != p)
            {
                PreviousItem.ShowDetails = false;
                if (SidePanel.BreakdownView != null)
                {
                    FadeOut(false);
                }
            }

            SidePanel.BindingContext = p;
            SidePanel.IsVisible      = true;

            SidePanel_PanelOpened(this, new EventArgs());

            if (!isDesktop)
            {
                p.ShowDetails = !p.ShowDetails;
                if (!p.ShowDetails)
                {
                    ShowsList.SelectedItem = null;
                }
            }
            else
            {
                p.ShowDetails          = false;
                ShowImage.Source       = null;
                ShowImageUri           = null;
                ImageLoading.IsVisible = true;

                //var ID = await NetworkDatabase.GetShowID(p.Name, p.network.name);

                //if (ID > 0)
                //{
                //    ShowImage.Source = new UriImageSource
                //    {
                //        Uri = await NetworkDatabase.GetImageURI(ID),
                //        CachingEnabled = true,
                //        CacheValidity = new TimeSpan(90, 0, 0, 0)
                //    };

                //    p.Overview = NetworkDatabase.ShowDescriptions[ID];

                //    if (ShowImage.Source != null)
                //    {
                //        p.IsLoaded = true;
                //        ShowImage.IsVisible = true;
                //        ImageLoading.IsVisible = false;
                //    }
                //}

                //bool reload = false;

                //if (!NetworkDatabase.ShowIDs.ContainsKey(p.Name) && Application.Current.Properties.ContainsKey("SHOWID " + p.Name))
                //    reload = true;

                var ID = await NetworkDatabase.GetShowID(p.show.Name, p.network.name);

                if (ID > 0)
                {
                    if (Device.RuntimePlatform == Device.UWP)
                    {
                        var uri = await NetworkDatabase.GetImageURI(ID);

                        ShowImageUri = uri.AbsoluteUri;

                        ShowImage.BindingContext = this;
                        ShowImage.SetBinding(ImageEffect.TextProperty, new Binding("ShowImageUri"));

                        p.IsLoaded          = true;
                        ShowImage.IsVisible = true;
                        //ImageLoading.IsVisible = false;
                    }
                    else
                    {
                        ShowImage.Source = new UriImageSource
                        {
                            Uri            = await NetworkDatabase.GetImageURI(ID),
                            CachingEnabled = true,
                            CacheValidity  = new TimeSpan(90, 0, 0, 0)
                        };

                        if (ShowImage.Source != null)
                        {
                            p.IsLoaded             = true;
                            ShowImage.IsVisible    = true;
                            ImageLoading.IsVisible = false;
                        }
                    }

                    p.Overview = NetworkDatabase.ShowDescriptions[ID];
                }



                //if (reload)
                //{
                //    ID = await NetworkDatabase.GetShowID(p.Name, p.network.name, true);

                //    if (ID > 0)
                //    {
                //        ShowImage.Source = new UriImageSource
                //        {
                //            Uri = await NetworkDatabase.GetImageURI(ID),
                //            CachingEnabled = true,
                //            CacheValidity = new TimeSpan(90, 0, 0, 0)
                //        };
                //        p.Overview = NetworkDatabase.ShowDescriptions[ID];
                //    }
                //}

                var TMDBText  = "This product uses the TMDb API but is not endorsed or certified by TMDb.";
                var Formatted = new FormattedString();
                Formatted.Spans.Add(new Span {
                    Text = TMDBText
                });

                if (NetworkDatabase.TMDBerror)
                {
                    Formatted.Spans.Add(new Span()
                    {
                        Text      = "Error connecting to TMDB! Some show details and/or images may temporarily be unavailable.",
                        TextColor = Color.DarkRed
                    });
                }

                TMDBNotice.FormattedText = Formatted;

                DelayedScroll.Elapsed  += DelayedScroll_Elapsed;
                DelayedScroll.AutoReset = false;
                DelayedScroll.Start();

                CheckVisible.Elapsed += CheckVisible_Elapsed;
            }



            PreviousItem = p;
        }
Example #4
0
        protected override async void OnSizeAllocated(double width, double height)
        {
            base.OnSizeAllocated(width, height);

            // fix for carouselview orientation bug on android
            //if (Device.RuntimePlatform == Device.Android)
            //{
            //    YearList.Orientation =
            //        CarouselViewOrientation.Vertical;
            //    YearList.Orientation =
            //        CarouselViewOrientation.Horizontal;
            //}

            var tmpDesktop = isDesktop;

            isDesktop            = width > (1080);
            SideColumn.IsVisible = isDesktop;

            if (isDesktop != tmpDesktop)
            {
                if (isDesktop)
                {
                    FirstColumn.Width  = new GridLength(1, GridUnitType.Star);
                    SecondColumn.Width = new GridLength(1, GridUnitType.Star);
                    if (LastItem != null)
                    {
                        LastItem.ShowDetails   = false;
                        ShowImage.Source       = null;
                        ImageLoading.IsVisible = true;

                        //var ID = await NetworkDatabase.GetShowID(LastItem.Name, LastItem.network.name);

                        //if (ID > 0)
                        //{
                        //    ShowImage.Source = await NetworkDatabase.GetImageURI(ID);
                        //    LastItem.Overview = NetworkDatabase.ShowDescriptions[ID];

                        //    ShowImage.IsVisible = true;
                        //    ImageLoading.IsVisible = false;
                        //}

                        //bool reload = false;

                        //if (!NetworkDatabase.ShowIDs.ContainsKey(LastItem.Name) && Application.Current.Properties.ContainsKey("SHOWID " + LastItem.Name))
                        //    reload = true;

                        var ID = await NetworkDatabase.GetShowID(LastItem.show.Name, LastItem.network.name);

                        if (ID > 0)
                        {
                            if (Device.RuntimePlatform == Device.UWP)
                            {
                                var uri = await NetworkDatabase.GetImageURI(ID);

                                ShowImageUri = uri.AbsoluteUri;

                                ShowImage.BindingContext = this;
                                ShowImage.SetBinding(ImageEffect.TextProperty, new Binding("ShowImageUri"));

                                LastItem.IsLoaded   = true;
                                ShowImage.IsVisible = true;
                                //ImageLoading.IsVisible = false;
                            }
                            else
                            {
                                ShowImage.Source = new UriImageSource
                                {
                                    Uri            = await NetworkDatabase.GetImageURI(ID),
                                    CachingEnabled = true,
                                    CacheValidity  = new TimeSpan(90, 0, 0, 0)
                                };

                                if (ShowImage.Source != null)
                                {
                                    LastItem.IsLoaded      = true;
                                    ShowImage.IsVisible    = true;
                                    ImageLoading.IsVisible = false;
                                }
                            }

                            LastItem.Overview = NetworkDatabase.ShowDescriptions[ID];
                        }

                        //if (reload)
                        //{
                        //    ID = await NetworkDatabase.GetShowID(LastItem.Name, LastItem.network.name, true);

                        //    if (ID > 0)
                        //    {
                        //        ShowImage.Source = new UriImageSource
                        //        {
                        //            Uri = await NetworkDatabase.GetImageURI(ID),
                        //            CachingEnabled = true,
                        //            CacheValidity = new TimeSpan(90, 0, 0, 0)
                        //        };
                        //        LastItem.Overview = NetworkDatabase.ShowDescriptions[ID];
                        //    }
                        //}
                    }
                }
                else
                {
                    FirstColumn.Width  = new GridLength(1, GridUnitType.Star);
                    SecondColumn.Width = new GridLength(0);
                    if (LastItem != null)
                    {
                        LastItem.ShowDetails = true;
                    }
                }
            }
        }