Пример #1
0
 public Artboard(IViewObjectFactory viewObjectFactory, ViewExceptionCallback viewExceptionCallback)
 {
     this.ViewObjectFactory              = viewObjectFactory;
     this.contentBorder                  = new ArtboardBorder(viewExceptionCallback);
     this.contentBorder.BorderBrush      = (Brush)Brushes.Black;
     this.contentBorder.MinWidth         = 20.0;
     this.contentBorder.MinHeight        = 20.0;
     this.contentBorder.IsHitTestVisible = false;
     TextOptions.SetTextFormattingMode((DependencyObject)this.contentBorder, TextFormattingMode.Ideal);
     this.snapToGridRenderer = new SnapToGridRenderer(this);
     this.snapToGridRenderer.IsHitTestVisible = false;
     this.overlayLayer = new OverlayLayer();
     this.overlayLayer.IsHitTestVisible = false;
     this.adornerLayer = new AdornerLayer();
     this.adornerLayer.IsHitTestVisible  = false;
     this.adornerLayer.IsVisibleChanged += (DependencyPropertyChangedEventHandler)((s, e) => this.UpdateExtensibleAdornersVisibility());
     this.feedbackLayer = new FeedbackLayer();
     this.feedbackLayer.IsHitTestVisible = false;
     this.annotationLayer = new AnnotationLayer();
     this.annotationLayer.IsHitTestVisible = true;
     this.extraLayersCanvas = new Canvas();
     this.extraLayersCanvas.IsHitTestVisible = false;
     this.liveControlLayer = new Canvas();
     this.liveControlLayer.Resources.Add((object)typeof(TextBox), (object)new Style(typeof(TextBox), new TextBox().Style));
     this.liveControlLayer.Resources.Add((object)typeof(RichTextBox), (object)new Style(typeof(RichTextBox), new RichTextBox().Style));
     this.resourcesHost = new Canvas();
     this.resourcesHost.IsHitTestVisible = false;
     this.resourcesHost.Children.Add((UIElement)this.contentBorder);
     this.resourcesHost.Children.Add((UIElement)this.overlayLayer);
     this.designerView       = (DesignerView) new Artboard.BlendDesignerView();
     this.designerView.Child = (UIElement)this.resourcesHost;
     this.canvas             = new Canvas();
     this.canvas.Children.Add((UIElement)this.designerView);
     this.canvas.Children.Add((UIElement)this.liveControlLayer);
     this.canvas.Children.Add((UIElement)this.extraLayersCanvas);
     this.canvas.Children.Add((UIElement)this.snapToGridRenderer);
     this.canvas.Children.Add((UIElement)this.adornerLayer);
     this.canvas.Children.Add((UIElement)this.feedbackLayer);
     this.canvas.Children.Add((UIElement)this.annotationLayer);
     this.childrenVisuals = new VisualCollection((Visual)this);
     this.childrenVisuals.Add((Visual)this.canvas);
     this.adornerService = new AdornerService(this);
     this.SetValue(TabControl.TabStripPlacementProperty, (object)Dock.Top);
     this.InheritanceBehavior     = InheritanceBehavior.SkipToThemeNow;
     this.AllowDrop               = true;
     this.contentBorder.AllowDrop = false;
     AccessKeyManager.AddAccessKeyPressedHandler((DependencyObject)this.contentBorder, new AccessKeyPressedEventHandler(this.Content_AccessKeyPressed));
     AccessKeyManager.AddAccessKeyPressedHandler((DependencyObject)this.overlayLayer, new AccessKeyPressedEventHandler(this.Content_AccessKeyPressed));
     this.contentBorder.PreviewGotKeyboardFocus += new KeyboardFocusChangedEventHandler(this.Content_PreviewGotKeyboardFocus);
     this.overlayLayer.PreviewGotKeyboardFocus  += new KeyboardFocusChangedEventHandler(this.Content_PreviewGotKeyboardFocus);
     this.SetTextDefaults();
 }
Пример #2
0
 internal void TearDown()
 {
     this.contentBorder.Resources = (ResourceDictionary)null;
     this.contentBorder.Child     = (UIElement)null;
     this.contentBorder           = (ArtboardBorder)null;
     this.resourcesHost           = (Canvas)null;
     this.childrenVisuals.Clear();
     if (this.designerView == null)
     {
         return;
     }
     this.designerView.Adorners.Clear();
     this.designerView.Context = (EditingContext)null;
     this.designerView         = (DesignerView)null;
 }