Exemple #1
0
        public async Task <InkStrokeContainer> LoadInking(int pageNumber)
        {
            // Load inking from Ink Dictionary if exist
            InkStrokeContainer inkStrokeContainer;

            if (!inkDictionary.TryGetValue(pageNumber, out inkStrokeContainer))
            {
                // Try to load inking from app data folder if inking not found in Ink Dictionary.
                // A new ink stroke container will be returned if no inking found.
                inkStrokeContainer = await inAppInking.LoadInking(pageNumber);

                // Load in-file ink strokes
                List <InkStroke> inPageStrokes = pdfModel.LoadInFileInkAnnotations(pageNumber);
                // Check if any strokes has been deleted.
                List <InkStroke> erasedStrokes = await inAppInking.LoadErasedStrokes(pageNumber);

                // Remove erased strokes from in-file strokes.
                List <InkStroke> remainingStrokes = SubstractInkStrokes(inPageStrokes, erasedStrokes.Select(item => item.Clone()).ToList());
                inkStrokeContainer.AddStrokes(remainingStrokes);
                inkDictionary[pageNumber] = inkStrokeContainer;
            }
            return(inkStrokeContainer);
        }