public void CreateStackMoveDelta()
        {
            var canvas = new InkCanvas();
            var contentBuffer = new ContentBuffer();

            var moveDeltaProcessor = new StackMoveDeltaProcessor(canvas, contentBuffer, "presentationSpace");
        }
Esempio n. 2
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);
        }
        private static void ApplyShadowEffect(FrameworkElement element, ContentBuffer contentBuffer, Color color)
        {
            ApplyShadowEffect(element, color);

            if (contentBuffer != null)
            {
                contentBuffer.UpdateChild(element, (elem) =>
                {
                    elem.Effect = CreateShadowEffect(color); 
                    elem.Opacity = PRIVATE_OPACITY;
                });
            }
        }
 public static void RemovePrivacyStyling(this FrameworkElement element, ContentBuffer contentBuffer)
 {
     RemovePrivacyStyling(element);
     
     if (contentBuffer != null)
     {
         contentBuffer.UpdateChild(element, (elem) =>
         {
             elem.Effect = null;
             elem.Opacity = PUBLIC_OPACITY;
         });
     }
 }
Esempio n. 5
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 static void ApplyPrivacyStyling(this FrameworkElement element, ContentBuffer contentBuffer, string target, Privacy newPrivacy)
        {
            if ((!Globals.conversationDetails.Permissions.studentCanWorkPublicly && !Globals.isAuthor) || (target == "notepad"))
            {
                element.RemovePrivacyStyling(contentBuffer); 
                return;
            }
            if (newPrivacy != Privacy.Private)
            {
                element.RemovePrivacyStyling(contentBuffer); 
                return;
            }

            ApplyShadowEffect(element, contentBuffer, Colors.Black);
        }
 public StackMoveDeltaProcessor(InkCanvas canvas, ContentBuffer contentBuffer, string target) : base(canvas, target, contentBuffer)
 {
     ContentBuffer = contentBuffer;
 }
 public void CreatePrinterMoveDelta()
 {
     var canvas = new InkCanvas();
     var contentBuffer = new ContentBuffer();
     var moveDeltaProcessor = new PrinterMoveDeltaProcessor(canvas, "presentationSpace", contentBuffer);
 }
 protected MoveDeltaProcessor(InkCanvas canvas, string target, ContentBuffer contentBuffer)
 {
     this.Canvas = canvas;
     this.Target = target;
     this.contentBuffer = contentBuffer;
 }
Esempio n. 10
0
 private void ResizeCanvas(MeTLInkCanvas canvas, ContentBuffer contentBuffer)
 {
     contentBuffer.AdjustContent();
     ReAddFilteredContent(canvas, contentBuffer, ContentFilterVisibility.printVisibilities);
 }
 public PrinterMoveDeltaProcessor(InkCanvas canvas, string target, ContentBuffer contentBuffer) : base(canvas, target, contentBuffer)
 {
 }