コード例 #1
0
        public Task <CommandStatusResult> GetCommandStatusAsync(IImmutableSet <IProjectTree> nodes, long commandId, bool focused, string?commandText, CommandStatus progressiveStatus)
        {
            Requires.NotNull(nodes, nameof(nodes));

            if (nodes.Count == 1 && _addItemDialogService.CanAddNewOrExistingItemTo(nodes.First()) && TryGetTemplateDetails(commandId, out _))
            {
                return(GetCommandStatusResult.Handled(commandText, CommandStatus.Enabled));
            }

            return(GetCommandStatusResult.Unhandled);
        }
コード例 #2
0
 protected override Task <CommandStatusResult> GetCommandStatusAsync(IProjectTree node, bool focused, string commandText, CommandStatus progressiveStatus)
 {
     if (_addItemDialogService.CanAddNewOrExistingItemTo(GetNodeToAddTo(node)) && CanAdd(node))
     {
         return(GetCommandStatusResult.Handled(commandText, CommandStatus.Enabled));
     }
     else
     {
         return(GetCommandStatusResult.Unhandled);
     }
 }