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

Filling model properties using Reflection

In this topic I’m going to show how to fill object properties using reflection no matter what types they are.

Let’s take some example. Say, we have some input CSV file with header and values:

HTC;Titan;Black;Windows Phone 7.5;20111007;10.0
Samsung;Galaxy S3;White;Android 4.0.4;20120529;9.8
Nokia; Lumia 920;Yellow;Windows Phone 8;20121102;9.9

We are going to operate with these values in our application. First of all we need to parse each line. It can be done manually or using some existing library. Parsed values we can store in a dictionary, for instance. Anyway, it’s not a question of the topic.

Continue reading Filling model properties using Reflection

Skype Auto Recorder 1.3.4 released

LogoToday I’ve released version 1.3.4 of Skype Auto Recorder!

Ready-to-use application you can find on Downloads page.

Documentation was also updated and contains description of the new features and even more details about old ones.

Sources for each release are in separate branches from now. For the current version they can be retrieved from the Release_1.3.4 branch.

Continue reading Skype Auto Recorder 1.3.4 released