public ComplexPropertyRelation(DesignerCanvas canvas, TypeBaseDesigner fromTypeDesigner, TypeBaseDesigner toTypeDesigner, FrameworkElement fromItem, int fromItemIndex)
     : base(canvas, fromTypeDesigner, toTypeDesigner)
 {
     FromItem = fromItem;
     FromItemIndex = fromItemIndex;
     InitializeComponent();
     SetBinding(XYProperty, new Binding { Source = this, Converter = new ComplexPropertyRelationToXYConverter() });
 }
 public Association(ICSharpCode.Data.EDMDesigner.Core.EDMObjects.CSDL.Association.Association csdlAssociation, DesignerCanvas canvas, TypeBaseDesigner fromTypeDesigner, TypeBaseDesigner toTypeDesigner, FrameworkElement fromItem, FrameworkElement toItem, int fromItemIndex, int toItemIndex)
     : base(canvas, fromTypeDesigner, toTypeDesigner)
 {
     CSDLAssociation = csdlAssociation;
     FromItem = fromItem;
     ToItem = toItem;
     FromItemIndex = fromItemIndex;
     ToItemIndex = toItemIndex;
     InitializeComponent();
     InitContextMenuCommandBindings();
     SetBinding(XYProperty, new Binding { Source = this, Converter = new AssociationToXYConverter() });
     SetBinding(OpacityProperty, new Binding("IsCompletlyMapped") { Source = CSDLAssociation.Mapping, Converter = new BoolToOpacityConverter(), ConverterParameter = 0.3 });
 }
Beispiel #3
0
        internal void DrawComplexPropertyRelation(TypeBaseDesigner otherTypeDesigner, UIRelatedProperty relatedProperty)
        {
            if (RelationsContenerByRelatedProperty.ContainsKey(relatedProperty) || otherTypeDesigner.RelationsContenerByRelatedProperty.ContainsKey(relatedProperty))
            {
                return;
            }
            var complexProperty = (ComplexProperty)relatedProperty.BusinessInstance;
            int typeDesignerItemIndex;
            var complexPropertyRelation = new ComplexPropertyRelation(Designer, this, otherTypeDesigner, GetListViewItem(complexProperty, out typeDesignerItemIndex), typeDesignerItemIndex);
            var relationContener        = new RelationContener(complexPropertyRelation);

            Designer.Children.Add(relationContener);
            relationContener.SetBinding(Canvas.LeftProperty, new Binding {
                Source = complexPropertyRelation, Path = new PropertyPath("CanvasLeft")
            });
            relationContener.SetBinding(Canvas.TopProperty, new Binding {
                Source = complexPropertyRelation, Path = new PropertyPath("CanvasTop")
            });
            AddRelationContenerByRelatedProperty(UIType.Properties[complexProperty], relationContener);
            otherTypeDesigner.AddRelationContenerWithoutRelatedProperty(relationContener);
        }
Beispiel #4
0
        internal void DrawAssociation(TypeBaseDesigner otherTypeDesigner, NavigationProperty navigationProperty)
        {
            var csdlAssociation = navigationProperty.Association;
            int otherTypeDesignerItemIndex;
            var otherNavigationProperty = csdlAssociation.PropertiesEnd.First(np => np != navigationProperty);
            var otherListViewItem       = otherTypeDesigner.GetListViewItem(otherNavigationProperty, out otherTypeDesignerItemIndex);
            int typeDesignerItemIndex;
            var typeDesignerListViewItem = GetListViewItem(navigationProperty, out typeDesignerItemIndex);

            ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Relations.Association association;
            if (csdlAssociation.PropertyEnd1 == navigationProperty)
            {
                association = new ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Relations.Association(csdlAssociation, Designer, this, otherTypeDesigner, typeDesignerListViewItem, otherListViewItem, typeDesignerItemIndex, otherTypeDesignerItemIndex);
            }
            else
            {
                association = new ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Relations.Association(csdlAssociation, Designer, otherTypeDesigner, this, otherListViewItem, typeDesignerListViewItem, otherTypeDesignerItemIndex, typeDesignerItemIndex);
            }
            var relationContener = new RelationContener(association);

            Designer.Children.Add(relationContener);
            relationContener.SetBinding(Canvas.LeftProperty, new Binding {
                Source = association, Path = new PropertyPath("CanvasLeft")
            });
            relationContener.SetBinding(Canvas.TopProperty, new Binding {
                Source = association, Path = new PropertyPath("CanvasTop")
            });
            AddRelationContenerByRelatedProperty(UIType.Properties[navigationProperty], relationContener);
            otherTypeDesigner.AddRelationContenerByRelatedProperty(otherTypeDesigner.UIType.Properties[otherNavigationProperty], relationContener);
            NotifyCollectionChangedEventHandler mappingCollectionChanged = delegate
            {
                VisualTreeHelperUtil.GetControlsDecendant <EditableTextBlock>(otherListViewItem).First().GetBindingExpression(EditableTextBlock.OpacityProperty).UpdateTarget();
                VisualTreeHelperUtil.GetControlsDecendant <EditableTextBlock>(typeDesignerListViewItem).First().GetBindingExpression(EditableTextBlock.OpacityProperty).UpdateTarget();
            };

            csdlAssociation.PropertyEnd1.Mapping.CollectionChanged += mappingCollectionChanged;
            csdlAssociation.PropertyEnd2.Mapping.CollectionChanged += mappingCollectionChanged;
        }
 public RelationBase(DesignerCanvas canvas, TypeBaseDesigner fromTypeDesigner, TypeBaseDesigner toTypeDesigner)
 {
     Canvas = canvas;
     FromTypeDesigner = fromTypeDesigner;
     ToTypeDesigner = toTypeDesigner;
 }
 internal void DrawComplexPropertyRelation(TypeBaseDesigner otherTypeDesigner, UIRelatedProperty relatedProperty)
 {
     if (RelationsContenerByRelatedProperty.ContainsKey(relatedProperty) || otherTypeDesigner.RelationsContenerByRelatedProperty.ContainsKey(relatedProperty))
         return;
     var complexProperty = (ComplexProperty)relatedProperty.BusinessInstance;
     int typeDesignerItemIndex;
     var complexPropertyRelation = new ComplexPropertyRelation(Designer, this, otherTypeDesigner, GetListViewItem(complexProperty, out typeDesignerItemIndex), typeDesignerItemIndex);
     var relationContener = new RelationContener(complexPropertyRelation);
     Designer.Children.Add(relationContener);
     relationContener.SetBinding(Canvas.LeftProperty, new Binding { Source = complexPropertyRelation, Path = new PropertyPath("CanvasLeft") });
     relationContener.SetBinding(Canvas.TopProperty, new Binding { Source = complexPropertyRelation, Path = new PropertyPath("CanvasTop") });
     AddRelationContenerByRelatedProperty(UIType.Properties[complexProperty], relationContener);
     otherTypeDesigner.AddRelationContenerWithoutRelatedProperty(relationContener);
 }
 internal void DrawAssociation(TypeBaseDesigner otherTypeDesigner, NavigationProperty navigationProperty)
 {
     var csdlAssociation = navigationProperty.Association;
     int otherTypeDesignerItemIndex;
     var otherNavigationProperty = csdlAssociation.PropertiesEnd.First(np => np != navigationProperty);
     var otherListViewItem = otherTypeDesigner.GetListViewItem(otherNavigationProperty, out otherTypeDesignerItemIndex);
     int typeDesignerItemIndex;
     var typeDesignerListViewItem = GetListViewItem(navigationProperty, out typeDesignerItemIndex);
     ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Relations.Association association;
     if (csdlAssociation.PropertyEnd1 == navigationProperty)
         association = new ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Relations.Association(csdlAssociation, Designer, this, otherTypeDesigner, typeDesignerListViewItem, otherListViewItem, typeDesignerItemIndex, otherTypeDesignerItemIndex);
     else
         association = new ICSharpCode.Data.EDMDesigner.Core.UI.UserControls.Relations.Association(csdlAssociation, Designer, otherTypeDesigner, this, otherListViewItem, typeDesignerListViewItem, otherTypeDesignerItemIndex, typeDesignerItemIndex);
     var relationContener = new RelationContener(association);
     Designer.Children.Add(relationContener);
     relationContener.SetBinding(Canvas.LeftProperty, new Binding { Source = association, Path = new PropertyPath("CanvasLeft") });
     relationContener.SetBinding(Canvas.TopProperty, new Binding { Source = association, Path = new PropertyPath("CanvasTop") });
     AddRelationContenerByRelatedProperty(UIType.Properties[navigationProperty], relationContener);
     otherTypeDesigner.AddRelationContenerByRelatedProperty(otherTypeDesigner.UIType.Properties[otherNavigationProperty], relationContener);
     NotifyCollectionChangedEventHandler mappingCollectionChanged = delegate
     {
         VisualTreeHelperUtil.GetControlsDecendant<EditableTextBlock>(otherListViewItem).First().GetBindingExpression(EditableTextBlock.OpacityProperty).UpdateTarget();
         VisualTreeHelperUtil.GetControlsDecendant<EditableTextBlock>(typeDesignerListViewItem).First().GetBindingExpression(EditableTextBlock.OpacityProperty).UpdateTarget();
     };
     csdlAssociation.PropertyEnd1.Mapping.CollectionChanged += mappingCollectionChanged;
     csdlAssociation.PropertyEnd2.Mapping.CollectionChanged += mappingCollectionChanged;
 }
Beispiel #8
0
 internal void UnselectOtherTypes(TypeBaseDesigner typeDesigner)
 {
     if (!KeyboardUtil.CtrlDown)
         foreach (var selectedType in TypesSelected.Where(ts => ts != typeDesigner).ToList())
             selectedType.IsSelected = false;
 }
Beispiel #9
0
 private void AddType(TypeBaseDesigner typeDesigner, Point position, IUIType uiType)
 {
     Children.Add(typeDesigner);
     Canvas.SetLeft(typeDesigner, position.X);
     Canvas.SetTop(typeDesigner, position.Y);
     DesignerView.AddTypeDesigner(typeDesigner);
     typeDesigner.SizeChanged += delegate { Resize(); };
     typeDesigner.Selected +=
         () =>
         {
             if (!_isSelecting)
                 UnselectOtherTypes(typeDesigner);
         };
 }