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
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 […]
C# – MongoDB
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 […]
WPF – ProgressBar
In this simple example, we will see how to create and manipulate the ProgressBar control from WPF in a MVVM way. Let’s start with the View in XAML: And now the ViewModel: Happy coding! 🙂
MongoDB Realm – Simple example
Here is a simple example on how to use MongoDB Realm with C#. What is MongoDB Realm? MongoDB Realm will combine Realm, the popular mobile database and data synchronization technology, and MongoDB Stitch, the serverless platform for MongoDB, into a unified solution that makes it easy for you to build powerful and engaging experiences on […]
C# – Custom Attribute
In this article, we will see together how to create our own custom attribute with C#, and then get the value of it thanks to reflection through a simple example. What is an Attribute? An attribute is basically a metadata object used to provide declarative information to a class, property, enum, … You can retrieve […]
C# – Moq tutorial for beginners
What is Unit Testing? Unit Testing is a very important part of coding. It consumes time and efforts, but it worth it. Thanks to Unit Testing you will feel more confident and you will know that your code is working. Of course testing everything is almost impossible, but at least the normal cases and some […]
C# – Directory.GetFiles – mock files for Unit Tests
It is common to use Directory.GetFiles from the System.IO. But it’s a bad habbit! We should be able to Unit Test our methods. Here is a simple way to do it. In this article I will use MOQ, if you don’t know it, please check this post about Unit Testing with MOQ. Instead of using […]
C# – Enum Color Converter with IValueConverter
With WPF, it’s pretty easy to create a converter to display the color of a text depending on an Enum value. Here is a simple example with IValueConverter. Let’s start with the View: As you can see, we use a converter to select the correct color. Here is the code for this converter: The color […]
C# – Resolve Environment Variables from Windows
Environment Variables can be used in any Operating System. Here we will focus on the Windows OS. These variables are just common shortcuts used to define something generic that can change between different machine. For example, the UserName of the current logged in user can differt from a computer to another. So instead of using […]