I have finished another quick project. The plan for this was to introduce myself to WPF and XAML. My general thoughts are that despite that WinForms seems to be easier and quicker way to design a Windows application I find WPF more organised and more controllable that WinForms. I designed all windows for this application using only XAML editor (not the visual one) in Visual Studio. That gives better understanding what is happening with the window.

The application itself is quite simple: it converts Roman numbers to Decimal, and the other way around. Algorithms of conversion are quite simple so I won’t describe them here (they can be found in readme file, or by analysing the code).

That was quite a nice way to leap into WPF. Next week, I’m going to three-day basics of .NET programming course which I hope will give me more insight to WPF and MVVM model (which, I’ve deducted from some of the YouTube lectures about WPF, is essential for writing a well-organised and maintainable applications).

Stay tuned!

ClickOnce installer (*.zip)
Source code (*.zip)
Readme file (*.txt)

Localising your application

Some time ago, while working on an abandoned project (which, I have to admit honestly, turned out to be too laborious and complicated for me at that point) I had worked out a method to localise the program using XML files. That worked perfectly okay but only recently I have that there are way easiest methods to achieve that.
Let’s start with XML method. Available languages have a unique file with all strings stored in. The file is organised as follows:

As you can see each window has a specific section in XML file, and only this section will be loaded when a window is displayed. Every window has a method which loads all related strings:

Drawbacks of this method are clearly visible: you have to write a method which will load all strings from XML file. And you have to be extremely careful not to omit any text you want to display. It worked but not effectively at all.

There is other much simpler method which I found at It uses resource files and System.Globalization. General idea is that you create individual *.resx file for each language: Lang.resx for default (English) language and Lang.xx-XX.resx, where xx-XX is the name of a culture (for instance, pl-PL for Polish). What’s important is that access modifier for those files must be set as public as shown below.

These files must be stored in one folder (let say “Languages”). Now, you need to include them in your source code and you’re ready to use these strings in your code:

To use it with XAML you need to add appropriate namespace to Window element in XAML file:

Now, to switch between languages you need to change Culture in your process:

Of course, you need to build your app in a way that user has the possibility to switch between languages as he intends.

That’s about it. The method with *.resx files is much simpler and most of all quicker and to some point less prone to omissions and mistakes. Of course, there are other methods (for instance, Mulitilingual app toolkit  from Microsoft) but this one seems to me that is easy enough and does not require any add-on or third-party software other than Visual Studio).

This post is based on articles available at by Jerzy Piechowiak.



MakeNoMistakes 1.1


I have just finished the application introduced in previous post. To remind what the application is about: it is an implementation of a classic game Minesweeper. My addition to the idea is that once you click on a mine you have one chance to disarm the mine by solving small equation (addition or subtraction).

Here are links to ClickOnce installer and source code. As usual the code was written in MS Visual Studio.

ClickOnce installer (*.ZIP)
Source code (*.ZIP)

One note before you try it out – don’t mind the graphics. I am hopeless at drawings.


MakeNoMistakes – my implementation of a classic

Hello All,
It has been a while since my last post in which I announced ‘another small app’. It is now time to publish its first version. Generally, it is another version of small game which is distributed with MS Windows and it is about finding mines. The app I have written is slightly different. It gives a player a possibility to disarm a mine if it is found by right clicking. In classic minesweeper it is possible to click with both mouse buttons to uncover all adjacent tiles. In my app it can be done by hovering a tile for a short moment. In this case uncovering the mine will result in an explosion and therefore the game ends.
This is the first version. It is not finished, but I would say it is 95% complete. What is missing is possibility to play a game on custom tile-board and a hall of fame (and nice graphics, but I am not an artist at all). Right now I am publishing only an EXE file (in a ZIP archive). Source code will be published when the application is completed.
Thanks, Michal

MakeNoMistakes (*.ZIP)

Dynamically generated buttons

Currently, I am working on another small app which I will present here shortly. Its function will be disclosed later as that fact is of no importance to this post. What is important is that some buttons the app will create automatically depending on some user settings. The buttons will be arranged in, let’s call it excel-style, in a table with equal size cells. So, the buttons need to be generated in a loop. That seems to be an easy task, but it becomes a bit trickier if you want them to perform different action. Here’s how to do that.

The code above shows how to generate the buttons with individual action performed by each button. But the solution above requires you to know how many buttons your program will create and still manually write separate switch/case instructions for each but. Tricky, but in some cases might be enough.

If it isn’t enough C# gives you opportunity to create actions delegates and store them in a dictionary.

These are two approaches to dynamically created buttons with individual actions for each button.

This post has been compiled from:



More on dictionaries


Sometime ago I mentioned usage dictionaries to workaround lack of possibility to use variable which name is stored in another variable. It is useful trick (at least for me – beginner) but dictionaries may be employed to perform multitude of tasks. So, to preserve my newly gained skills I present most important aspects of dictionaries.

The main idea behind dictionaries is to have a structure that holds certain values tied to certain keys. It may be depicted as 1-D array which instead of numeric indexes uses any type of variables as example below shows:



Dictionary is a collection. To use it you need to include appropriate namespace: System.Collections.Generic. Definition of a dictionary must specify three things: its name, type of key and type of stored value:

The example below initialises empty dictionary – it was created using a constructor that doesn’t take any arguments. However, this is not the only option. Visual Studio suggest six different variations of constructor. You can set initial size of a dictionary, method of comparing keys – I am not going to describe each constructor as Visual Studio does that sufficiently. I just mention that it is possible to initialise a dictionary using a constructor that takes existing dictionary as an argument. Such action will copy of an argument dictionary to the newly created one. I find it most useful.



Adding new element
It is that simple that I was tempted to omit that, but for sake of conscientiousness here’s a quick example. To add a new element to a dictionary you need to use Add method and provide key and value of new element:

Accessing/modifying value of an element

Again, it’s very simple. Code below illustrates that:

Looping through whole dictionary
It is no secret that to run through whole dictionary you have to use foreach loop. To correctly design that loop you need to use KeyValuePair as an iterator. It is also necessary to provide types of keys and values accordingly to dictionary we want to loop through.

Other useful methods for dictionaries
Here are some other methods that you may find useful. These are quite simple operations so their description will be presented together with the code.



So, now we have basic comprehension of what dictionaries are and how to use them. I am sure you will easily find a task that which can utilise dictionaries. But to provide an example I’ll show one possible implementation.
Currently, I am writing an application which will allow user to switch between different languages (dictionaries, languages – that obvious, isn’t it?). The plan is to store language data in an XML file and load its content to a dictionary. Then, instead of hard-coding every word that is visible for end-user the program will display data stored in the dictionary. Here’s a class that allows that:

The class is static – there’s no need to create various instances as only one language can be displayed. The class has only one property – LoadedLanguage – a dictionary that uses string key to store string values.
There are two methods: method ExistLanguge(string) checks if a language file chosen by user exists. If it does the method returns true and the program continues. If the file doesn’t exist the program displays a warning message. Additionally, if the chosen language is English and its XML file doesn’t exist the program terminates as English is default language.
Another method is used to load specified language to the dictionary. As earlier said the language data is stored in the XML file. That XML file is divided into sections depending on which form it relates to.

Method LoadLanguage(string, string) takes as arguments language to load and section of XML file to load. Then it loops through the XML file and creates key/value pairs in the dictionary according to nodes present between specified area. Then these pairs are used in various parts of the program to display labels in specified language.

So, that quick guide through dictionaries would be it for today. Enjoy!

Examples (*.cs)

Solo Learn Learn C#


I work full-time. It is not a programming-related job, it’s completely different business. And from time to time it requires from me to travel, not much but still… During my last travel when I was waiting at the airport I figured out that I’ll check what android apps I would find if I try to search for “C#”. And indeed I’ve found something worthwhile to try it out.

Learn C# by Solo Learn is an app that delivers a series of C# tutorials. Topics are divided into sections, each section provides explanation of current topic, quick questions immediately after the explanation and a quiz after each bigger portion of information. I would say that it was quite fun to go through them all.

The app gives another utility which I find the most value of the app – Code Playground. It gives user a possibility to test and modify code that appeared in tutorial questions, create your own code or play around with tons of examples provided by community. Drawback of this feature is the fact that it only works online.

What’s additional fun is that you get a certificate after finishing all tutorials. That’s a quite  nice accent to end the tutorials.

All in all that’s a well-organised application that gives a basic background to C# and some moments of fun. Kudos!

SoloLearn on Facebook


Dictionaries or variable name stored in another variable


During my high school/university I tried a bit of HTML/PHP. Topic of my BE thesis was more or less this: “On-line journey planer written in PHP with use of MySQL database.” It was not a rocket science at all. I just used a slice of map of my hometown and (let say) manually converted it to a graph. I placed a node on each intersection and link between nodes represented streets from the map. Coordinates of nodes and links between them were stored in two tables. That allowed me to use Dijkstra’s algorithm to calculate the shortest path between selected nodes. From that time I remember that PHP allowed user to store variable name in a variable, as code below illustrates:

The above code would result with displaying value of $nested_variable. I am not sure if this is still valid for current version of PHP but it worked in PHP4.x.

So the feature presented above might be quite useful. But C# doesn’t give that possibility. However, there is a mechanism that can be utilised to achieve the same goal – dictionary. It can be compared to a 1D table but its advantage is that you can use strings as an index. So, you store your variable name in another variable and then you refer to your dictionary with this variable as an index. Example is below:

The solution above is a bit more complicated than PHP, but I think if you use it to a bigger scope of variables it’s organised in a much more orderly manner.

So that’s it for today. For those of you who master Polish language I give a link to my thesis mentioned at the beginning of this post. Enjoy!

BE paper (*.PDF)

Quadric equation solver


It’s time to publish my first application developed in C#. It is simple windows form application to solve quadric equations and draw graph for function derived from an equation. I am aware of the fact that its utility is close to none. Paper and pencil are better tools to deal with that kind of equations. But, as I mentioned in my first post here I want to learn C#. So I figured out that writing such an application would be a good starting point.

Feel free to download and test it. I look forward to your comments and suggestions.

ClickOnce installer (*.ZIP)
Source code (*.ZIP)

Above, you’ll find links to packages with the application and source code (all files written in Visual Studio, the package includes project file).

What I’ve learned while writings this app? I guess the best answer to that question would be the foundations: basic syntax, idea of OOP (but I guess this program could be organised better in terms of its object-orientation), common windows forms and very brief introduction to graphics. I feel that’s a good starting point. More is to come.



So, here we are. I don’t know how has it happened that you’re here. But I guess it’s not the weirdest thing that you have encountered in you life. So, let’s skip this question and let me enjoy the moment when somebody is reading this text.

You must be wondering who am I and what is the plan for this site. So, my name is Michał and I’m going to use this page to publish short texts mainly about my progress in learning how to develop Windows software. I am absolute rookie in this matter so don’t expect anything exciting or innovative. That’s not the purpose of this site. Its purpose is to keep track on my learning process.

My ultimate goal is to become a professional and successful developer. I will stick to C#/.net as I believe it is the most universal platform for Windows development.

As the world is not only zeros and ones, from time to time I will post something off main topic – mostly it’s going to be about what I read.

So, that’ll be it for today. I hope that you’ll visit this page again from time to time. If not, don’t worry it’ll be still nice archive for me.

Dust of our backs and onward!