コード例 #1
0
        private void ReAddFilteredContent(MeTLInkCanvas canvas, ContentBuffer contentBuffer, List<ContentVisibilityDefinition> contentVisibility)
        {
            canvas.Strokes.Clear();
            canvas.Strokes.Add(new StrokeCollection(contentBuffer.FilteredStrokes(contentVisibility).Select(s => s as Stroke)));

            canvas.Children.Clear();
            foreach (var child in contentBuffer.FilteredTextBoxes(contentVisibility))
                canvas.Children.Add(child);
            foreach (var child in contentBuffer.FilteredImages(contentVisibility))
                canvas.Children.Add(child);
        }
コード例 #2
0
        private IEnumerable<MeTLInkCanvas> createVisual(string target, bool includePublic)
        {
            var canvas = new MeTLInkCanvas();
            var contentBuffer = new ContentBuffer();
            moveDeltaProcessor = new PrinterMoveDeltaProcessor(canvas, target,contentBuffer);
            foreach (var stroke in ink)
            {
                if ((includePublic && stroke.privacy == Privacy.Public) || stroke.target == target)
                    contentBuffer.AddStroke(new PrivateAwareStroke(stroke.stroke, target), s => canvas.Strokes.Add(s));
            }
            foreach (var image in images)
            {
                //var imageToAdd = image.Value.imageSpecification.forceEvaluationForPrinting();
                var imageToAdd = image.Value.imageSpecification.forceEvaluation();
                imageToAdd.tag(image.Value.image.tag());
                if ((includePublic && image.Value.privacy == Privacy.Public) || image.Value.target == target)
                {
                    Panel.SetZIndex(imageToAdd, image.Value.privacy == Privacy.Public ? 1 : 2);
                    contentBuffer.AddImage(imageToAdd, i => canvas.Children.Add(i));
                }
            }
            foreach (var box in text)
            {
                var textbox = box.Value.box;
                textbox.BorderThickness = new Thickness(0);
                textbox.BorderBrush = new SolidColorBrush(Colors.Transparent);
                textbox.Background = new SolidColorBrush(Colors.Transparent);
                if ((includePublic && box.Value.privacy == Privacy.Public) || box.Value.target == target)
                {
                    // positive Z is out of the screen
                    Panel.SetZIndex(textbox, 3);
                    contentBuffer.AddTextBox(textbox.toMeTLTextBox(), t => canvas.Children.Add(t));
                }
            }

            ResizeCanvas(canvas, contentBuffer);
            //foreach (var moveDelta in moveDeltas)
            //    moveDeltaProcessor.ReceiveMoveDelta(moveDelta, SandRibbon.Providers.Globals.me, true);

            if (canvas.Children.Count == 0 && canvas.Strokes.Count == 0)
                return new List<MeTLInkCanvas>();

            var tempPrinter = new PrintDialog();
            var size = new Size(tempPrinter.PrintableAreaWidth, tempPrinter.PrintableAreaHeight);
            canvas.Measure(size);
            canvas.Arrange(new Rect(new Point(0,0), size));

            return new[] { canvas };
        }
コード例 #3
0
 private MeTLInkCanvas visuallyAdjustedVisual(MeTLInkCanvas visual)
 {
     foreach (var box in visual.TextChildren())
     {
         var textbox = (TextBox)box;
         var testSize = new Size(textbox.ActualWidth, textbox.ActualHeight);
         textbox.Measure(testSize);
         textbox.Arrange(new Rect(testSize));
         var lastCharRect = textbox.GetRectFromCharacterIndex(textbox.Text.Count());
         if (textbox.Height < lastCharRect.Bottom)
             textbox.Height = lastCharRect.Bottom;
     }
     return visual;
 }
コード例 #4
0
 private void ResizeCanvas(MeTLInkCanvas canvas, ContentBuffer contentBuffer)
 {
     contentBuffer.AdjustContent();
     ReAddFilteredContent(canvas, contentBuffer, ContentFilterVisibility.printVisibilities);
 }
コード例 #5
0
 public MeTLInkCanvasAutomationPeer(MeTLInkCanvas owner) : base(owner)
 {
 }