Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / December 2004

Tip: Looking for answers? Try searching our database.

ContextMenu for Web-Projects only

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
back2grid - 11 Dec 2004 00:43 GMT
Hi,
I have created some custom web-forms and added context menu commands. But
these commands also appear when the project selected is a windows app or a
class lib.
How do i make sure that my context menu appear only when a web project is
selected and you want to add to it?
Carlos J. Quintero [.NET MVP] - 13 Dec 2004 10:38 GMT
Use the IDTCommandTarget interface in your add-in, QueryStatus method, and
return vsCommandStatus.vsCommandStatusUnsupported,
vsCommandStatus.vsCommandStatusInvisible or similar if the project type is
not of your acceptance.

Signature

Carlos J. Quintero

The MZ-Tools all-in-one add-in, now for .NET: http://www.mztools.com

> Hi,
> I have created some custom web-forms and added context menu commands. But
> these commands also appear when the project selected is a windows app or a
> class lib.
> How do i make sure that my context menu appear only when a web project is
> selected and you want to add to it?
back2grid - 13 Dec 2004 17:51 GMT
Carlos,
thx for the reply. My question is specifically how would i identify whether
the selected project is a "Web-Project". I've created a custom web-form and
want it to show up in the context menu "Add My-Webform" only the project
selected is a web-app.
i searched through the applicationObject but couldn't find anything that
identifies the activeproject type. (windows app, web app etc,)

thanks

> Use the IDTCommandTarget interface in your add-in, QueryStatus method, and
> return vsCommandStatus.vsCommandStatusUnsupported,
[quoted text clipped - 7 lines]
> > How do i make sure that my context menu appear only when a web project is
> > selected and you want to add to it?
Carlos J. Quintero [.NET MVP] - 14 Dec 2004 09:11 GMT
You have Project.Properties.Item("ProjectType") (or similar name) which
returns a value of the enum VSLangProj.prjProjectType (prjProjectTypeLocal
or prjProjectTypeWeb).

Signature

Carlos J. Quintero

The MZ-Tools all-in-one add-in, now for .NET: http://www.mztools.com

> Carlos,
> thx for the reply. My question is specifically how would i identify
[quoted text clipped - 7 lines]
>
> thanks
back2grid - 14 Dec 2004 17:55 GMT
Carlos,
i implemented my web-project check successfully. One issue i saw when
debugging was that the querystatus method was executed after the exec method
the first time my item was selected. Subsequently everytime somebody selects
"Project->Add" the query status is executed and one doesn't see my
custom-menu item for non-web
projects((vsCommandStatus)vsCommandStatus.vsCommandStatusUnsupported|vsCommandStatus.vsCommandStatusInvisible;).

is that a bug or am i missing something?.

Also i wanted to know how can i implement a
"ExecuteCommand("File.AddNewItem","") with my custom web-form pre-selected.
File.AddNewItem doesn't accept any arguments.

thanks in advance
thanks in advance.

> You have Project.Properties.Item("ProjectType") (or similar name) which
> returns a value of the enum VSLangProj.prjProjectType (prjProjectTypeLocal
[quoted text clipped - 11 lines]
> >
> > thanks
Carlos J. Quintero [.NET MVP] - 15 Dec 2004 10:35 GMT
I don´t know about the first question, and about the second I am not sure if
that is possible, but you can add your own "Add My Custom Web-form" entry to
the context menu and skip altogether the selection dialog.

Signature

Carlos J. Quintero

The MZ-Tools all-in-one add-in, now for .NET: http://www.mztools.com

> Carlos,
> i implemented my web-project check successfully. One issue i saw when
[quoted text clipped - 14 lines]
>
> thanks in advance
back2grid - 16 Dec 2004 00:57 GMT
Carlos,
thanks for the reply. I posted these questions to the VS.NET team, hoping to
get any kind of reply.
Regarding ExecuteCommand method to be pre-selected with a particular type, i
don't think it can be done. i recorded a macro, executing the commands like
File->AddNewItem etc. after that when i selected "my-webform", no event got
registered.
Although in vs.net if you selected project->add->new class.. the dialog box
with a class file appears selected.

Regarding the execution sequence of QueryStatus method, i'm currently
planning to check if the current project selected is a web-project and if not
displaying a user-friendly message to the user until i can get a consistent
solution.

> I don´t know about the first question, and about the second I am not sure if
> that is possible, but you can add your own "Add My Custom Web-form" entry to
[quoted text clipped - 18 lines]
> >
> > thanks in advance

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.