WINDOWS SDK INTEGRATION

Add your first banner.

WinMonetize provides a native control for every supported Windows UI framework. Pick the package that matches your app, initialize it once, and place one banner control.

1

Register your app

Submit its Microsoft Store identity or signed EXE/MSI in the developer dashboard and wait for approval.

2

Create an ad unit

Copy the numeric ad unit ID and your wm_… API key from the dashboard.

3

Integrate and test

Follow your framework guide below with sandbox mode enabled, then complete the production checklist.

Keep both values handy: the API key initializes the SDK; the ad unit ID belongs on each BannerAdView. Do not put your API key in XAML.
STEP 1

Choose the package for your app.

Download the current SDK from Developer dashboard → SDK & API. Add the extracted package directory as a NuGet source, then install exactly one UI package. Its shared Core dependency is installed automatically.

App typeNuGet packageSupported target
Windows FormsWinMonetize.SDK.WinForms.NET Framework 4.6.2–4.8.1 or .NET 8+ for Windows
WPFWinMonetize.SDK.Wpf.NET Framework 4.6.2–4.8.1 or .NET 8+ for Windows
WinUI 3WinMonetize.SDK.WinUIWindows App SDK on .NET 8+
UWPWinMonetize.SDK.UwpWindows 10 version 1809 (build 17763) or later

Using Visual Studio: open Manage NuGet Packages, add the extracted folder under Package Sources, select it, and install the package named above. Do not add a .nupkg file as an assembly reference. Then use following example command in Package Manager Console.

Install-Package WinMonetize.SDK.Wpf -Version 0.x.x -ProjectName TestProject

01
WINDOWS FORMS

WinForms integration

  1. Install WinMonetize.SDK.WinForms.
  2. Initialize before opening the first form in Program.cs:
WinMonetize.SDK.WinMonetize.Initialize("wm_your_api_key");
WinMonetize.SDK.WinMonetize.EnableLog = true;
WinMonetize.SDK.WinMonetize.SandboxMode = true;

Application.Run(new MainForm());

3. Add the banner in the designer or create it in your form:

using WinMonetize.SDK.Controls;
using WinMonetize.SDK.Models;

var banner = new BannerAdView
{
    AdUnitId = 58310427,
    AdSize = BannerSize.Leaderboard,
    RefreshIntervalSeconds = 45
};

Controls.Add(banner);
02
WINDOWS PRESENTATION FOUNDATION

WPF integration

  1. Install WinMonetize.SDK.Wpf. NuGet selects the correct .NET Framework or modern .NET asset.
  2. Initialize at application startup in App.xaml.cs:
protected override void OnStartup(StartupEventArgs e)
{
    WinMonetize.SDK.WinMonetize.Initialize("wm_your_api_key");
    WinMonetize.SDK.WinMonetize.EnableLog = true;
    WinMonetize.SDK.WinMonetize.SandboxMode = true;
    base.OnStartup(e);
}

3. Add the namespace and banner to your window or page:

<Window
  xmlns:wm="clr-namespace:WinMonetize.SDK.Controls;assembly=WinMonetize.SDK.Wpf">
  <wm:BannerAdView
    x:Name="Banner"
    AdUnitId="58310427"
    AdSize="Leaderboard"
    RefreshIntervalSeconds="45" />
</Window>
03
WINDOWS APP SDK

WinUI 3 integration

  1. Install WinMonetize.SDK.WinUI.
  2. Initialize before creating the first window in App.xaml.cs:
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
    WinMonetize.SDK.WinMonetize.Initialize("wm_your_api_key");
    WinMonetize.SDK.WinMonetize.EnableLog = true;
    WinMonetize.SDK.WinMonetize.SandboxMode = true;

    _window = new MainWindow();
    _window.Activate();
}

3. Add the namespace and banner to your XAML:

<Window
  xmlns:wm="using:WinMonetize.SDK.Controls">
  <wm:BannerAdView
    x:Name="Banner"
    AdUnitId="58310427"
    AdSize="Leaderboard"
    RefreshIntervalSeconds="45" />
</Window>
04
UNIVERSAL WINDOWS PLATFORM

UWP integration

  1. Install WinMonetize.SDK.Uwp.
  2. Initialize before navigating to the first page in App.xaml.cs:
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
    WinMonetize.SDK.WinMonetize.Initialize("wm_your_api_key");
    WinMonetize.SDK.WinMonetize.EnableLog = true;
    WinMonetize.SDK.WinMonetize.SandboxMode = true;

    // Create the root Frame and navigate to your first page here.
}

3. Add the namespace and banner to your page:

<Page
  xmlns:wm="using:WinMonetize.SDK.Controls">
  <wm:BannerAdView
    x:Name="Banner"
    AdUnitId="58310427"
    AdSize="Leaderboard"
    RefreshIntervalSeconds="45" />
</Page>
OPTIONAL

Observe events and reload on demand.

All four controls expose the same lifecycle events and manual load method. Add the event names in XAML or subscribe in C#.

<wm:BannerAdView
  x:Name="Banner"
  AdUnitId="58310427"
  AdLoaded="Banner_AdLoaded"
  AdFailed="Banner_AdFailed"
  AdClicked="Banner_AdClicked" />
using System.Diagnostics;
using WinMonetize.SDK.Models;

private void Banner_AdFailed(object? sender, AdFailedEventArgs e)
{
    Debug.WriteLine($"{e.Code}: {e.Message}");
}

// For a user-initiated refresh:
await Banner.LoadAdAsync();

The control loads when it enters the visual tree and refreshes automatically. The minimum refresh interval is 30 seconds; lower values are clamped to 30.

SHARED API

SDK reference

MemberPurpose
WinMonetize.Initialize(apiKey)Sets the API key. Call once before any banner loads.
WinMonetize.SandboxModeLoads generated test creative and prevents billing/reporting.
WinMonetize.EnableLogShows detailed diagnostics only while sandbox mode is also enabled.
AdUnitIdPublic numeric ID copied from your developer dashboard. New ad units receive random eight-digit IDs; existing IDs remain valid.
AdSizeMobileBanner (320×50), Leaderboard (728×90), or MediumRectangle (300×250).
RefreshIntervalSecondsAutomatic refresh floor; defaults to 45 seconds and cannot be less than 30. GIF/video rotations extend to finish a whole playback cycle.
LoadAdAsync()Requests a new ad immediately.
AdLoadedProvides RequestId and IsSandbox.
AdFailedProvides Code, Message, and the optional underlying exception.
AdClickedProvides the request ID and opened destination.
STEP 4

Test safely, then go live.

SANDBOX

During integration

  • Set SandboxMode = true.
  • Set EnableLog = true for visible error details.
  • Confirm the creative fits and all three lifecycle events behave as expected.
  • Sandbox impressions and clicks are never billed or reported.
PRODUCTION

Before release

  • Set SandboxMode = false.
  • Use the approved app identity and production API key.
  • Test the signed or Store-installed build—not an unsigned copy.
  • Keep the banner visible, unobstructed, and clearly separated from app controls.
No identity code is required. The SDK detects the running Store/MSIX package or signed EXE/MSI automatically. Sideloaded Store packages and unsigned desktop builds should use sandbox mode.