Monday, 21 December 2009

Single Line saves the day !

In my recent project, I was assigned to solve the bug reported from customer. Okay let me brief you about the application, its PC application for Ultrasound scanning exclusively used to scan Bladder, when technician scans the bladder transducer captures the 24 scanned images. Mean time we have to show the progress of image capture like “Image 1 of 24” so on..

To show the image capture status, we used the ReadComplete event supplied with transducer driver, but the problem was Readcomplete event used to trigger every 5ms, Each time the application handles this event, it processes all the code associated with that event. All other events wait in the queue.

The with event is while our code handles the it, our application does not respond. This caused the huge problem on low speed processor that it did not update Image capture progress.

For solving this issue we almost tried many ways for almost two days, finally we got solution in just a single line! Yes, its just single line solution! The savior is

System.Windows.Forms.Application.DoEvents()

If we call DoEvents in your code, application can handle the other events. For example, if you have a form that adds data to a ListBox and add DoEvents to your code, your form repaints when another window is dragged over it. If you remove DoEvents from your code, your form will not repaint until the click event handler of the button is finished executing.

Happy coding…

Thursday, 26 November 2009

Small is good!

It's just been a week I'm using Visual Studio 2010 Beta 2, I already experienced the power of VS2010. It's packed with tons of feature, personally I loved the small features which come very handy while coding as well as while debugging.

When start VS, you see the new shinny and clean WPF shell and here is the first present for you.

You can actually pin the any of the recent projects to start page! This is very useful when want your frequently used projects to stay always on start page

VSE2010B2_StartPage


When you open code any of code file you will notice a small dropdown box to zoom your code file it's very handy when we are giving code demo, so we can save lot of click to increase font size, hmm… impressive.

Zoom


 

Next feature may not be used frequently but it's very useful, it actually allows you to insert file content without actually coping it….

InsertFromText


Next feature is my favorite Phil Haack has detailed blog post about it, go check it out..


 

Sunday, 15 November 2009

void Main()

Yes, you guessed it write it's yet another coding blog from unknown geekdeveloper who is in love with C# and Visual Studio :P

I started this blogs only to improve skill of explaining technical stuff some time I feel that  I know more than what I’m presenting but unble present those :(

I don't have any clear idea what I'm going to put here, but you may expect some design practices, eureka moments and thing related C# and Visual Studio.