Can I make a context menu entry only appear if an app is running? - delphi

Is is possible to have right-mouse-click entries only appear when my application is running? What I am thinking is that I want people to be able to right-click a file in windows explorer and be able to select an entry "Email this file to technical support", but I need my app to be running in order to do that, so I want the entry to disappear when my app isn't running.
I guess the second part of my question is how to implement that function - i.e. how can I get a right-click menu entry click from Windows Explorer recognised and acted on my my app if the app is already running, or will I have to have a minion app that just passes a message to the main app?

A shell context-menu extension can decide whether to create any menu items easily enough. Change your handling of the IContextMenu.QueryContextMenu method accordingly. (Delphi comes with a sample project for context-menu extensions. Start from there if you don't already have one.)
Another option is to keep the menu item visible all the time. If your application isn't running, then have the menu extension start your program first. Why should the user have to worry about what order to do things?

Related

Is it possible to have a "Open in Terminal" button without having to open it from context menu on Github Desktop?

I need to open some projects in Terminal frequently and the only way I can easily do that is to open the context menu and select "Open in Terminal".
However, the other three options all have a much easier way to access (as showed in the picture below).
Is it possible to have the option "Open in Terminal" also available on the right of the app so that I don't need to right-click my mouse every time.

Is it possible to run a project from a solution in VS 2017 without it being assigned as the start project?

I have a MVC 5 solution in VS 2017 with 2 projects. Sometimes, when I'm working in one, I need to enter new information in the database using the other one. The only way I know of doing this is to stop debugging, assign the other project as the startup, run it, enter the info and then reverse the process again. Is there a way that I can access the project (which is light, not too complex) without stopping the current assigned startup project ?
Yes. Right click on the project and select Debug > Start New Instance from the menu
If you right click on the solution name in the solution explorer, there's an option for Set Startup Projects. You can then select what you want to start when you run the application.
It's also under the Project menu.

"edit, build, refresh browser" approach in visual studio 2017

New_bie_developer_from_php_background.
I am developing an asp.net MVC web app using vs2017 community edition.
I want to make my development environment in such a way that I can edit code, build and refresh the browser to see the changes and again you can edit without stopping the server.
But in VS the approach is different. You have to stop the server, edit code, start server again (which makes the server code uneditable).
Does the vs can be modified to match my requirements? ie to edit, build and refresh the browser.
Partial solution can be to start your app in a Launch without Debug mode (Ctrl+F5).
That way, ASP.NET will be automatically picking up changes you are making in your code. However, in this mode you will lose debug features (hitting breakpoints, getting debug-related messages etc.).
There are two ways to do this. First is to click on pause
or use keyboard shortcut keys (Ctrl+Alt+Break). Edit your code and click continue.
Second is by go to Properties of your project (by right clicking project in visual studio's solution explorer) => select Web from left nav and check the Enable Edit and Continue checkbox. Now you can add break point and when it get hit you can edit your code. Now Refresh your browser.

How can I bind my VS 2003 / XP Mode Project to the appropriate Server folders location with TFS?

Somehow my project got its source control bindings mixed up, and I'm trying to bind the local files to the correct place on the server. I am trying first to unbind the project, but when I then try to set up the binding anew and "Add Solution to Source Control", I get, "A project PDAClient.csdproj that you are attempting to add to source control cannot be added because the item AppSettings.cs is already under source control at the selected location"
It apparently only chose AppSettings.cs as the problem file to complain about because it is the first one in alphabetical order. I surmise this because I temporarily removed it from the project, tried again, and it complained about the next file in alpha order in the same way.
To try to outfox TFS, I renamed "MSSCCPRJ.SCC" to "MSSCCPRJ.SCCHide" and also renamed "PDAClient.vssscc" to "PDAClient.vsssccHide" but it simply created a fresh "PDAClient.vssscc"
(PDAClient is the name of the solution and the project)
If I try from VS 2003 File > Source Control > Change Source Control, I see this:
If I then select Bind for the solution, and then the eponymous project, I see:
If I hit "Browse" or the ellipsis button in the Server Binding column, it just "flashes" but opens no dialog for me to make the connection.
So the solution's binding is "invalid" but the project's binding is supposedly valid...
If I then select "OK" I get this:
...which looks promising ("Yes! Fix the bindings!") but selecting the "Fix" button simply takes me back to the Change Source Control dialog without having done anything. So I finally, reluctantly, select the other option, to "continue with the existing bindings" and see:
Okay...it tells me I have to check in a project for that to work, and I try to proceed, but see:
Note that it is trying to connect me to Handheld/Development/Development/HHS, but that's not what I want and need. DEV is a different branch; this is the Release branch. You can see that in the screamshot above in the solutions Path property (set to C:\Project\sscs\Handheld\Release (etc.)) not ...Development...(etc.) I compared the two using the built-in tool and saw that, indeed, the Server version was from the Dev branch (not the desired Release branch) and took the local version. But then I got:
As I then saw that some of the project's files were checked out, I was hoping against hope that perhaps it was now going to work. I tested it by making a change to a method name, but ended up seeing this, "An error or user cancellation occurred during checkout. Some files may not have been checked out. (File was not checked out.)" and then that was followed up with, "Could not perform refactoring because some of affected files could not be made writeable."...and so my change was backed out for me automatically.
Obviously, this isn't going to work, because I do need to make changes to this project.
Flailing about with what's left to me on the File > Source Control menu, I selected "Add Project From Source Control..." to see what it might offer. It first gives me a dialog where I connect to a TFS; I did. I navigated to the right spot on the server, and this looks good and ready to go:
Selecting OK invokes a dialog that tells me, "The local folder you chose to store your solution contains one or more solution files that have the same name as those in the source control server folder." with Overwrite, Cancel, and Help buttons.
I select Overwrite. I am then presented with a dialog:
I select PDAClient.sln (HHS was the former name of the solution/project)
However, when I subsequently select the Open button, I get, "The folder 'C:\Project\sscs\Handheld\Releases\6-4-0\HHS' cannot be used for the solution or project because it is already in use to store part of another solution or project."
I have no choice but to select "OK" which negates the whole process.
As a final head-first, possible-collar-bone-breaking feat of Any-Port-in-a-Stormism Syndrome, I select File > Source Control > Team Foundation Server MSSCCI Provider. This invokes the Kafka-esque Windows 2010 Shell inside of VS 2003 inside of XP Mode. According to what I see there, my setup is correct: The Server's copies of the Release project are bound to the local files Release folders:
But \Releases\HHS is grayed out, indicating there is no connection between the server folders and the local folders. And note that most (not all, but most) of the files in the Releases setup are actually stored locally in the Development folders! There are some key files that are bound correctly:
All the (dozens of) unseen files (only the first and last are seen in the last two screenshots) are tied to Development, too.
Although I don't have a "bind" type of context menu item for \Releases\HHS, there is a "map local"; although it is already ostensibly mapped correctly, I try it out, but get "The local folder could not be set to C:\Project\sscs\Handheld\Releases\6-4-0\HHS because it is already the local folder for another server folder."
So I go up to \Development\HHS, which does have a "valid" binding; note, again, that it is bound to the wrong local path (Releases instead of Dev).
So for it I first select the contextual "Remove Mapping" menu item. This affords me the opportunity to "Edit or remove a workspace mapping." I change the local folder from Releases to Dev. It looks good; Dev is now bound to Dev, and the binding is still seen as valid; this time it really is (I hope, anyway).
I now turn my attention back to Releases, but the context item "map local" is no longer there...and, although it shows the right connection between Server location and local, it is still grayed out...???
Note: The "Pending Changes" list of files is identical with both \Development\HHS and \Releases\HHS highlighted: the same three files in both cases are shown as being in the local Releases folder, and all the others in the local Dev folder.
Back in VS 2003 (out of the VS 2010 Shell running the TFS MSSCCI Provider), I go to "Change Source Control" and see that both the solution and the project have a Status of "Valid" now...when I select "OK" though, it tells me many of the files do not match and to either contact the administrator or perhaps a Get All will solve it. I tentatively look into a Select All, but see that it still says my project is bound to Development. ARGHHHH!!!!
Can anybody make sense out of this madness? How can I get the Release server folders pointed to the Release local folders, and Dev Server folders to the Dev local folders, without any bleedover and mismatching?
UPDATE
I looked in Source Control Explorer (TFS MSSCCI) again this morning, and my Dev\HHS had again gone back to being set to the wrong local path (Releases) and is connected (I guess that's what the glyph of the facing-each-other vertical arrows to the left of the folder indicates).
As to Releases\HHS, it was not connected (no glyph), but I was able to right click and map to a new folder I set up.
Here's what I see now (after changing the mapping of DEV from the local Releases folder back to the local DEV folder AGAIN!).
Properties for Dev HHS:
Properties for Release HHS:
I don't know if this makes sense to you, but it looks fishy to me.
UPDATE 2
The madness continues unabated today. My solution claims to have two pending checkins:
When I select "Check In," I get a confirmation dialog; I continue with the "Check In" button there. Then I get the "Check In - Source Files" dialog. I select the "Check In" button there, too. But then I see, "Files not checked out"
If I repeat the operations above, the last message is:
No Changess to Check In
All of the changes where either unmodified files or locks. The changes have been undone by the server."
???
IMO, I would have saved a lot of time by just zipping up files when I wanted to save the latest changes, rather than use this irksome beast; I spend more time fiddling with "productivity" tools than just using a more straightforward approach. Give me zip files and a good diff util over this cauldron of dashed hopes and clever-clever dirty tricks!
UPDATE 3
And if I close the project and re-open it, I see the following three times in a row:
So who in blue blazes told you to find such a server?!?!
Then I get:
And finally this again:
Argggggghhhhhhhhhhhhhhhhh!!!!!!!!!!!!!!!!!!!
UPDATE 4
Even though the path for the solution and project are right (Releases), this is what the files in the project show:
The branches tab, as shown in Update, show Dev going down to Release; I don't know if that's right or not, because Release was a branch of Dev,
or...???
Anyway, I see the above from File > Source Control > Team Foundation Properties
HOWEVER, when I choose File > Source Control > Team Foundation Server MSSCCI Provider, the binding seems to be correct - the HHS Dev project has Dev as its local folder location, and the HHS Release project has the Release folders as its local location.
I don't know who is more confused: me, anybody who happens to read this, or TFS/MSSCCI itself. This kind of thing is, ironically, a real productivity killer.

Find shelvesets via Visual Studio as quickly as possible

I need to review many shelvesets using Visual Studio every day. I have added the TfsPendingChanges command to the my toolbar, but the rest of the procedure to access a shelveset (Actions/Find Shelvesets) still feels clumsy. In fact, shelveset review has nothing to do with my own pending changes. And VS11 just made it even one step longer than it already was.
Is there any way to add "Find Shelvesets" in some form directly to a menu or to a toolbar, in Visual Studio 2012?
If you go to right click and then "Customize" on any toolbar, it will bring up a dialog. Press the "Keyboard" button on it, choose File.TfsUnShelvePendingChanges and assign a Hot Key to it. I do believe that the Source Control Explorer window needs to be open and active for your hot key to work.
OR...This may not be exactly what you are looking for, but if you have the Source Control Explorer window open and active, then ALT-F ALT-R ALT-F ALT-F ALT-S will bring up the dialog. That is actually navigating File/Source Control/Find/Find Shelvesets.
The easiest way to work with Shelvesets is to use the new My Work feature. By suspending and resuming work Visual Studio will automatically do all the Shelveset magic for you with a simple drag/drop of the task that you want to have in progress.
The same applies to reviews, Suspend your current work, or create a new temporary workspace, open the Review Request, let it unshelve the changes automatically and when you're done go back to where you were by resuming your previous tasks.
It's really great once you get the hang of it. That it uses Shelvesets under the hood is nice to know, but this way you don't really need to know, it just works.
As for TWA Diff, there've been great improvements with TFS 2012 Update 2 which is almost ready to be released...
If this is only for reviews then maybe Team Web Access would be better for you?
Just navigate to http://:8080/tfs/web/, select team project, then click Source Tab and Find Shelvesets. You can then open each shelveset in new browser window and it will list all changes and allows you to quickly do compare etc.
Command that you are looking for is TfsUnshelvePendingChanges under File.
Right click on any toolbar, click on customize and a dialog will open. Go to 'Commands' tab on the top.
Choose appropriate button out of Menu Bar | Toolbar | Context Menu. Select the desired option under that. My favorite is to add it to Toolbar>Work Item Tracing (toolbar where New Item/Open Item appears).
After choosing from above step appropriately, click on 'New Command'. Then select to File>TfsUnShelvePendingChanges. This will add a shortcut to unshelve changes.
Thanks to #Alex for pointing out the correct command name. Writing here separately for people looking for answers in future.

Resources