Skip to main content

Core Window Guide

This guide covers the InfiniFrameWindowBuilder the foundation for creating all InfiniFrame windows. It walks through the builder pattern, single-file packaging, and provides a complete reference to every window feature.

For a conceptual overview of how the feature system works, see Window Features Architecture.

Contents​

Building a Window​

All windows are created through InfiniFrameWindowBuilder using a fluent API.

using InfiniFrame;

var window = InfiniFrameWindowBuilder.Create()
.SetTitle("My App")
.SetSize(1280, 720)
.Center()
.SetStartPageUrl("https://myapp.local")
.Build();

window.WaitForClose();

Build() creates and displays the native window immediately on the calling thread. The returned IInfiniFrameWindow gives you full control over the window at runtime.

Single-File Native Packaging​

When your app is published as a single-file executable with embedded InfiniFrame native binaries, call InfiniFrameSingleFileBootstrap.Initialize() before creating any windows.

using InfiniFrame;

public static class Program {
[STAThread]
public static void Main(string[] args) {
InfiniFrameSingleFileBootstrap.Initialize();

var window = InfiniFrameWindowBuilder.Create()
.SetTitle("My App")
.SetSize(1280, 720)
.Center()
.SetStartPageUrl("app://index.html")
.Build();

window.WaitForClose();
}
}

Initialize() is idempotent and safe to call once at startup. Use it for packaged deployments created by InfiniLore.InfiniFrame.SingleFile (or any equivalent flow that embeds native files as resources), not for standard development runs where native binaries are already present beside your app.

Builder Quick Reference​

Every builder method maps to a feature. The table below shows the most common methods and their corresponding feature guides.

Window appearance​

MethodFeatureGuide
SetTitle(string)DecorationsDecorations
SetIconFile(string)DecorationsDecorations
SetBackgroundColor(string?)DecorationsDecorations
SetChromeless(bool)DecorationsDecorations
SetTransparent(bool)DecorationsDecorations

Size and position​

MethodFeatureGuide
SetSize(int, int)SizeSize
SetMinSize(int, int)SizeSize
SetMaxSize(int, int)SizeSize
SetLocation(int, int)PositionPosition
Center()PositionPosition

Window state​

MethodFeatureGuide
SetMaximized(bool)StateState
SetMinimized(bool)StateState
SetFullScreen(bool)StateState
SetTopMost(bool)StateState
SetResizable(bool)SizeSize

Content​

MethodFeatureGuide
SetStartPageUrl(string?)Page NavigationPage Navigation
SetStartPageContent(string?)Page NavigationPage Navigation
SetUrl(Uri?)Page NavigationPage Navigation
RegisterCustomSchemeHandler(...)Page NavigationPage Navigation

Browser settings​

MethodFeatureGuide
SetDevToolsEnabled(bool)DebuggingDebugging
SetRemoteDebuggingPort(int?)DebuggingDebugging
SetContextMenuEnabled(bool)BrowserBrowser
SetUserAgent(string?)BrowserBrowser
EnableStatusBar(bool)BrowserBrowser
EnableIgnoreCertificateErrors(bool)BrowserBrowser
EnableWebSecurity(bool)BrowserBrowser
SetBrowserControlInitParameters(string)BrowserBrowser

Other features​

MethodFeatureGuide
SetMenuBar(InfiniFrameMenuBar)MenuNative Menu
EnableNotifications(bool)NotificationsNotifications
SetInstanceArbitrationMode(...)Instance ArbitrationInstance Arbitration
AddTrustedOrigin(string)BrowserBrowser

Events​

PropertyGuide
builder.Events.WindowCreatedLifecycle
builder.Events.WindowClosingRequestedLifecycle
builder.Events.WindowSizeChangedLifecycle
builder.Events.WebMessageReceivedJavaScript Interop
builder.MessageHandlersJavaScript Interop

Runtime access​

After Build(), all features are accessible through window.Features.<Name> or as extension methods on IInfiniFrameWindow:

// Extension methods (fluent chaining)
window.SetSize(800, 600);
window.SetTitle("New Title");
window.Close();

// Direct feature access
window.Features.Size.SetSize(800, 600);
window.Features.Decorations.SetTitle("New Title");
window.Features.Lifecycle.Close();

Feature Guides​

Each window feature has a dedicated guide covering both builder configuration and runtime control:

Core features​

FeatureDescriptionGuide
SizeWindow dimensions, min/max constraints, resizabilityBuilder + Runtime
PositionWindow placement, centering, monitor-aware positioningBuilder + Runtime
StateMaximized, minimized, fullscreen, topmost, zoomBuilder + Runtime
DecorationsTitle, icon, chromeless mode, transparency, background colorBuilder + Runtime
BrowserContext menu, media, web security, clipboard, user agent, status barBuilder + Runtime
DebuggingDevTools, remote debugging, web inspector, diagnosticsBuilder + Runtime
Page NavigationLoad URLs/HTML, navigation interception, custom URL schemesBuilder + Runtime
LifecycleWindow close, ready wait, teardown, events, cross-thread invocationRuntime

Dialogs and system integration​

FeatureDescriptionGuide
File DialogsOpen/save file and folder dialogsRuntime
NotificationsNative desktop notifications, rich notifications, async callbacksBuilder + Runtime
Native MenuMenu bar configuration, runtime menu manipulationBuilder + Runtime
TaskbarProgress indicators and flash notificationsBuilder + Runtime
MonitorsDisplay enumeration, work area, DPIRuntime

Input and messaging​

FeatureDescriptionGuide
Drag and DropFile drop handling, extension filteringRuntime
JavaScript ExecutionExecute arbitrary JS in the browser controlRuntime
JavaScript InteropTwo-way C#/JS messaging, InfiniFrame.JsRuntime
InvokeCross-thread dispatch to the window's native threadRuntime

Configuration​

FeatureDescriptionGuide
Instance ArbitrationSingle-instance enforcement, elevation detectionBuilder
Custom Window ChromeBlazor components and JS API for chromeless windowsBuilder + Runtime

Taskbar Progress and Flash​

InfiniFrame provides cross-platform taskbar integration for progress indicators and flash notifications. Access the taskbar feature through window.Features.Taskbar.

Platform Support​

FeatureWindowsmacOSLinux
Progress statesYesYesDesktop-dependent
Flash notificationsYesYesDesktop-dependent
Capability detectionYesYesYes

Platform details:

  • Windows: Full support via ITaskbarList3 COM and FlashWindowEx
  • macOS: Progress via dock tile badge label, flash via NSApp.requestUserAttention
  • Linux: D-Bus StatusNotifierItem + UnityLauncherEntry (GNOME may report IsSupported=false)

Progress Indicator​

// Show download progress (current, total)
window.Features.Taskbar.SetProgress(TaskbarProgressState.Normal, 75, 100);

// Show indeterminate progress
window.Features.Taskbar.SetProgress(TaskbarProgressState.Indeterminate, 0, 0);

// Show error state
window.Features.Taskbar.SetProgress(TaskbarProgressState.Error, 0, 0);

// Clear progress
window.Features.Taskbar.ClearProgress();

Flash Notifications​

// Flash all windows continuously (count 0 = until user interacts)
window.Features.Taskbar.SetFlash(TaskbarFlashMode.All, 0);

// Flash timer-based
window.Features.Taskbar.SetFlash(TaskbarFlashMode.Timer, 3);

// Stop flashing
window.Features.Taskbar.StopFlash();

Capability Detection​

InfiniFrameTaskbarCapabilities caps = window.Features.Taskbar.Capabilities;

if (caps.SupportsProgress) {
window.Features.Taskbar.SetProgress(TaskbarProgressState.Normal, 50, 100);
} else {
// Fallback to in-app progress indicator
Console.WriteLine("Taskbar progress not supported on this platform");
}

Examples​

  • InfiniFrameExample.WebApp.React (examples/InfiniFrameExample.WebApp.React) - custom URL scheme handler and web messaging with DI-resolved services
  • InfiniFrameExample.BlazorWebView (examples/InfiniFrameExample.BlazorWebView) - window builder configuration with size, position, and icon
  • InfiniFrameExample.SingleFileExe (examples/InfiniFrameExample.SingleFileExe) - embedded static assets and single-file native bootstrap