示例#1
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 };
        }
 public void CreatePrinterMoveDelta()
 {
     var canvas = new InkCanvas();
     var contentBuffer = new ContentBuffer();
     var moveDeltaProcessor = new PrinterMoveDeltaProcessor(canvas, "presentationSpace", contentBuffer);
 }