Beispiel #1
0
 private async void UploadScoreImage()
 {
     if (_commonHelper.IsNetWorkConnected() == true)
     {
         try
         {
             if (!_localScoreService.CheckTaskStatus(_disId))
             {
                 _commonFun.AlertLongText("请全部结束检查后,再上传数据");
                 return;
             }
             string size = _commonFun.GetFilesSizeOfUpload();
             if (await _commonFun.Confirm("上传文件大小为:" + size + " 以上, 建议在Wifi环境下进行。确定要上传吗?"))
             {
                 try
                 {
                     _commonFun.ShowLoading("上传中...");
                     await _commonFun.UploadLocalFileToServer();
                     await _remoteService.UploadScoreInfo(0);
                     await MasterDataDownloadHelper.DownloadData("1");
                     GetLocalPlans(_disId);
                     _commonFun.HideLoading();
                     _commonFun.AlertLongText("上传完毕");
                 }
                 catch (Exception ex)
                 {
                     _commonFun.AlertLongText("上传异常,请重试");
                     _commonFun.HideLoading();
                 }
                 finally
                 {
                     _commonFun.HideLoading();
                 }
             }
         }
         catch (OperationCanceledException)
         {
             _commonFun.AlertLongText("保存超时,请重试");
         }
         catch (Exception ex)
         {
             _commonFun.AlertLongText("上传失败,请重试");
         }
         finally
         {
             _commonFun.HideLoading();
         }
     }
     else
     {
         _commonFun.AlertLongText("网络连接异常。");
     }
 }
        private async void SaveRegistCore()
        {
            if (_commonHelper.IsNetWorkConnected() == true)
            {
                try
                {
                    string size = _commonFun.GetFilesSizeOfUpload();
                    if (await _commonFun.Confirm("上传文件大小为:" + size + "以上, 建议在Wifi环境下进行。确定要上传吗?"))
                    {
                        try
                        {
                            //_commonFun.ShowLoading("上传中...");
                            await _commonFun.UploadLocalFileToServer();

                            await _remoteService.UploadScoreInfo(0);

                            _commonFun.HideLoading();
                            _commonFun.AlertLongText("上传完毕");
                        }
                        catch (Exception)
                        {
                            _commonFun.AlertLongText("上传异常,请重试");
                            _commonFun.HideLoading();
                        }
                        finally
                        {
                            _commonFun.HideLoading();
                        }
                    }
                }
                catch (OperationCanceledException)
                {
                    _commonFun.AlertLongText("保存超时,请重试");
                }
                catch (Exception)
                {
                    _commonFun.AlertLongText("上传异常,请重试");
                }
                finally
                {
                    _commonFun.HideLoading();
                }
            }
            else
            {
                _commonFun.AlertLongText("网络连接异常。");
            }
        }