Ejemplo n.º 1
0
        public async void RefreshPredictions_Clicked(object sender, EventArgs e)
        {
            if (Connectivity.NetworkAccess == NetworkAccess.Internet)
            {
                if (File.Exists(Path.Combine(NetworkDatabase.Folder, "Update.txt")))
                {
                    File.Delete(Path.Combine(NetworkDatabase.Folder, "Update.txt"));
                }

                if (File.Exists(Path.Combine(NetworkDatabase.Folder, "Predictions.TVP")))
                {
                    File.Delete(Path.Combine(NetworkDatabase.Folder, "Predictions.TVP"));
                }

                Activity.IsRunning = true;
                CurrentStatus.Text = "Downloading Latest Predictions...";

                RefreshPredictions.IsVisible = false;
                await NetworkDatabase.ReadUpdateAsync();
            }
            else
            {
                await DisplayAlert("TV Predictions", "Not Connected to the Internet! Try again later.", "Close");
            }
        }
Ejemplo n.º 2
0
        public async void CheckForUpdate(bool resuming = false)
        {
            var BlogPath     = Path.Combine(NetworkDatabase.Folder, "Update.txt");
            var SettingsPath = Path.Combine(NetworkDatabase.Folder, "Predictions.TVP");

            NetworkDatabase.mainpage = this;

            //Only download new predictions if it's been at least a week from the Saturday included in those predictions
            if (File.Exists(SettingsPath) && File.Exists(BlogPath))
            {
                var week = new PredictionWeek();
                if (DateTime.Now - week.Saturday > new TimeSpan(7, 0, 0, 0))
                {
                    await NetworkDatabase.ReadUpdateAsync();
                }
                else if (!resuming)
                {
                    await NoUpdate();
                }
            }
            else
            {
                await NetworkDatabase.ReadUpdateAsync();
            }
        }