Posts

Showing posts from July, 2011

Notify Async operation in C#

Image
Threading is a nice thing until we know how it is being executed. Sometime it can be a pain in the arse and sometimes asset you gain from. Today came across a question on how to get to know a async operation is completed thought of spending some time to explain it in my way.
How do you get to know a Async operation is completed, well one way is IAsyncResult,this is how we go,
Lets create a delegate that will be used call our time consuming or background task.
delegatestringCallFunctionDelegate(string arg1, string arg2);say the time consuming function

privatestring DoSomeThingBig(string arg1, string arg2)
just to show how to pass argument, i have used some dummy arguments.

Once the time consuming function is completed lets call the notification function that will called after the asynchronous operation let that be

privatevoid AfterDoingSomethingBig(IAsyncResult result)

Now for this kind of function signature we have a delegate class called AsyncCallback
next will create an instance for that d…

Visual studio styles

Transform your visual studio's visual looks :) There are a lot of templates that are readily available.
Thanks to Luke Sampson who has created a space to share styles.

Personally i like WekeRoad Inkand Zenburn 2010

publicpartialclass_Default : System.Web.UI.Page     {         delegatestringCallFunctionDelegate(string arg1, string arg2);         protectedvoid Page_Load(object sender, EventArgs e)         {             AsyncCallback CallBackAfterAsynOperation = newAsyncCallback();         }

Its damn easy to get it done.
1.Open Visual Studio
2.Click on Tools->Import and export settings
3.Select Import selected environment settings
4.Select No, Just Import new setting
5.Now browse for the settings file you downloaded from http://studiostyl.es/

Make your visual studio interesting. If you are really good in colors create one style and upload in Luke's repository.