WPF Async Pack

WPF Async Pack is a small library for creating asynchronous WPF applications. It’s not a framework, it was created mainly for the small applications where installing heavy frameworks is just overkill. It doesn’t have any dependencies and contains such the most used classes as AsyncCommand and BaseViewModel.

The library can be installed through the NuGet:

PM> Install-Package WpfAsyncPack

Continue reading WPF Async Pack

ResX Translation Tool 1.1

ResX Translation Tool Logo I’ve just released the first version of the helper application ResX Translation Tool that simplifies project localization and minimizes manual work with ResX files!

At work we develop an application that is localized for now into 3 languages. The base one, English, is maintained by our team. And previously we had to create the list of resources for translation into 2 other languages, and send this list in the Excel file to our customer. The next step was to update project’s resources with the new translated texts. A lot of manual work…

Continue reading ResX Translation Tool 1.1

Open XAML without design editor in Visual Studio

Just a quick post about Visual Studio setting that disables the design editor for XAML files. If you prefer to work only with source code without Designer, you can configure it in the Tools -> Options:

  • For Visual Studio 2013 enable the setting Always open documents in full XAML view in the Text Editor -> XAML -> Miscellaneous

Disable XAML design editor in Visual Studio 2013

  • For Visual Studio 2015 set the Default document view to Source View in the XAML Designer -> General

Disable XAML design editor in Visual Studio 2015

Compilation directives for controlling XAML content

In C# in order to control what code should be executed we can use compilation directives #if, #else, #elif and #endif. For instance, we can compile certain code only in Debug mode and exclude one in Release. #if directive can be used not only to test for symbols DEBUG and RELEASE. We are able to define any symbols. Let’s take a look how to do that and how to use newly defined symbol in the code. For example, we want to add some funny log messages when symbol FUN_MODE is defined.

  1. First, define a new compilation symbol for the whole project in the project’s properties:Compilation directive XAML 1 FUN_MODE
  2. Then we can check for defined symbol in the code:
    #if FUN_MODE
        logger.Debug("Yahoo! It looks like our app finally works!");
        logger.Debug("Application started.");

Everything is quite simple. The question is how to achieve the same in XAML code.

Continue reading Compilation directives for controlling XAML content

Polymorphic serialization using Newton Json.NET in HttpContent

Imagine a quite common client-server application where server exposes REST methods and client communicates using HTTP requests. Requests and responses are serialized in JSON format. There might be a problem if you try to send and receive a DTO that contains a collection of interfaces or abstract classes. I will talk about usage of Web API and Newton Json.NET as it’s underlying serialization library.

Continue reading Polymorphic serialization using Newton Json.NET in HttpContent