Is there a way to record and replay coding in visual studio 2012? - visual-studio

I'm going to do demo based presentation. So what I want is prerecord(not a video record) my demo and replay while the I'm doing the presentation. Pre-record and play as in save code segments and generated some kind of list and then when I click on the list item generate relevant code and insert into code editor. Is there any macro base or any other way to do this?
Please do ask question if this is not clear.
Update 1
#jerek has answered the initial question. Going forward is there anyway to replace/edit existing code?

Open Toolbox (View | Toolbox)
Select code from editor
Drag and Drop into Toolbox (you can give it a short name from context menu)
When needed drag and drop back from Toolbox back to code editor
PS: 3b - instead of drag and drop you can also paste code from clipboard using context menu on Toolbox window

The Undo and Redo stack buttons are really useful. They might be enough for what you want to do (basically CTRL-Z and CTRL-SHIFT-Z but you can roll forward over multiple redo's)
This might be a bit basic, but essentially will allow you to go forwards and backwards through your edits.

With Visual Studio, you can code everything and then undo and redo your work. Then record everything with one of these.

Related

VSCode: Preview file in tab/panel

When previewing a file by clicking on it once in VSCode, is it possible to preview other files in the explorer by using the arrow keys, similar to Visual Studio? When I do it, it just selects the file, but doesn't preview it (unless I use my mouse). I'd provide a picture, but the upload isn't working right now, sadly. :(
I feel like that used to be a thing and I broke it at some point, but I could also just imagine it due to VS.
https://stackoverflow.com/a/66237216/12903844 has exactly what I was looking for!
Short summary: Up/Down + Space will enable you to preview a file, but you can also use 'multi-command' to macro it to just Up/Down (without having to press Space when selecting files this way).
Credit goes to Mark for answering it in the comments, just adding it here so the solution is marked. <3

How to Navigate / Move Cursor by code block in VisualStudio

I want to be able to move the cursor (not move the line of code) in the text editor up a block or down a block by pressing <ctrl>+<uparrow> or <ctrl>+<downarrow>. In jEdit, Leafpad, etc, this just works out of the box. I do not want to move an entire page at a time, just simply go to the start or end of the text block that I happen to be on.
Specifically, I want this, but for VS 2012 (which no longer has macros):
keyboard shortcut to move from one code block to another in VS2008
I've seen these posts, and they are not what I'm after; I do not want to move code, I want to move the cursor to the top or bottom of the block I happen to be on.
Visual Studio: hotkeys to move line up/down and move through recent changes
Visual Studio - Scroll AND move cursor
I have checked in ReSharper as well, and cannot seem to find an answer there.
Does anyone know of an add-in that provides this functionality?
Bind them to Edit.PreviousMethod and Edit.NextMethod in the Options->Environment->Keyboard?
I removed everything that was bound to these shortcuts, then bound it to Edit.PreviousMethod and Edit.NextMethod. This put the focus on the method box in the editor, but then you have to press enter to get it to navigate to that method.
The best I could find was using ReSharper, which I was trying to avoid. However, I'm a minimalist and ReSharper got in my way, I was leaving it toggled off almost all the time, so I uninstalled it.
I believe it was ReSharper.MoveToNextMethod or .NavigateToNextMethod, but I have uninstalled it so I'm going on memory. Using it, it would jump to the beginning of the previous or next method, which was not quite what I was looking for, but better than nothing.
Edit: I gave up. I moved to .Net Core for c# code and do all my editing outside of Code, using text editors that employ common keyboard shortcuts like Geany, jEdit, etc.

Visual Studio - how do you use it without touching your mouse?

I am going to be doing the codekata defined on Roy Osherove's blog HERE.
One of the rules is that you cannot use the mouse while doing the kata.
Today, my first attempt at doing the kata I have spent the whole time trying to better understand how to use VS without the mouse. I have learned that CTL-ALT-A will be my friend because I can type commands there.
Does somebody have a pointer to a complete reference to the VS Commmands. I want the command name (Edit.ToggleBookmark), command keystroke (like Ctl-K,K), and any arguments required by the command.
Some specific questons I have.
Does someone know a keystroke for pinning the active window without using the mouse.
Also, I cannot figure out how to add a reference without using the keyboard.
If you can help with those two then I will be significantly farther along.
Thanks.
Seth
edit
Just figured out how to add references. I was working on a project that was not saved and Add References command (Project.AddReference) was returning an error...and I thought it was because I was using the command...but it was actually because I had not saved the project yet.
SO.... if you could help me with the window pinning that would be great.
Seth
EVEN WITH ALL THE HELPS FIGURING OUT COMMANDS...I still cannot figure out how to
- pin a Visual Studio window so it stays open.
- And how do you trigger the context menu any a window. For example, solution explorer?
- How do you delete or remove a file?
EDIT
This StackOverflow question answers the context menu question.
Now...if someone can tell me how to pin a window. That would be awesome.
Seth
Does somebody have a pointer to a complete reference to the VS Commmands. I want the command name (Edit.ToggleBookmark), command keystroke (like Ctl-K,K), and any arguments required by the command.
Because it's entirely user definable, I don't think any online reference for keystrokes will do you any good -- I personally have my own keyboard shortcut profile that works best for me.
Therefore, here's the best way to learn every command and its keyboard shortcuts:
Load Visual Studio
Go to the Tools -> Options menu.
Select "Keyboard" in the options list on the left.
Et Voila! Every possible command in VS and its keyboard shortcut (if it's assigned), along with the ability to assign your own. Oh, and search, too!
Kind of an old question here, but for ye olde Googlers/Bingers/SearchaMaTronickistas I thought it might be worth posting the link to the Keyboard Bindings Poster from Microsoft.

Visual Studio Task Panel

Does anyone know how to prevent task panes from expanding unless you click on them? Sometimes I hover over one, and it takes a bit to load breaking my concentration.
Thanks!
EDIT: Now that I've had a few days to reflect on my question, I realize the answer is to close it. Let me provide an example. When you are in Word, and you want to look up a synonym to a word, you open the a thesaurus to find an alternate word. You press ALT+F7 and it bring it up. The thesaurus opens in a Task Pane, and when you are done, you click the X to close it. You don't unpin it and have it sit on the side and get annoyed when you hover over it and it pops into view, covering your content and getting in the way. With that being said, the same mental model applies to visual studio. Don't have windows or panes open which you don't need. Open them when you want to preform a task, "close" the task pane, don't hide it.
Cheers!
P.S. This doesn't mean I feel it isn't bad design to pop open windows when you hover over them (I'm sure someone will debate me on this). I still would like an option to choose when to open collapsed windows.
I keep it closed. I open it only when needed. I do the same for tools and servers.
Try to memorize their shortcuts, and keep'em closed.
Use the little "Pin" icon (right between the triangle and "X" icon of the pane) to fix it, then resize or close it.

How do I edit work items in the Visual Studio 2008 xml editor?

I'm trying to customize some TFS work items via the VS2008 xml editor, but every time I open a work item xml file it jumps to the graphical designer. All that gives me is a "View XML" button that doesn't let you edit the xml directly.
I don't have TFS but I know in regular VS there is an Open With... option in most items' contextual menu that even let you change the default editor. Very useful when you are tired of the Designer opening instead of the Code file on Windows forms.
Ah, looks like you have to go to File->Open and click the down arrow next to the Open button to "Open With" the xml editor. If someone wants to copy and paste this, free accepted answer :P
As per Coincoin's answer, this feature is also great for setting the default editor for ASPX. If you want to go to the Code Editor most often, then this is a default you'd want to change.
Reading this - I think perhaps you don't realize - that there is no need to edit the XML - in fact it is very difficult to do so. The graphical designer will actually let you change the Work Item type, adding new fields, changing workflow, rules etc.
The only reason to change the XML is if there's a bug in the Process Editor (the tool that gives the graphic designer). I have done extensive modifications of Work Item types and only had one instance where I had to change the XML.

Resources