Implémentation de la gestion des commandes pour les projets imbriquésImplementing Command Handling for Nested Projects
L’IDE peut transmettre des commandes qui sont transmises via le IVsUIHierarchy et IOleCommandTarget interfaces pour les projets imbriqués ou des projets parents peuvent filtrer ou substituer les commandes.The IDE can pass commands that are passed through the IVsUIHierarchy and the IOleCommandTarget interfaces to nested projects, or parent projects can filter or override the commands.
Note
Seules les commandes habituellement gérées par le projet parent peuvent être filtrés.Only commands ordinarily handled by the parent project can be filtered. Commandes telles que Build et déployer qui sont gérés par l’IDE ne peuvent pas être filtré.Commands such as Build and Deploy that are handled by the IDE cannot be filtered.
Les étapes suivantes décrivent le processus d’implémentation de la gestion des commandes.The following steps describe the process for implementing command handling.
ProcéduresProcedures
Pour implémenter la gestion des commandesTo implement command handling
Lorsque l’utilisateur sélectionne un nœud ou un projet imbriqué dans un projet imbriqué :When the user selects a nested project or a node in a nested project:
Les appels de l’IDE le QueryStatus (méthode).The IDE calls the QueryStatus method.
— ou —— or —
Si la commande avait été créée dans une fenêtre de hiérarchie, par exemple une commande de menu contextuel dans l’Explorateur de solutions, l’IDE appelle le QueryStatusCommand méthode sur les parents du projet.If the command originated in a hierarchy window, such as a shortcut menu command in Solution Explorer, the IDE calls the QueryStatusCommand method on the project's parent.
Le projet parent peut examiner les paramètres à passer à
QueryStatus
, tel quepguidCmdGroup
etprgCmds
, afin de déterminer si le projet parent doit filtrer les commandes.The parent project can examine parameters to be passed toQueryStatus
, such aspguidCmdGroup
andprgCmds
, to determine whether the parent project should filter the commands. Si le projet parent est implémenté pour filtrer les commandes, il doit définir :If the parent project is implemented to filter commands, it should set:prgCmds[0].cmdf = OLECMDF_SUPPORTED; // make sure it is disabled prgCmds[0].cmdf &= ~MSOCMDF_ENABLED;
Le projet parent doit retourner
S_OK
.Then the parent project should returnS_OK
.Si le projet parent ne filtre pas la commande, elle doit simplement retourner
S_OK
.If the parent project does not filter the command, it should just returnS_OK
. Dans ce cas, l’IDE achemine automatiquement la commande au projet enfant.In this case, the IDE automatically routes the command to the child project.Le projet parent n’a pas à acheminer la commande au projet enfant.The parent project does not have to route the command to the child project. L’IDE exécute cette tâche...The IDE performs this task..
Voir aussiSee Also
IVsUIHierarchy
Commandes, Menus et barres d’outils Commands, Menus, and Toolbars
Imbriquer des projetsNesting Projects
Commentaires
Nous aimerions avoir votre avis. Choisissez le type d’avis que vous souhaitez fournir :
Notre système de commentaires est basé sur l’infrastructure de problèmes GitHub. Apprenez-en davantage sur notre blog.
Chargement du commentaire...