public BasicGameMainShellView(IGamePlatform customPlatform,
                                      IGameInfo gameData,
                                      BasicData basicData,
                                      IStartUp start,
                                      IStandardScreen screen)
        {
            UIPlatform.ShowMessageAsync = (async message =>
            {
                await DisplayAlert("Message", message, "Okay");
                customPlatform.ResetPopups();
            });
            UIPlatform.ShowError = (async message =>
            {
                await DisplayAlert("Error", message, "Okay");
                UIPlatform.ExitApp();
            });

            NavigationPage.SetHasNavigationBar(this, false);
            GameData       = gameData;
            BasicData      = basicData;
            _start         = start;
            _screen        = screen;
            CustomPlatform = customPlatform;
            BuildXAMLAsync().Wait();
        }
        async Task IMovieLoaderLogic.FinishMovieAsync(IMainMovieTable selectedMovie)
        {
            selectedMovie.ResumeAt = null;
            await UpdateMovieAsync(selectedMovie);

            UIPlatform.ExitApp();
        }
        async Task <bool> IProgressMusicPlayer.NextSongAsync()
        {
            if (_playlistId == null)
            {
                throw new BasicBlankException("Can't go to next song because we don't have a playlist id.  rethink");
            }
            _mp3.StopPlay();
            if (SongsLeft == 0)
            {
                //we needed to clear songs, not delete songs.
                await _data.ErasePlayListAsync(_playlistId.Value);

                UIPlatform.ExitApp(); //go ahead and exit at this point.
                return(false);        //i think.  even this can't hurt.
            }
            UpTo++;
            SongsLeft--;
            //_startedUp = true;
            //_lastResumeAt = 0; //to reset to 0 again.
            await SongInProgressAsync(0); //does not hurt to have this too.

            UpdateProgress.Invoke();      //to let them know something changed.
            if (_currentSong == null)
            {
                throw new BasicBlankException("No current song was sent.  Rethink");
            }
            await _currentSong.PlayNewSongAsync(0); //something else handles actually playing song.

            return(true);
        }
        async Task ITelevisionLoaderLogic.FinishTVEpisodeAsync(IEpisodeTable episode)
        {
            episode.ResumeAt     = null;
            _data.CurrentEpisode = episode;
            await _data.UpdateEpisodeAsync();

            UIPlatform.ExitApp();
        }
        private async Task PrivateShowErrorAsync(string message)
        {
            if (_mainPage == null)
            {
                throw new BasicBlankException("No main page was done.  Rethink");
            }
            await _mainPage.DisplayAlert("Error", message, "okay");

            UIPlatform.ExitApp();
        }
        public async Task SaveAsync()
        {
            if (_data == null)
            {
                throw new BasicBlankException("Should had loaded data.  Rethink");
            }
            await _procs.SaveAsync(_data); //i think

            UIPlatform.ExitApp();
        }
Beispiel #7
0
        async Task <IEpisodeTable?> ITelevisionListLogic.GetNextEpisodeAsync(IShowTable selectedItem)
        {
            var episode = _data.GenerateNewRerunEpisode(selectedItem.ID);

            if (episode == null)
            {
                await UIPlatform.ShowMessageAsync($"There are no more episodes that can be chosen for {selectedItem.ShowName}");

                UIPlatform.ExitApp();
                return(null);
            }
            return(episode); //hopefully this simple.
        }
        protected async Task BuildXAMLAsync()
        {
            BackgroundColor = Color.Navy;
            Padding         = new Thickness(3, 3, 3, 3);
            if (_screen.CanPlay(GameData) == false)
            {
                UIPlatform.ExitApp();
                return; //i know i could not show messagebox.  so it just has to close (because game is not supported for given platform).
            }


            CustomPlatform.SupportedOrientation(GameData);
            OtherCommonButtons();             //not sure if we need but may.
            _start.StartVariables(BasicData); //this is for nick names and any other relevent info needed.
            PrepUI();
            await PopulateUIAsync();

            FinalizeUI();
        }
Beispiel #9
0
        public async Task CloseScreenAsync()
        {
            await SaveProgressAsync();

            UIPlatform.ExitApp();
        }