public async static void DeleteDocumentPagesFiles(Document document) { var localFolder = ApplicationData.Current.LocalFolder; foreach (var page in document.Pages) { var file = await localFolder.TryGetFileAsync(page.FileName); if (file != null) { await file.DeleteAsync(StorageDeleteOption.PermanentDelete); } var backupFile = await localFolder.TryGetFileAsync(page.BackupFileName); if (backupFile != null) { await backupFile.DeleteAsync(StorageDeleteOption.PermanentDelete); } var processingFile = await localFolder.TryGetFileAsync(page.ProcessingFileName); if (processingFile != null) { await processingFile.DeleteAsync(StorageDeleteOption.PermanentDelete); } } }
public async Task<bool> PinDocumentTile(Document document) { string tileId = document.ID.ToString(); string arguements = tileId + "/" + "Document"; string displayName = document.DocumentName; bool isPinned = false; if (!SecondaryTile.Exists(tileId)) { var secondaryTile = new SecondaryTile(); secondaryTile.TileId = tileId; secondaryTile.ShortName = "2nd tile"; secondaryTile.DisplayName = displayName; secondaryTile.Arguments = arguements; secondaryTile.Logo = new Uri("ms-appdata:///local/картинка031.jpg"); isPinned = await secondaryTile.RequestCreateAsync(); return isPinned; } return isPinned; }
public static void CopyDocument(Document src, Document dst) { dst.ID = src.ID; dst.DocumentSize = src.DocumentSize; dst.DocumentCategory = src.DocumentCategory; dst.DateCreated = src.DateCreated; dst.DocumentName = src.DocumentName; dst.TimeCreated = src.TimeCreated; foreach (var page in src.Pages) { dst.Pages.Add(page); } }
public async static Task<Document> CreateDocumentAsync(PhotoCapturedData capturedData) { var createdDocument = new Document(capturedData.CategoryName); var firstPage = await Page.CreatePageAsync(capturedData); firstPage.DocumentId = createdDocument.ID; createdDocument.Pages.Add(firstPage); createdDocument.DocumentSize = firstPage.MbSize; return createdDocument; }
private async void MergePages() { if (this.SelectedItems.Count < 2) { return; } IList<Page> selectedPages = this.CastSelectedItems(); var docWithMergedPages = new Document(this.CurrentDocument.DocumentCategory); foreach (var page in selectedPages) { docWithMergedPages.Pages.Add(page); this.CurrentDocument.DocumentSize -= page.MbSize; this.CurrentDocument.Pages.Remove(page); } await SerializationProvider.Instance.AddDocument(docWithMergedPages); await SerializationProvider.Instance.UpdateDocument(this.CurrentDocument); var arguements = new DocumentPageArguements() { DocumentId = docWithMergedPages.ID, PreviousPageName = "DocumentView", }; this.UpdatePageNumbers(); this.NavigationContext.NavigationService.NavigateTo("DocumentView", arguements); }
private void HandleDocument(Document d) { if (this.CurrentCategory.CategoryDocuments == null) { this.CurrentCategory.CategoryDocuments = new ObservableCollection<Document>(); } this.CurrentCategory.CategoryDocuments.Add(d); }
private void DocumentItemClick(Document clickedItem) { var arguements = new DocumentPageArguements() { DocumentId = clickedItem.ID, PreviousPageName = "CurrentCategoryView", }; this.NavigationContext.NavigationService.NavigateTo("DocumentView", arguements); }
private void DocumentItemClick(Document clickedItem) { var arguements = new DocumentPageArguements() { DocumentId = clickedItem.ID, PreviousPageName = "MainView", }; this.NavigationContext.NavigationService.NavigateTo(NavigationSource.DocumentView.ToString(), arguements); }