VS2010 extension help - c#

I have an extension idea, but I don't know where the first step is. I know that using design view, in conjunction with properties, I can get an event list for a control.
I want to write something that would show me a context menu in source view on something like OnClick="Button1_Click" and generate an empty event method in code behind complete with args.
(the equivalant of double clicking a button in design view)
I've never coded against the IDE itself, and I'm not having any luck finding a jumping off point, but I relly want some info that relates to that 'events' section of the properties box.
EDIT: why am I getting negative numbers for asking a question, am I asking it wrong?

MSDN will help :) See these pages on how to provide a custom properties window.
However, it won't be just as easy as your example, unfortunately. There's quite a bit of infrastructure to deal with when programming VS extensions. I'd recommend reading up on VS Integration on MSDN.

Ok, so admittedly, I did not ever figure out how to do this. However, I've just read the VS11 will be doing this. I am happy to see that M$ has added this functionality going forward. They've also added smart tags to the html view, which means maybe never having to go to design view again!
More Details Here:
http://weblogs.asp.net/scottgu/archive/2011/08/31/html-editor-smart-tasks-and-event-handler-generation-asp-net-vnext-series.aspx

Related

Change code during runtime

There is an old video of Notch debugging and testing his code and while doing so he simply pauses his game, makes his code modifications, and resume his game with the new changes.
I found this old post explaining how he does it, but I'm wondering if there is an equivalent to Visual Studio 2012.
I know that you can enable Edit and Continue but this is a lot more restricted in the sense that you can't edit anything you want and you need to set a breakpoint. So Edit and Continue is not quite what I'm looking for.
I know that you can enable Edit and Continue but this is a lot more restricted in the sense that you can't edit anything you want …
Yes, there are some things that you can't edit with Edit and Continue. But that's the best you can do with the current tools, I don't think there is a way around that.
… and you need to set a breakpoint
No, you don't. You can use the “pause” button in VS (real name Break All), edit your code and then let it continue executing.
.NET's edit and continue is nowhere near as good as that provided by Visual C++, Visual Basic or any dynamic (ie script) languages which is a pity.
If you can live with the limitations (having to break execution, no 64-bit support unless you are v4.5.1+, no lambda/linq changes, changing active statements, and a few others) then you should be ok to do pretty much the same. I find though, that I always end up wanting to change something that's unsupported :(
The big alternative is to use unit tests - in that, if you have enough tests you do not need to go debugging into your code at all. I think its debatable whether you save more time or not, and maybe it depends on the programmer style which suits you better.

Comment template in VS2010

I have inherited an API which doesn't have proper comments, and I am working on changing that.
Anyone know if there is some sort of mechanism to add a default XML comments to all the members of a class or an assembly?
(I remember seeing something like that on a webcast and I think he might have used PowerShell script to achieve that.)
This way I can avoid lots of repetitive steps, and have everything in place to go and start writing just the comments.
Anyone has any better suggestions?
GhostDoc is pretty fantastic for XML documentation, although you'll need to purchase a copy to generate automatic documentation for all classes/members. The free version allows you to right click (or use a hotkey) on class or member and it will generate the documentation.
I've found GhostDoc to be pretty good.
Once you've run it over your code you then simply add details where required.
http://submain.com/products/ghostdoc.aspx

GUI Programming Language

Don't worry, I'm not going to ask that question, yet again...
I am wanting to create my own programming language, just for learning sake.
I don't want anything other than possibly a few links to head me into the right direction.
MSDN Documentation on C# that is specific to what is required to create a language would be great!
For the time being, all I am wanting to create is a very simple language that allows me to Create a Form, add a control to it, give that control a location, and maybe even some properties like a Text property, or maybe even a Color property. That's it!
Any help / advice at all is greatly appreciated!
Thank you :)
You want a language or some GUI libraries?
They are a little different, you know?
For a language you could start here:
http://www1.idc.ac.il/tecs/plan.html
(it's a complete course)
or there is this:
http://msdn.microsoft.com/en-us/magazine/cc136756.aspx
This is for targetting the .net VM, so you don't have to create the VM, and it seems to be very "down to earth"
As for language design, start with something simple. Have a look at Tcl/Tk (http://tcl.tk) for a very simple yet surprisingly powerful language/GUI toolkit design.

Recommended way of mixing .NET and file context menus

I have a C# WPF application. It is designed to work on any and all files. Right now, it accepts 'input' by means of commandline arguments as well as drag and drop to a control in its main window. However, ideally I want people to rightclick any file/multiple files and have them be able to simply click 'Awesomify this'. (That's not the real name. :P)
I've got some experience with context menus from years ago, so all in all, it isn't too current. As such, I am looking for advice on the best way to implement this feature. All examples following are based on what I see using W7.
Generally, I understand there's basically two ways: pure registry, and registry + COM object.
The former has a certain elegance to it, since I don't want anything special; however, from what I can tell by documentation, these menu items always clump up at the same place as the primary file actions (Open, Preview, Print). However, I'd like my item to appear lower on the totem pole. If I look at my personal contextmenu for a random file, I'd want it to be at the 'spot' UltraEdit and Malwarebytes Anti-Malware stick themselves. Sticking my entry under HKCR\*\shell\AwesomeTest gets me my item, but no matter what I pick for the Position, I get two different extremes I don't like: Top puts it above the default item, Bottom puts it right above Properties. I want it inbetween Share with and Restore previous versions, which where most general-purpose tools seem to find a home.
Some more registry digging seems to point out the apps I wish to mimic use the COM object route. And that would bring me (I believe) back to native code. Which would then bring with it all the hells of 32-bit and 64-bit development I am trying to avoid.
Is there anything I am missing? Likewise, other than the MSDN page regarding context menu handlers which I have looked through and found to be rather unhelpful (as it seems to skim a lot without diving into the more precise details regarding placement and such), are there any good sources regarding this problem?
Another thing I've not been able to figure out just yet is how I can properly add IDropTarget support to my .NET WPF application yet, so information on that would also be welcome.
If anyone has an instant answer, well that would be nice, but I am mainly trying to find the right path to take without wasting several days on the paths that are dead-ends. Which there seem to be a lot of. :(
IContextMenu::QueryContextMenu(). Shell extensions are in the domain of C++, very unpleasant in C#, .NET 4.0 required. A sample project that uses it is here.

Extracting data from an ASPX page

I've been entrusted with an idiotic and retarded task by my boss.
The task is: given a web application that returns a table with pagination, do a software that "reads and parses it" since there is nothing like a webservice that provides the raw data. It's like a "spider" or a "crawler" application to steal data that is not meant to be accessed programmatically.
Now the thing: the application is made with standart aspx webform engine, so nothing like standard URLs or posts, but the dreadful postback engine crowded with javascript and non accessible html. The pagination links call the infamous javascript:__doPostBack(param, param) so I think it wouldn't even work if I try even to simulate clicks on those links.
There are also inputs to filter the results and they are also part of the postback mechanism, so I can't simulate a regular post to get the results.
I was forced to do something like this in the past, but it was on a standard-like website with parameters in the querystring like pagesize and pagenumber so I was able to sort it out.
Anyone has a vague idea if this is doable, or if I should tell to my boss to quit asking me to do this retarded stuff?
EDIT: maybe I was a bit unclear about what I have to achieve. I have to parse, extract and convert that data in another format - let's say excel - and not just read it. And this stuff must be automated without user input. I don't think Selenium would cut it.
EDIT: I just blogged about this situation. If anyone is interested can check my post at http://matteomosca.com/archive/2010/09/14/unethical-programming.aspx and comment about that.
Stop disregarding the tools suggested.
No, the parser you can write isn't WatiN or Selenium, both of those Will work in that scenario.
ps. had you mentioned anything on needing to extract the data from flash/flex/silverlight/similar this would be a different answer.
btw, reason to proceed or not is Definitely not technical, but ethical and maybe even lawful. See my comment on the question for my opinion on this.
WatiN will help you navigate the site from the perspective of the UI and grab the HTML for you, and you can find information on .NET DOM parsers here.
Already commented but think thus is actually an answer.
You need a tool which can click client side links and wait while page reloads.
Tool s like selenium can do that.
Also (from comments) WatiN WatiR
#Insane, the CDC's website has this exact problem, and the data is public (and we taxpayers have paid for it), I'm trying to get the survey and question data from http://wwwn.cdc.gov/qbank/Survey.aspx and it's absurdly difficult. Not illegal or unethical, just a terrible implementation that appears to be intentionally making it difficult to get the data (also inaccessible to search engines).
I think Selenium is going to work for us, thanks for the suggestion.

Categories

Resources