Beispiel #1
0
        private async void Export(IExporter exporter)
        {
            if (string.IsNullOrEmpty(App.Settings.Common.ParticipantId))
            {
                await App.Current.MainPage.DisplayAlert(Resources.Strings.Error, Resources.Strings.ExportErrorNoParticipantMessage, Resources.Strings.Ok);

                return;
            }

            //to block user for doing anything while uploading info
            await App.Navigation.PushModalAsync(new ExportWaitPage());

            //from time 00:00:00 for From date to 23:59:59 time at To date
            var csv = App.EncounterUtils.ExportEventsToCsv(From, To.AddHours(23).AddMinutes(59).AddSeconds(59));

            var isSuccess = await exporter.SendAsync(csv, App.Settings.Common.ParticipantId);

            if (isSuccess)
            {
                await App.Current.MainPage.DisplayAlert(Resources.Strings.Success, Resources.Strings.ExportSuccessMessage, Resources.Strings.Ok);
            }
            else
            {
                await App.Current.MainPage.DisplayAlert(Resources.Strings.Error, Resources.Strings.ExportErrorMessage, Resources.Strings.Ok);
            }

            await App.Navigation.PopModalAsync();
        }