コード例 #1
0
        public GradientBrushEditor(BrushEditor brushEditor, ITypeId brushType, SceneNodeProperty basisProperty)
            : base(brushEditor, basisProperty)
        {
            IPlatformMetadata platformMetadata = basisProperty.SceneNodeObjectSet.DocumentContext.TypeResolver.PlatformMetadata;

            if (PlatformTypes.LinearGradientBrush.Equals((object)brushType))
            {
                this.brushCategory = BrushCategory.LinearGradient;
            }
            else if (PlatformTypes.RadialGradientBrush.Equals((object)brushType))
            {
                this.brushCategory = BrushCategory.RadialGradient;
            }
            this.editorTemplate            = new DataTemplate();
            this.editorTemplate.VisualTree = new FrameworkElementFactory(typeof(GradientBrushEditorControl));
            this.gradientStopsProperty     = this.RegisterProperty(GradientBrushNode.GradientStopsProperty, (PropertyChangedEventHandler)null);
            this.gradientStopsProperty.PropertyReferenceChanged += new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnGradientStopsChange);
            basisProperty.SceneNodeObjectSet.DesignerContext.GradientToolSelectionService.PropertyChanged += new PropertyChangedEventHandler(this.OnGradientStopSelectionChange);
            this.gradientStops           = new ObservableCollection <GradientStopEditor>();
            this.gradientStopsView       = (ListCollectionView)CollectionViewSource.GetDefaultView((object)this.gradientStops);
            this.sortedGradientStopsView = new ListCollectionView((IList)this.gradientStops);
            this.sortedGradientStopsView.SortDescriptions.Add(new SortDescription("Offset", ListSortDirection.Ascending));
            this.sortedGradientStopsView.SortDescriptions.Add(new SortDescription("PropertyIndex", ListSortDirection.Ascending));
            this.gradientStops.CollectionChanged  += new NotifyCollectionChangedEventHandler(this.OnGradientStopsChanged);
            this.gradientStopsView.CurrentChanged += new EventHandler(this.OnCurrentStopChanged);
            this.RebuildAdvancedProperties();
            this.RebuildModel(-1);
        }
コード例 #2
0
ファイル: TileBrushEditor.cs プロジェクト: radtek/Shopdrawing
 public TileBrushEditor(BrushEditor brushEditor, ITypeId brushType, SceneNodeProperty basisProperty)
     : base(brushEditor, basisProperty)
 {
     if (PlatformTypes.VisualBrush.Equals((object)brushType))
     {
         this.brushCategory = BrushCategory.Visual;
     }
     else if (PlatformTypes.ImageBrush.Equals((object)brushType))
     {
         this.brushCategory = BrushCategory.Image;
     }
     else if (PlatformTypes.DrawingBrush.Equals((object)brushType))
     {
         this.brushCategory = BrushCategory.Drawing;
     }
     else if (PlatformTypes.VideoBrush.Equals((object)brushType))
     {
         this.brushCategory = BrushCategory.Video;
     }
     else if (PlatformTypes.WebBrowserBrush.Equals((object)brushType))
     {
         this.brushCategory = BrushCategory.Html;
     }
     this.editorTemplate            = new DataTemplate();
     this.editorTemplate.VisualTree = new FrameworkElementFactory(typeof(TileBrushEditorControl));
     this.stretchProperty           = this.RegisterProperty(TileBrushNode.StretchProperty, new PropertyChangedEventHandler(this.OnStretchChanged));
     this.tileModeProperty          = this.RegisterProperty(TileBrushNode.TileModeProperty, new PropertyChangedEventHandler(this.OnTileModeChanged));
     this.imageSourceProperty       = this.RegisterProperty(ImageBrushNode.ImageSourceProperty, new PropertyChangedEventHandler(this.OnImageSourceChanged));
     this.opacityProperty           = this.RegisterProperty(BrushNode.OpacityProperty, new PropertyChangedEventHandler(this.OnOpacityChanged));
     this.AdvancedProperties.Add((PropertyEntry)this.opacityProperty);
     this.relativeTransformProperty = this.RegisterProperty(BrushNode.RelativeTransformProperty, new PropertyChangedEventHandler(this.OnRelativeTransformChanged));
     this.AdvancedProperties.Add((PropertyEntry)this.relativeTransformProperty);
     this.IsSilverlight = !basisProperty.SceneNodeObjectSet.ProjectContext.IsCapabilitySet(PlatformCapability.IsWpf);
 }
コード例 #3
0
ファイル: BrushEditor.cs プロジェクト: radtek/Shopdrawing
        void IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.BrushEditorControl = (BrushEditor)target;
                break;

            case 2:
                this.BrushResourcePickerButton = (FocusReturningWorkaroundRadioButton)target;
                break;

            case 3:
                this.ResourceList = (OnDemandControl)target;
                break;

            case 4:
                this.AdvancedBrushProperties = (StandardCategoryLayout)target;
                break;

            default:
                this._contentLoaded = true;
                break;
            }
        }
コード例 #4
0
ファイル: BrushEditor.cs プロジェクト: radtek/Shopdrawing
 private void OnEditResource(object sender, ExecutedRoutedEventArgs e)
 {
     if (this.editingProperty == null || this.editingProperty.IsValueSystemResource)
     {
         return;
     }
     if (this.resourcePopupOpen)
     {
         this.resourceEditorPopup.IsOpen = false;
     }
     else
     {
         BrushEditor brushEditor = sender as BrushEditor;
         if (brushEditor != null)
         {
             this.resourceEditorPopup       = new WorkaroundPopup();
             this.resourceEditorPopup.Child = (UIElement) new ResourceEditorControl(brushEditor.editingProperty.SceneNodeObjectSet.DesignerContext, brushEditor.editingProperty);
             UIElement uiElement = e.Parameter as UIElement;
             if (uiElement != null)
             {
                 Point point = uiElement.TransformToAncestor((Visual)brushEditor).Transform(new Point(0.0, 0.0));
                 this.resourceEditorPopup.PlacementTarget  = (UIElement)brushEditor;
                 this.resourceEditorPopup.Placement        = PlacementMode.RelativePoint;
                 this.resourceEditorPopup.HorizontalOffset = point.X;
                 this.resourceEditorPopup.VerticalOffset   = point.Y + uiElement.RenderSize.Height;
                 this.resourceEditorPopup.Closed          += new EventHandler(this.EditResourcePopupClosed);
                 this.resourceEditorPopup.IsOpen           = true;
                 this.IsResourcePopupOpen = true;
             }
         }
     }
     e.Handled = true;
 }
コード例 #5
0
ファイル: BrushEditor.cs プロジェクト: radtek/Shopdrawing
        private static void OnResourceSelect(object sender, ExecutedRoutedEventArgs e)
        {
            BrushEditor brushEditor = sender as BrushEditor;

            if (brushEditor == null)
            {
                return;
            }
            VirtualizingResourceItem <LocalResourceModel>  virtualizingResourceItem1 = e.Parameter as VirtualizingResourceItem <LocalResourceModel>;
            VirtualizingResourceItem <SystemResourceModel> virtualizingResourceItem2 = e.Parameter as VirtualizingResourceItem <SystemResourceModel>;

            if (virtualizingResourceItem1 != null)
            {
                brushEditor.EditingProperty.DoSetToLocalResource(virtualizingResourceItem1.Model.PropertyModel);
                e.Handled = true;
            }
            else
            {
                if (virtualizingResourceItem2 == null)
                {
                    return;
                }
                brushEditor.EditingProperty.DoSetToSystemResource(virtualizingResourceItem2.Model.PropertyModel);
                e.Handled = true;
            }
        }
コード例 #6
0
        public SolidColorBrushEditor(BrushEditor brushEditor, SceneNodeProperty basisProperty)
            : base(brushEditor, basisProperty)
        {
            ReferenceStep step = (ReferenceStep)basisProperty.Reference.PlatformMetadata.ResolveProperty(SolidColorBrushNode.ColorProperty);

            this.colorProperty             = this.RequestUpdates(basisProperty.Reference.Append(step), new PropertyChangedEventHandler(this.OnColorChanged));
            this.editorTemplate            = new DataTemplate();
            this.editorTemplate.VisualTree = new FrameworkElementFactory(typeof(SolidColorBrushEditorControl));
            this.opacityProperty           = this.RegisterProperty(BrushNode.OpacityProperty, new PropertyChangedEventHandler(this.OnOpacityChanged));
            this.AdvancedProperties.Add((PropertyEntry)this.opacityProperty);
        }
コード例 #7
0
        public GradientStopEditor(BrushEditor brushEditor, SceneNodeProperty basisProperty, int propertyIndex)
            : base(brushEditor, basisProperty)
        {
            ITypeResolver typeResolver = (ITypeResolver)basisProperty.SceneNodeObjectSet.ProjectContext;
            IType         type         = typeResolver.ResolveType(PlatformTypes.GradientStopCollection);

            if (type == null)
            {
                return;
            }
            IndexedClrPropertyReferenceStep referenceStep = IndexedClrPropertyReferenceStep.GetReferenceStep(typeResolver, type.RuntimeType, propertyIndex);
            PropertyReference propertyReference           = basisProperty.Reference.Append((ReferenceStep)referenceStep);

            this.gradientStopProperty = basisProperty.SceneNodeObjectSet.CreateSceneNodeProperty(propertyReference, (AttributeCollection)null);
            ReferenceStep step1 = (ReferenceStep)typeResolver.ResolveProperty(GradientStopNode.ColorProperty);
            ReferenceStep step2 = (ReferenceStep)typeResolver.ResolveProperty(GradientStopNode.OffsetProperty);

            this.colorProperty  = this.RequestUpdates(propertyReference.Append(step1), new PropertyChangedEventHandler(this.OnColorChanged));
            this.offsetProperty = this.RequestUpdates(propertyReference.Append(step2), new PropertyChangedEventHandler(this.OnOffsetChanged));
            this.propertyIndex  = propertyIndex;
        }
コード例 #8
0
 protected BrushPropertyEditor(BrushEditor brushEditor, SceneNodeProperty basisProperty)
 {
     this.brushEditor   = brushEditor;
     this.basisProperty = basisProperty;
 }
コード例 #9
0
 protected BrushSubtypeEditor(BrushEditor brushEditor, SceneNodeProperty basisProperty)
     : base(brushEditor, basisProperty)
 {
     this.AdvancedProperties = new ObservableCollection <PropertyEntry>();
 }