Category: WPF

Async / Await and SynchronicationContext (C# .Net)

Async / Await and SynchronicationContext (C# .Net)

Following innocuous looking async / await code will cause deadlock. To understand why, lets go into what await does in the above case. 1 Execution starts when the button is clicked and button1_Click event is fired on the UI thread. 2 The method, named LongRunningProcess, is invoked. 3 The lamda expression passed to Task.Run() executes in…

Read More Read More

Creating and Consuming Async methods (C# .Net)

Creating and Consuming Async methods (C# .Net)

The code we want to run asynchronously could either be CPU-bound or IO-bound. CPU-bound code keeps the CPU busy, requiring intensive processing, calculations etc. On the other hand, IO-bound code frees up the CPU while waiting for an IO operation to complete, for instance, get some data from a web service. Both kinds of asynchronous…

Read More Read More

Reached “Design – All Star” in design .toolbox

Reached “Design – All Star” in design .toolbox

 .toolbox is a really fun environment to learn basic design concepts as well as the fundamentals of creating Silverlight applications using Expression Studio. Today, I finished both the tracks (i.e. principles and scenarios) and achieved all 15 badges. The high quality tutorials and evaluations, and a very nice theme make it really enjoyable. Check…

Read More Read More

Microsoft Visual Studio LightSwitch

Microsoft Visual Studio LightSwitch

Visual Studio LightSwitch is a new tool from Microsoft for developing business applications. Currently available development technologies from Microsoft (like VS C#) are general purpose and can be used to develop a wide variety of applications. LightSwitch, on the other hand, is focused on simplifying development of business applications by handling the basic plumbing itself.…

Read More Read More

Save and Load RichTextBox content in WPF

Save and Load RichTextBox content in WPF

The content of RichTextBox can be saved to a file (or any other stream) using TextRange class. It supports following four formats: System.Windows.DataFormats.Text : This saves the plain text in the content of RichTextBox excluding the formatting information and the images. System.Windows.DataFormats.Rtf : This saves the content in RTF format preserving formating information and images.…

Read More Read More