예제 #1
0
        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);
                }
            }
        }
예제 #2
0
        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;
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
        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;
        }
예제 #5
0
        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);
        }
예제 #6
0
        private void HandleDocument(Document d)
        {
            if (this.CurrentCategory.CategoryDocuments == null)
            {
                this.CurrentCategory.CategoryDocuments = new ObservableCollection<Document>();
            }

            this.CurrentCategory.CategoryDocuments.Add(d);
        }
예제 #7
0
        private void DocumentItemClick(Document clickedItem)
        {
            var arguements = new DocumentPageArguements()
            {
                DocumentId = clickedItem.ID,
                PreviousPageName = "CurrentCategoryView",
            };

            this.NavigationContext.NavigationService.NavigateTo("DocumentView", arguements);
        }
예제 #8
0
        private void DocumentItemClick(Document clickedItem)
        {
            var arguements = new DocumentPageArguements()
            {
                DocumentId = clickedItem.ID,
                PreviousPageName = "MainView",
            };

            this.NavigationContext.NavigationService.NavigateTo(NavigationSource.DocumentView.ToString(),
                arguements);
        }