Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Event Refactoring

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
MiddleTommy Posted - Jan 16 2008 : 11:00:26 AM
I couldn't find this anywhere so an Idea would be a simple event refactoring tool.
Like encapsulate field. but with an event that would give you a common

private void OnEventName()
{
if(EventName!=null)
EventName();
}

it may not always be what you want, but it is easily changeable.
I am using C#
5   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Jan 22 2008 : 7:57:34 PM
It sounds like you simply want to use $selected$ in your snippets. Notice that VA lists these in a seperate group, to make them easier to pick out, when you press the "Insert Snippet" toolbar button.

http://www.wholetomato.com/products/features/vasnippets.asp
MiddleTommy Posted - Jan 22 2008 : 3:28:54 PM
Yes that is true unless you Made the tool automatically name the method
On[EventName]

Just like the Encapsulate Field tool Automatically names the property
(though I guess it still asks you if that is the name you want)

And it is easier because when you have alot of snippets you have to remember the snippet name

perhaps a better solution that would fit just about anything like this would be similar to the surround with tool
except you have your code snippet and it places what ever you right clicked on in all occurrences of the first variable (i.e. $VarName$) then the rest of the variables (ie $VarName2-N$) fields you would have to hand enter like a normal snippet.
Now if you only have one variable name in a snippet it would be all automatic with no typing.
I.E.
Right Click a variable/word/etc then goto Populate Snippet then a list of all your snippets comes up. very similar to Surround With except you dont deal with the selection you deal with only one symbol.

Do you understand the concept?
feline Posted - Jan 21 2008 : 4:35:59 PM
How would an automatic refactoring be easier / better? You would still have to deal with a dialog to specify the event name.
MiddleTommy Posted - Jan 21 2008 : 2:33:07 PM
Yes that is a help thank you
But an automatic refactor would still be better.
feline Posted - Jan 17 2008 : 3:09:03 PM
You can do this with a VA snippet. Add a new snippet with this text:

private void On$EventName$()
{
    if($EventName$ != null)
        $EventName$();
}


make sure you give it a name, and then tell VA you want to insert this snippet. You will be prompted for "EventName" and when you provide this, you answer is inserted into the snippet text, giving you the code

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000