Unit-Testing of Private Async Methods with Visual Studio

Description Given there is the need to unit-test a private async method. The class to be tested might look like this: public ClassWithPrivateAsyncMethod { // Some stuff private async Task PrivateMethodAsync ( string input ) { // Call some async framework method var result = await SomeFrameworkMethodAsync(input); // do something …

Using Windows Store App Resource Libraries in C# / XAML

Introduction Given there is a Windows Store app. Some of the resources that this app needs are part of a library. This library contains a XAML file (ApplicationStyles.xaml) for application specific styles and the StandardStyles.xaml that is generated when a new Windows Store App (XAML) project is created. ApplicationStyles.xaml uses …

Change Color of ToggleSwitch

Given you implement an app using the dark theme. This app contains some configuration values, which can be changed using a settings flyout. According to the design guidelines, the background of the settings flyout should be white. Unfortunately, the default color theme for all controls is dark. So they are …

Handling of Out-Parameters with .NET Reflection

Since Microsoft decided to remove the creation of private accessors for unit tests in Visual Studio 2012, one have to get familiar with the usage of Microsoft.VisualStudio.TestTools.UnitTesting.PrivateObject. This class offers an easy way to call methods, independent from their visibility, via reflection. The method is PrivateObject.Invoke. This method saves you …

MDI / Multiple Tabs Flat Navigation App Bar in Windows Store Apps

Summary The Windows 8 User Experience Guidelines mentions two different navigation designs: the hierarchical and the flat system. As said in the guidelines, most Windows Store apps use the hierarchical system. But I needed a flat navigation. And in addition, I needed a way to implement a Multiple Document Interface …

Microsoft Advertising Services AdControl Error Handling in XAML/C#

Preface The Do’s + Don’ts of the Advertising SDK say “DO plan for times when no ads are available.” The links of that item leads to the ErrorCode enumeration and a rudimentarily error handling sample, writing text to debug output. In this post, I will show an error handling where …

Implement Settings Popup Pages for Windows Store Apps

Preface No, this is not the first sample to be found in the internet on this topic. Anyway, I decided to add another one because the two I was looking at (see links below) gave good ideas, but did not satisfied me at all. Changes to App.xaml.cs To begin, new …

Use OpenFileDialog and FileBrowserDialog in WPF

WPF does not contain a OpenFileDialog or FileBrowserDialog. Nevertheless, I needed them in a WPF application. Searching the web, I found several approaches. One published on GitHub (https://github.com/tillias/wpFolderPicker) implements a new control for folder browsing. But I wanted a “cheap” solution. And found the starting point here: WPF OpenFileDialog and …

Microsoft Advertising Services AdControl Transition in XAML/C#

Preface According to the documentation, AdControls are hosted in a WebView control. For some reasons I was not able to figure out, WebView controls do not slide in when a page loads (or pop in, whatever the correct wording is). This means that your AdControl will not slide in neither. …

Configure Microsoft Advertising Services’ AdControl using XAML/C#

Preface The Microsoft Advertising SDK for Windows 8 allows developers to show ads in their apps. When you look at the walkthrough for putting ads in an app using XAML/C#, you can see that you have to set the ApplicationId and AdUnitId property of each AdControl control in your app. …