Beispiel #1
0
        private void CopyZipFileToPublicPath()
        {
            UserDialogs.Instance.ShowLoading(Resources.AppResources.Saving);

            _ = TaskRun(() =>
            {
                var result = logFileService.CopyLogUploadingFileToPublicPath(ZipFileName);

                BeginInvokeOnMainThread(async() =>
                {
                    UserDialogs.Instance.HideLoading();

                    if (!result)
                    {
                        await UserDialogs.Instance.AlertAsync(
                            Resources.AppResources.FailedMessageToSaveOperatingInformation,
                            Resources.AppResources.Error,
                            Resources.AppResources.ButtonOk);
                    }
                    else
                    {
                        string message = null;
                        switch (Device.RuntimePlatform)
                        {
                        case Device.Android:
                            message = Resources.AppResources.SuccessMessageToSaveOperatingInformationForAndroid + logPathService.LogUploadingPublicPath + Resources.AppResources.SuccessMessageToSaveOperatingInformationForAndroid2;
                            break;

                        case Device.iOS:
                            message = Resources.AppResources.SuccessMessageToSaveOperatingInformationForIOS;
                            break;
                        }

                        await UserDialogs.Instance.AlertAsync(
                            message,
                            Resources.AppResources.SaveCompleted,
                            Resources.AppResources.ButtonOk);
                    }
                });
            });
        }
        private void CopyZipFileToPublicPath()
        {
            _ = TaskRun(() =>
            {
                var result = logFileService.CopyLogUploadingFileToPublicPath(ZipFileName);

                BeginInvokeOnMainThread(async() =>
                {
                    if (!result)
                    {
                        await UserDialogs.Instance.AlertAsync(
                            Resources.AppResources.FailedMessageToSaveOperatingInformation,
                            Resources.AppResources.Error,
                            Resources.AppResources.ButtonOk);
                    }
                    else
                    {
                        var publicPath           = logPathService.LogUploadingPublicPath;
                        var logUploadingFileName = logFileService.LogUploadingFileName(LogId);
                        var path = Path.Combine(publicPath, logUploadingFileName);

                        try
                        {
                            await Share.RequestAsync(new ShareFileRequest
                            {
                                File = new ShareFile(path)
                            });
                        }
                        catch (NotImplementedInReferenceAssemblyException exception)
                        {
                            loggerService.Exception("NotImplementedInReferenceAssemblyException", exception);
                        }
                    }
                });
            });
        }