Beispiel #1
0
        private async void Submit_Clicked(object sender, EventArgs e)
        {
            if (this.BugBodyEntry.Text == "" || String.IsNullOrWhiteSpace((string)this.CategoryPicker.SelectedItem) || this.BugTitleEntry.Text == "")
            {
                await this.DisplayAlert("Cannot Submit", "Please fill all required fields before submitting a bug report.", "Keep editing");
            }
            else
            {
                BugReport report = new BugReport(this.BugTitleEntry.Text, this.CategoryPicker.SelectedItem as string, this.BugBodyEntry.Text, this.ImagePath);
                BugReportHandler.SaveReport(report);
                Task task = Task.Run(() => BugReportHandler.SubmitSavedReports());
                await this.DisplayAlert("Report Saved", "We'll send your report as soon as we can, and our team will take a look at your issue. Thanks for letting us know!", "OK");

                await task;
                await this.Navigation.PopAsync();
            }
        }
Beispiel #2
0
        /// <summary>
        /// Update local data through synchronzing data with server.
        /// Runs on a timed background task and repeats a synchronization every two minutes.
        /// </summary>
        /// <returns></returns>
        public static async Task RunServerChecksAsync()
        {
            await CredentialManager.CheckLoginStatusAsync();

            await Task.Run(async() => await QuizRosterDatabase.UpdateLocalDatabaseAsync());

            var minutes = TimeSpan.FromMinutes(2);

            Device.StartTimer(minutes, () =>
            {
                Task task = Task.Run(async() =>
                {
                    if (CredentialManager.IsLoggedIn)
                    {
                        await CredentialManager.CheckLoginStatusAsync();
                    }

                    await QuizRosterDatabase.UpdateLocalDatabaseAsync();
                    BugReportHandler.SubmitSavedReports();
                });
                // Return true to continue the timer
                return(true);
            });
        }