Example #1
0
        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);
        }