Beispiel #1
0
 public SurveyViewModel(UploadedItem <SurveyResponseModel> response)
 {
     _response               = response;
     NextQuestionCommand     = new Command(NextQuestion, () => CanGoForward);
     PreviousQuestionCommand = new Command(PreviousQuestion, () => CanGoBack);
     NewSurveyCommand        = new Command(NewSurvey, () => IsNotBusy);
     EditLocationCommand     = new Command(EditLocation);
     Init();
 }
Beispiel #2
0
        /// <summary>
        /// Uploads the survey asynchronously.
        /// </summary>
        /// <param name="response">The survey response.</param>
        /// <returns>A task to await the completion of the upload.</returns>
        public static async Task UploadAsync(this UploadedItem <SurveyResponseModel> response)
        {
            try
            {
                DependencyService.Get <IMetricsManagerService>().TrackEvent("UploadSurveyResponse");
                await SurveyCloudService.SubmitSurveyResponseAsync(response.Item);

                response.Uploaded = DateTime.Now;
                await response.SaveAsync();
            }
            catch (Exception ex)
            {
                DependencyService.Get <IMetricsManagerService>().TrackException("UploadSurveyResponseFailed", ex);
                throw;
            }
        }
Beispiel #3
0
 private void addSuccessItem(UploadItemVO vo)
 {
     if (this.InvokeRequired)
     {
         this.Invoke(new AddSuccessItem(addSuccessItem), vo);
     }
     else
     {
         if (vo.status == "success")
         {
             successList.Add(vo);
             UploadedItem ui = new UploadedItem(this, vo);
         }
         //uploading_FileCountLabel.Text = "正在上传" + uploadHelper.uploadingFileCount + "个文档";
         uploaded_FileCountLabel.Text = "上传成功" + successList.Count() + "个文档";
     }
 }
Beispiel #4
0
        public SurveyLocationViewModel(UploadedItem <SurveyResponseModel> response, bool updateLocation)
        {
            _response = response;
            UseLastLocationCommand = new Command(UseLastLocation, () => CanUseLastLocation);
            StartSurveyCommand     = new Command(StartSurvey, () => CanGoForward);
            UpdateLocationCommand  = new Command(UseCurrentLocation);
            IsUpdateLocation       = updateLocation;

            if (!updateLocation)
            {
                IsBusy = true;
                InitializeLocation();
            }
            else
            {
                Position = PrettyPrintPosition();
            }
        }
Beispiel #5
0
        /// <summary>
        /// Deletes the survey from local storage asynchronously.
        /// </summary>
        /// <param name="response">The survey response.</param>
        /// <returns>A task to await the delete operation.</returns>
        public static Task DeleteAsync(this UploadedItem <SurveyResponseModel> response)
        {
            var fileHelper = new FileHelper();

            return(fileHelper.DeleteAsync(response.Item.GetFilename()));
        }
Beispiel #6
0
 public SurveyLocationPage(UploadedItem <SurveyResponseModel> response, bool updateLocation)
     : this(new SurveyLocationViewModel(response, updateLocation))
 {
 }
Beispiel #7
0
 public SurveyPage(UploadedItem <SurveyResponseModel> response)
     : this(new SurveyViewModel(response))
 {
 }