private static MyCommandDef makeCommand(CommandIds commandId, Record fromRecord)
        {
            CommandDef commandDef   = new CommandDef(commandId, fromRecord.Database);
            var        myCommandDef = new MyCommandDef();

            myCommandDef.CommandId        = (HP.HPTRIM.ServiceModel.CommandIds)commandId;
            myCommandDef.MenuEntryString  = commandDef.GetMenuEntryString(fromRecord.TrimType);
            myCommandDef.Tooltip          = commandDef.GetTooltip(fromRecord.TrimType);
            myCommandDef.StatusBarMessage = commandDef.GetStatusBarMessage(fromRecord.TrimType);
            myCommandDef.IsEnabled        = commandDef.IsEnabled(fromRecord);

            return(myCommandDef);
        }
Exemple #2
0
        private static MyCommandDef makeCommand(CommandIds commandId, TrimMainObject fromRecord)
        {
            CommandDef commandDef   = new CommandDef(commandId, fromRecord.Database);
            var        myCommandDef = new MyCommandDef();

            myCommandDef.CommandId        = (HP.HPTRIM.ServiceModel.CommandIds)commandId;
            myCommandDef.MenuEntryString  = commandDef.GetMenuEntryString(fromRecord.TrimType);
            myCommandDef.Tooltip          = commandDef.GetTooltip(fromRecord.TrimType);
            myCommandDef.StatusBarMessage = commandDef.GetStatusBarMessage(fromRecord.TrimType);

            if (fromRecord is CheckinPlace)
            {
                myCommandDef.IsEnabled = commandDef.IsEnabled((fromRecord as CheckinPlace).CheckinAs);
            }
            else
            {
                myCommandDef.IsEnabled = commandDef.IsEnabled(fromRecord);
            }
            myCommandDef.IsListCommand = commandDef.IsListCommand;
            myCommandDef.NeedsAnObject = commandDef.NeedsAnObject;
            return(myCommandDef);
        }