public async static Task RewritePageFiles(Page page) { var localFolder = ApplicationData.Current.LocalFolder; var file = await localFolder.TryGetFileAsync(page.FileName); var backupFile = await localFolder.TryGetFileAsync(page.BackupFileName); if (file != null && backupFile != null) { using (var stream = await backupFile.OpenAsync(FileAccessMode.ReadWrite)) { IInputStream inputStream = stream.GetInputStreamAt(0); using (var reader = new DataReader(inputStream)) { await reader.LoadAsync((uint)stream.Size); var buffer = new byte[(int)stream.Size]; reader.ReadBytes(buffer); await FileIO.WriteBytesAsync(file, buffer); } } } }
public async static Task<Page> CreatePageAsync(PhotoCapturedData data) { Page page = new Page(); page.FilePath = page.GetFilePath(); page.BackUpFilePath = page.GetBackUpFilePath(); page.ProcessingFilePath = page.GetProcessingFilePath(); page.FilteredFilePath = page.GetFilteredFilePath(); page.IsFromCamera = data.IsFromCamera; page.DateCreated = page.DateToString(); page.TimeCreated = page.TimeOfDayToString(); page.Number = 1; page.Size = data.ImageFileSize; page.PageName = "Page" + page.Number.ToString(); page.DocumentId = Guid.Empty; return page; }
public async static Task RefreshPageFiles(Page page) { var localFolder = ApplicationData.Current.LocalFolder; var file = await localFolder.TryGetFileAsync(page.FileName); var processingFile = await localFolder.TryGetFileAsync(page.ProcessingFileName); var filteredFile = await localFolder.TryGetFileAsync(page.FilteredFileName); if (file != null && processingFile != null && filteredFile != null) { await file.DeleteAsync(StorageDeleteOption.PermanentDelete); await processingFile.DeleteAsync(StorageDeleteOption.PermanentDelete); await filteredFile.RenameAsync(page.FileName); } }
private void PageItemClick(Page page) { var folder = ApplicationData.Current.TemporaryFolder; this.NavigationContext.NavigationService.NavigateTo("PostProccesView", this.CurrentDocument); }