src/Misc/EFTools/EntityDesignPackage/CustomCode/MicrosoftDataEntityDesignCommandSet.cs
/// <summary>
///     Set AddNewEntity visibility and display text.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
Set AddNewEntity visibility and display text.
Set AddNewEntity visibility and display text .
internal void OnStatusAddEntity(object sender, EventArgs e)
        {
            var cmd = sender as DynamicStatusMenuCommand;
            Debug.Assert(cmd != null, "Unexpected command type. type:" + (sender == null ? "NULL" : sender.GetType().Name));
            if (cmd != null)
            {
                cmd.Enabled = cmd.Visible = false;
                if (MonitorSelection != null
                    && MonitorSelection.CurrentWindow is EntityDesignExplorerWindow)
                {
                    var explorerSelection = SelectedExplorerItem;
                    var explorerTypes = explorerSelection as ExplorerTypes;
                    if ((null != explorerTypes && explorerTypes.IsConceptualEntityTypesNode)
                        || explorerSelection is ExplorerEntityType)
                    {
                        cmd.Enabled = cmd.Visible = true;
                        cmd.Text = Resources.AddEntityTypeCommand_ExplorerText;
                        return;
                    }
                }
                else if (IsOurDiagramSelected())
                {
                    cmd.Enabled = cmd.Visible = true;
                    cmd.Text = Resources.AddEntityTypeCommand_DesignerText;
                    return;
                }
            }
        }
internal void OnStatusAddEntity ( object sender , EventArgs e ) { var cmd = sender as DynamicStatusMenuCommand ; Debug . Assert ( cmd != null , " " + ( sender == null ? " " : sender . GetType ( ) . Name ) ) ; if ( cmd != null ) { cmd . Enabled = cmd . Visible = false ; if ( MonitorSelection != null && MonitorSelection . CurrentWindow is EntityDesignExplorerWindow ) { var explorerSelection = SelectedExplorerItem ; var explorerTypes = explorerSelection as ExplorerTypes ; if ( ( null != explorerTypes && explorerTypes . IsConceptualEntityTypesNode ) || explorerSelection is ExplorerEntityType ) { cmd . Enabled = cmd . Visible = true ; cmd . Text = Resources . AddEntityTypeCommand_ExplorerText ; return ; } } else if ( IsOurDiagramSelected ( ) ) { cmd . Enabled = cmd . Visible = true ; cmd . Text = Resources . AddEntityTypeCommand_DesignerText ; return ; } } }
Set AddNewEntity visibility and display text.
Set AddNewEntity visibility and display text .
// This menu item should be available when the user right click on entity-type node or entity-type folder node. // if the active window is not the explorer window, just check if an entity diagram is selected.
sender
object
None
e
EventArgs
None