Пример #1
0
        private static async Task Initialise(bool bForce = false)
        {
            LocalStorageHelper lsh = new LocalStorageHelper();
            await lsh.DownloadFiles(bForce);

            await lsh.DeserialiseObjects();
        }
Пример #2
0
        private async Task LoadPinnedAndFavouriteCinemas(bool bForce = false)
        {
            LocalStorageHelper lsh = new LocalStorageHelper();

            List <Task> cinemaDownloads = new List <Task>();

            foreach (var tile in await SecondaryTile.FindAllAsync())
            {
                int iCin = int.Parse(tile.TileId);
                PinnedCinemas.Add(iCin);
                cinemaDownloads.Add(lsh.GetCinemaFilmListings(iCin, bForce));

                var SelectedCinema = App.Cinemas[iCin];

                if (SelectedCinema != null)
                {
                    this.SetTile(iCin, SelectedCinema, "Pinned");
                }
            }

            if (Config.FavCinemas != null)
            {
                foreach (int iCin in Config.FavCinemas)
                {
                    if (PinnedCinemas.Contains(iCin))
                    {
                        continue;
                    }

                    if (App.Cinemas.ContainsKey(iCin))
                    {
                        PinnedCinemas.Add(iCin);
                        cinemaDownloads.Add(lsh.GetCinemaFilmListings(iCin, bForce));

                        CinemaInfo ci      = App.Cinemas[iCin];
                        string     message = null;
                        try
                        {
                            this.SetTile(iCin, ci, "Favourite");
                        }
                        catch (Exception ex)
                        {
                            message = ex.Message;
                        }
                    }
                }
            }

            if (cinemaDownloads.Count > 0)
            {
                await Task.WhenAll(cinemaDownloads);
            }
        }
Пример #3
0
        private async Task LoadCinemaDetails()
        {
            Task t = null;

            if (SelectedFilm.Performances == null || SelectedFilm.Performances.Count == 0)
            {
                t = new LocalStorageHelper().GetCinemaFilmListings(SelectedCinema.ID);
            }

            this.spCinemaInfo.Visibility = Windows.UI.Xaml.Visibility.Visible;
            this.radShowCast.Visibility  = Windows.UI.Xaml.Visibility.Collapsed;

            this.spCinemaButtons.Visibility = Windows.UI.Xaml.Visibility.Visible;
            int iCin = SelectedCinema.ID;

            if (!SecondaryTile.Exists(iCin.ToString()))
            {
                this.btnPinToStartMenu.Visibility   = Windows.UI.Xaml.Visibility.Visible;
                this.btnUnPinToStartMenu.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            }
            else
            {
                this.btnUnPinToStartMenu.Visibility = Windows.UI.Xaml.Visibility.Visible;
                this.btnPinToStartMenu.Visibility   = Windows.UI.Xaml.Visibility.Collapsed;
            }

            if (Config.FavCinemas.Contains(iCin))
            {
                this.btnFavourite.Visibility   = Windows.UI.Xaml.Visibility.Collapsed;
                this.btnUnfavourite.Visibility = Windows.UI.Xaml.Visibility.Visible;
            }
            else
            {
                this.btnFavourite.Visibility   = Windows.UI.Xaml.Visibility.Visible;
                this.btnUnfavourite.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            }

            this.dtHideAppBar.Interval    = TimeSpan.FromSeconds(10);
            this.dtHideAppBar.Tick       += dtHideAppBar_Tick;
            this.PerformanceAppBar.IsOpen = true;
            this.dtHideAppBar.Start();

            if (t != null)
            {
                await t;
                SelectedFilm = App.CinemaFilms[SelectedCinema.ID].Find(f => f.EDI == SelectedFilm.EDI);
            }
        }
Пример #4
0
        private async Task LoadCinemaDetails()
        {
            Task t = null;

            if (SelectedFilm.Performances == null || SelectedFilm.Performances.Count == 0)
            {
                t = new LocalStorageHelper().GetCinemaFilmListings(SelectedCinema.ID);
            }

            this.spCinemaInfo.Visibility = Windows.UI.Xaml.Visibility.Visible;
            this.radShowCast.Visibility  = Windows.UI.Xaml.Visibility.Collapsed;

            this.spCinemaButtons.Visibility = Windows.UI.Xaml.Visibility.Visible;
            int iCin = SelectedCinema.ID;

            string cinemastr = SelectedCinema.ID.ToString();
            IReadOnlyList <SecondaryTile> tiles = await SecondaryTile.FindAllAsync();

            SecondaryTile tile = tiles.FirstOrDefault(s => s.TileId == cinemastr);

            if (tile == null)
            {
                this.btnPinToStartMenu.Visibility   = Windows.UI.Xaml.Visibility.Visible;
                this.btnUnPinToStartMenu.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            }
            else
            {
                this.btnUnPinToStartMenu.Visibility = Windows.UI.Xaml.Visibility.Visible;
                this.btnPinToStartMenu.Visibility   = Windows.UI.Xaml.Visibility.Collapsed;
            }

            if (Config.FavCinemas.Contains(iCin))
            {
                this.btnFavourite.Visibility   = Windows.UI.Xaml.Visibility.Collapsed;
                this.btnUnfavourite.Visibility = Windows.UI.Xaml.Visibility.Visible;
            }
            else
            {
                this.btnFavourite.Visibility   = Windows.UI.Xaml.Visibility.Visible;
                this.btnUnfavourite.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            }

            if (t != null)
            {
                await t;
                SelectedFilm = App.CinemaFilms[SelectedCinema.ID].Find(f => f.EDI == SelectedFilm.EDI);
            }
        }
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (App.Cinemas == null || App.Cinemas.Count == 0)
            {
                this.SpinAndWait(true);

                LocalStorageHelper lsh = new LocalStorageHelper();
                await lsh.DownloadFiles();

                await lsh.DeserialiseObjects();

                this.SpinAndWait(false);
            }

            base.OnNavigatedTo(e);
        }
Пример #6
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (!Config.ShowCleanBackground)
            {
                this.LayoutRoot.Background = new ImageBrush()
                {
                    ImageSource = new BitmapImage(new Uri(this.BaseUri, "/Assets/Cineworld_V2_846x468.png")),
                    Opacity     = 0.2,
                    Stretch     = Stretch.UniformToFill
                };
            }

            this.AllowSearch(false);

            DataTransferManager.GetForCurrentView().DataRequested += CinemaDetails_DataRequested;

            SpinAndWait(true);

            int iCin = (int)e.Parameter;

            bool bError = false;

            try
            {
                if (App.Cinemas == null || App.Cinemas.Count == 0)
                {
                    LocalStorageHelper lsh = new LocalStorageHelper();
                    await lsh.DownloadFiles(false);

                    await lsh.DeserialiseObjects();
                }

                SelectedCinema = App.Cinemas[iCin];
            }
            catch
            {
                bError = true;
            }

            if (bError)
            {
                await new MessageDialog("Error fetching cinemas details").ShowAsync();
                //return;
            }
            else
            {
                if (SelectedCinema != null)
                {
                    LoadCinemaDetails();
                }

                try
                {
                    if (!App.CinemaFilms.ContainsKey(iCin))
                    {
                        await new LocalStorageHelper().GetCinemaFilmListings(SelectedCinema.ID, false);
                    }

                    LoadFilmList(App.CinemaFilms[SelectedCinema.ID]);

                    string cinemastr = SelectedCinema.ID.ToString();
                    IReadOnlyList <SecondaryTile> tiles = await SecondaryTile.FindAllAsync();

                    SecondaryTile tile = tiles.FirstOrDefault(t => t.TileId == cinemastr);

                    if (tile == null)
                    {
                        this.btnPinToStartMenu.Visibility   = Windows.UI.Xaml.Visibility.Visible;
                        this.btnUnPinToStartMenu.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                    }
                    else
                    {
                        this.btnUnPinToStartMenu.Visibility = Windows.UI.Xaml.Visibility.Visible;
                        this.btnPinToStartMenu.Visibility   = Windows.UI.Xaml.Visibility.Collapsed;
                    }

                    if (Config.FavCinemas.Contains(iCin))
                    {
                        this.btnFavourite.Visibility   = Windows.UI.Xaml.Visibility.Collapsed;
                        this.btnUnfavourite.Visibility = Windows.UI.Xaml.Visibility.Visible;
                    }
                    else
                    {
                        this.btnFavourite.Visibility   = Windows.UI.Xaml.Visibility.Visible;
                        this.btnUnfavourite.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                    }
                }
                catch
                {
                    bError = true;
                }

                if (bError)
                {
                    await new MessageDialog("Error downloading showtime data").ShowAsync();
                }
            }

            SpinAndWait(false);
        }
Пример #7
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (!Config.ShowCleanBackground)
            {
                this.LayoutRoot.Background = new ImageBrush()
                {
                    ImageSource = new BitmapImage(new Uri(this.BaseUri, "/Assets/Cineworld_V2_846x468.png")),
                    Opacity     = 0.2,
                    Stretch     = Stretch.UniformToFill
                };
            }

            this.AllowSearch(false);

            //if (!Landing.bLoaded)
            //{
            //    SettingsPane.GetForCurrentView().CommandsRequested -= MainPage_CommandsRequested;

            //    SettingsPane.GetForCurrentView().CommandsRequested += MainPage_CommandsRequested;
            //}

            DataTransferManager.GetForCurrentView().DataRequested += CinemaDetails_DataRequested;

            SpinAndWait(true);

            int iCin = (int)e.Parameter;

            bool bError = false;

            try
            {
                if (App.Cinemas == null || App.Cinemas.Count == 0)
                {
                    LocalStorageHelper lsh = new LocalStorageHelper();
                    await lsh.DownloadFiles(false);

                    await lsh.DeserialiseObjects();
                }

                SelectedCinema = App.Cinemas[iCin];
            }
            catch
            {
                bError = true;
            }

            if (bError)
            {
                await new MessageDialog("Error fetching cinemas details").ShowAsync();
                //return;
            }
            else
            {
                if (SelectedCinema != null)
                {
                    LoadCinemaDetails();
                }

                try
                {
                    if (!App.CinemaFilms.ContainsKey(iCin))
                    {
                        await new LocalStorageHelper().GetCinemaFilmListings(SelectedCinema.ID, false);
                    }

                    LoadFilmList(App.CinemaFilms[SelectedCinema.ID]);

                    if (!SecondaryTile.Exists(iCin.ToString()))
                    {
                        this.btnPinToStartMenu.Visibility   = Windows.UI.Xaml.Visibility.Visible;
                        this.btnUnPinToStartMenu.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                    }
                    else
                    {
                        this.btnUnPinToStartMenu.Visibility = Windows.UI.Xaml.Visibility.Visible;
                        this.btnPinToStartMenu.Visibility   = Windows.UI.Xaml.Visibility.Collapsed;
                    }

                    if (Config.FavCinemas.Contains(iCin))
                    {
                        this.btnFavourite.Visibility   = Windows.UI.Xaml.Visibility.Collapsed;
                        this.btnUnfavourite.Visibility = Windows.UI.Xaml.Visibility.Visible;
                    }
                    else
                    {
                        this.btnFavourite.Visibility   = Windows.UI.Xaml.Visibility.Visible;
                        this.btnUnfavourite.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                    }

                    this.dtHideAppBar.Interval      = TimeSpan.FromSeconds(10);
                    this.dtHideAppBar.Tick         += dtHideAppBar_Tick;
                    this.cinemaDetailsAppBar.IsOpen = true;
                    this.dtHideAppBar.Start();
                }
                catch
                {
                    bError = true;
                }

                if (bError)
                {
                    await new MessageDialog("Error downloading showtime data").ShowAsync();
                }
            }

            SpinAndWait(false);
        }