internal static async Task <ReportItem> CreateReportItemAsync(string title, string description, IMappablePoint point, IStorageFile image) { var item = new ReportItem() { Title = title, Description = description, NativeId = Guid.NewGuid().ToString(), Status = ReportItemStatus.New }; item.SetLocation(point); // save... var conn = StreetFooRuntime.GetUserDatabase(); await conn.InsertAsync(item); // stage the image... if (image != null) { // new path... var manager = new ReportImageCacheManager(); var folder = await manager.GetCacheFolderAsync(); // create... await image.CopyAsync(folder, item.NativeId + ".jpg"); } // return... return(item); }
private async Task StageImageAsync(IStorageFile image) { // new path... var manager = new ReportImageCacheManager(); var folder = await manager.GetCacheFolderAsync(); // save it as a file that's no longer than 640 pixels on its longest edge... var newImage = await folder.CreateFileAsync(this.NativeId + ".jpg", CreationCollisionOption.ReplaceExisting); await ImageHelper.ResizeAndSaveAsAsync(image, newImage, 640); }
internal static async Task<ReportItem> CreateReportItemAsync(string title, string description, IMappablePoint point, IStorageFile image) { var item = new ReportItem() { Title = title, Description = description, NativeId = Guid.NewGuid().ToString(), Status = ReportItemStatus.New }; item.SetLocation(point); // save... var conn = StreetFooRuntime.GetUserDatabase(); await conn.InsertAsync(item); // stage the image... if (image != null) { // new path... var manager = new ReportImageCacheManager(); var folder = await manager.GetCacheFolderAsync(); // create... await image.CopyAsync(folder, item.NativeId + ".jpg"); } // return... return item; }