Skip to main content

WPF – ContentControl and TemplateSelector

Content_selection

Here is a simple example about the ContentControl and the TemplateSelector. This is really useful when you have a single model that can be represented on the UI in different ways depending on an enum for example. This will be the final result in the UI while using the same model: Let’s start with our […]

C# – BDD Tests with xBehave and xUnit

given-when-then

In this post we will see the basics of BDD with xUnit and xBehave. But not only! If you don’t know what are: BDD, Gherkin, integration tests, Cucumber, SpecFlow, xUnit or xBehave, read the following sections. Otherwise, just skip straight to a simple example of an integration test with C# based on xBehave and xUnit. […]

C# Multiply all elements from a list

mulitply aggregate

Here is a really short and simple example of how multiply all elements from a list with C#. The bad way and the good way. The bad way to multiply items from a list with C# There is actually nothing bad about it. It is just not sexy and doesn’t use LINQ. But to be […]

Unzip file using C#

unzip

Extracting the content of a ZIP file is really common. And here is a simple example of how to do it with C# using ZipFile and SharpZipLib. If you are using .Net Framework 4.6.0 or up you can use System.IO.Compression.ZipFile from Microsoft. But if you are lower than 4.6 then you can use SharpZipLib from […]

C# – FTP With ComponentPro

FTP

ComponentPro is a professional suite of libraries for FTP, sFTP and document manipulations (Word, Excel, PDF, …). Here is a simple example of how to use it with (s)FTP.

How to use Font Icons

font-awesome

What is the issue with images? The problem with images is that if you try to zoom in, the quality starts to be really bad (ugly pixels) without even talking about the size of it. The best way to display nice icons in your app or website is to use Font Icons. Like that you […]

UWP – How to get the close app event

close-event

Basically, what we want here is to be able to catch the close event of our UWP app. We could go further and ask the users if they want to save their changes before the Exit. In the App.xaml.cs: Here, it is important to put the CloseRequested event before the Activate of the View. Then, add the code for […]

UWP – UI Thread and Multiple Views

UIThread UWP Dispatcher

What is “multiple view” in UWP? In UWP, your “main” application can open a new – separated – view. Here is a link from the Microsoft website. When should you use multiple views? In many cases it is useful to be able to open multiple views: – An email app that lets users view a […]

UWP – Theme Overview

UWP Themes Logo

How to get current Windows 10 Theme? In the namespace Windows.UI.ViewManagement, you can Access to the UISettings class. It will allow you to get the Window background and deduce the current theme. How to set the theme when multiple views are open? You must iterate all the views via the CoreApplication. Secondly, you can go […]

C# – MongoDB

mongodb-logo

Here is a simple example of how to use MongoDB with C#. What is MongoDB? MongoDB is a cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schema. How to use the MongoDB? Because MongoDB has to run on a server, you then have two options: install it or […]