Code Samples

On this page you can find a collection of all code samples published by Instance Factory in alphabetic order.

Busy-Indicating Dialog for Windows Store Apps in C# / XAML

Some of you might know the BusyIndicator from the WPF Toolkit or from Silverlight. This sample shows a busy-indicating dialog for Windows Store apps with these features: disable interaction (‘lock’ the app), UI thread not blocked, progress indicating, cancel operation option.

C#, XAML, Windows Store apps

BusyIndicator for Windows Store Apps in C# / XAML

This sample shows a BusyIndicator for Windows Store apps. It can be useful to disable controls that user shouldn’t interact with while an indeterminate task is running.

C#, XAML, Windows Store apps

Configure Microsoft Advertising Services’ AdControl using XAML/C#

AdControl’s AdUnitId cannot be changed, once it is created. This sample shows a way on how the AdUnitId can be set “dynamically” during runtime, even though there is an AdControl defined in XAML for design purposes. In addition, it covers AdControl transition and error handling.

C#, XAML, Advertising, Windows Store apps

Handle Race Conditions / Concurrency in Code First Entity Framework Applications

This sample shows a simple way on how to handle race conditions / concurrency using the Entity Framework Code First approach.

C#, SQL Server, Entity Framework

Home-made Private Accessor for Visual Studio 2012+

Starting with Visual Studio 2012, private accessors cannot be created by the IDE any more. This sample offers a ready-to-use generic base class to ease and simplify the creation of private accessors, making unit tests type safe again and hiding the use of the PrivateObject class.

C#, .NET Framework 4.0, .NET Framework 4.5, System.Reflection Namespace

Implement Settings Popup Pages for Windows Store Apps

Beside offering a generic method to open different kinds of settings pages, the sample focus on correct flyout transition.

Three different kinds are implemented. The last meets the demand that both the header’s and content’s controls must be animated.

C#, XAML, Windows Store app

Logging in a Multithreaded Environment

The sample shows one way to implement a dynamic, thread-safe, asynchronous, chronological logging mechanism in a multi-threaded environment, using the Observer and the Singleton design patterns, thread synchronisation via semaphores and critical sections, and a thread-safe queue.

Multithreading, C++, Logging

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

This sample shows an implemention of a Flat Navigation App Bar for a MDI / Multiple Tabs User Interface in Windows Store apps. The user can enable / disbale app bar animation. Two different modes for selecting / opening a tab are implemented.

C#, XAML, .NET 4.5, Windows Store apps

MessageBox for Windows Store Apps in C# / XAML

MessageDialog is limited to three commands. This sample implements a modal popup dialog with an unlimited number of commands. It also offers the ability to show an optional symbol. The usage of MessageBox is very similar to the usage of MessageDialog.

C#, XAML, Windows Store app

Microsoft Advertising Services Test Mode Sample for Windows 8

This sample shows all available test modes of Microsoft Advertising Services on one page. You need the Microsoft Advertising SDK for Windows 8 to build the sample.

C#, XAML, Advertising, Windows Store apps

Mimic app.config in Windows Store Apps

This sample shows a way to mimic app.config behavior, commonly used in .NET applications, for Windows Store apps.

Please think twice before you use it. Maybe using local or roaming application data is the better way to go.

C#, XML, .NET 4.5, Windows Store apps

SCC Removal Tool for TFS / Visual Studio

The primary intention of this tool is to disconnect a Visual Studio solution from source control. Beside removing the SCC footprint, it also deletes all the output, created by building a solution.

This tool is based on the usage of TFS 2012 und Visual Studio 2012.

C#, WPF, .NET Framework 4.5, Team Foundation Server