src/Misc/EFTools/EntityDesignPackage/CustomCode/MicrosoftDataEntityDesignCommandSet.cs
/// <summary>
///     Return the selected Entity Type Shape compartment given a type.
/// </summary>
/// <param name="isPropertiesCompartment"></param>
/// <returns></returns>
Return the selected Entity Type Shape compartment given a type.
Return the selected Entity Type Shape compartment given a type .
private ElementListCompartment GetSelectedCompartment(bool isPropertiesCompartment)
        {
            ElementListCompartment result = null;
            var diagram = GetDiagram();
            if (diagram != null
                && diagram.ActiveDiagramView != null)
            {
                var view = diagram.ActiveDiagramView.DiagramClientView;
                if (view != null)
                {
                    var entityShape = view.Selection.PrimaryItem.Shape as EntityTypeShape;
                    if (entityShape == null)
                    {
                        var compartment = view.Selection.PrimaryItem.Shape as ElementListCompartment;
                        if (compartment != null)
                        {
                            entityShape = compartment.ParentShape as EntityTypeShape;
                        }
                    }
                    if (entityShape != null)
                    {
                        result = isPropertiesCompartment ? entityShape.PropertiesCompartment : entityShape.NavigationCompartment;
                        Debug.Assert(
                            result != null,
                            "Could not retrieve compartment with isPropertiesComparment property value : " + isPropertiesCompartment);
                    }
                }
            }
            return result;
        }
private ElementListCompartment GetSelectedCompartment ( bool isPropertiesCompartment ) { ElementListCompartment result = null ; var diagram = GetDiagram ( ) ; if ( diagram != null && diagram . ActiveDiagramView != null ) { var view = diagram . ActiveDiagramView . DiagramClientView ; if ( view != null ) { var entityShape = view . Selection . PrimaryItem . Shape as EntityTypeShape ; if ( entityShape == null ) { var compartment = view . Selection . PrimaryItem . Shape as ElementListCompartment ; if ( compartment != null ) { entityShape = compartment . ParentShape as EntityTypeShape ; } } if ( entityShape != null ) { result = isPropertiesCompartment ? entityShape . PropertiesCompartment : entityShape . NavigationCompartment ; Debug . Assert ( result != null , " " + isPropertiesCompartment ) ; } } } return result ; }
Return the selected Entity Type Shape compartment given a type.
Return the selected Entity Type Shape compartment given a type .
// if EntityShape is null, the user might select the the entity shape compartment. // Make sure what is returned is what the user requested.
None
isPropertiesCompartment
bool
None