internal async Task <IFeedbackMessage> PostMessageAsync(FeedbackMessageVM msgVM) { var msg = await this.FeedbackThread.PostFeedbackMessageAsync(msgVM.Message, msgVM.Email, msgVM.Subject, msgVM.Username, msgVM.Attachments.Select(att => att.FeedbackAttachment)); FeedbackManager.Current.SaveFeedbackThreadTokens(); return(msg); }
internal void HandleSentMessage(IFeedbackMessage sentMsg) { if (!this.Messages.Any(msgVM => msgVM.FeedbackMessage.Id == sentMsg.Id)) { this.Messages.Add(new FeedbackMessageVM(sentMsg as FeedbackMessage)); } this.NewMessage = new FeedbackMessageVM() { FeedbackThreadVM = this }; }
internal static async Task <FeedbackMessageVM> LoadFeedbackMessageVMFromStorageAsync() { var helper = HockeyClient.Current.AsInternal().PlatformHelper; var feedbackVM = new FeedbackMessageVM(); if (await helper.FileExistsAsync(ConstantsUniversal.OpenFeedbackMessageFile, ConstantsUniversal.FeedbackAttachmentTmpDir)) { DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(FeedbackMessage)); using (var stream = await helper.GetStreamAsync(ConstantsUniversal.OpenFeedbackMessageFile, ConstantsUniversal.FeedbackAttachmentTmpDir)) { feedbackVM.FeedbackMessage = serializer.ReadObject(stream) as FeedbackMessage; } var files = await helper.GetFileNamesAsync(ConstantsUniversal.FeedbackAttachmentTmpDir, "*" + FeedbackAttachmentVM.AttachmentFileExt); foreach (var filename in files.ToList().OrderBy(f => f)) { feedbackVM.Attachments.Add(await FeedbackAttachmentVM.LoadFromStorageAsync(filename)); } } return(feedbackVM); }
internal static async Task<FeedbackMessageVM> LoadFeedbackMessageVMFromStorageAsync() { var helper = HockeyClient.Current.AsInternal().PlatformHelper; var feedbackVM = new FeedbackMessageVM(); if (await helper.FileExistsAsync(ConstantsUniversal.OpenFeedbackMessageFile, ConstantsUniversal.FeedbackAttachmentTmpDir)) { DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(FeedbackMessage)); using (var stream = await helper.GetStreamAsync(ConstantsUniversal.OpenFeedbackMessageFile, ConstantsUniversal.FeedbackAttachmentTmpDir)) { feedbackVM.FeedbackMessage = serializer.ReadObject(stream) as FeedbackMessage; } var files = await helper.GetFileNamesAsync(ConstantsUniversal.FeedbackAttachmentTmpDir,"*" + FeedbackAttachmentVM.AttachmentFileExt); foreach(var filename in files.ToList().OrderBy(f => f)) { feedbackVM.Attachments.Add(await FeedbackAttachmentVM.LoadFromStorageAsync(filename)); } } return feedbackVM; }
internal async Task<IFeedbackMessage> PostMessageAsync(FeedbackMessageVM msgVM) { var msg = await this.FeedbackThread.PostFeedbackMessageAsync(msgVM.Message, msgVM.Email, msgVM.Subject, msgVM.Username, msgVM.Attachments.Select(att => att.FeedbackAttachment)); FeedbackManager.Current.SaveFeedbackThreadTokens(); return msg; }