Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible to include an image in the meta data in code? VS 2013

I would like to be able to include a screenshot of a control inside my code, this way making control identification easier for new members on my team, is such a thing possible?

Maybe even the ability to just have the image on a network share with the path in a comment, and then have a plugin that when hovering over the link brings up the image?

EDIT (More detail):

I'm creating a test project, the application under test has over 1000 controls, some of them are similar in name and purpose, this can make it difficult at times for developers to reuse the API I am creating because the control name is simply not enough for quick identification of the control in use.

I use the word API very loosely too, none of this stuff will be consumed in web services, and it will always be white box with developers including a project reference and have direct access to the source code.

For every form in my application (The test one), I have a controls.cs file where all the controls for that form in the application under test are listed - This is where I want the hover to screenshot ability in the control definitions.

Another sure factor is that all developers will be using VS2013 (For now the base version), later this could be update 1 or 2.

As the initial author and senior developer on this project, these hover / image references (in the code) will be as useful to me personally as any 3rd party developers, or any later developers to join the initiative.

Thanks again, and I added a bounty!

like image 247
JL. Avatar asked Aug 26 '14 10:08

JL.


1 Answers

I believe you can use Whole Tomato's free SourceLinks Visual Studio extension to do what you want - or at least get pretty close to it.

Built-in Functionality:

Out of the box, the extension allows you to specify comment patterns you want users to be able to take an action on. Once the patterns are specified, SourceLinks will highlight any occurrences of those patterns in the text editor. You will be able to double click the highlighted items and perform a pre-configured action (such as opening a link in an internal/external browser, or launching an executable).

You can see an example in the SourceLinks configuration dialog shown below: SourceLinks Configuration Dialog
(source: wholetomato.com)

So you could use this feature pretty painlessly to define a keyword such as Control Image and then put comments like the following in your code:

   // Control Image: my_smart_list.jpg

SourceLinks would allow you double click this text, and you could have that configured to launch the image (using a file:// or http:// url depending on how and where your images are stored) either inside Visual Studio in it's internal browser, or in an external browser.

Custom Tooltips!

Now, if you want to put in some more effort into this and actually write some code, then SourceLinks allows you to create API Extensions to display custom tooltips when the user hovers over the marked text in the editor. The default installation of SourceLinks comes with sample API extensions that you can copy to create your own. See the article linked at the very top of the answer for more details on these samples.

This post in the SourceLinks forum informs us that SourceLinks expects the custom API Extension to return the tooltip value as FlowDocument XAML text. This is awesome news for us, because a FlowDocument can contain many types of elements, including formatted text, hyperlinks, and images.

Imanges in a Flow document can be specified both inline as well as externally.

Hope this helps!

like image 180
Tanuj Mathur Avatar answered Oct 11 '22 17:10

Tanuj Mathur