DoenaSoft.AbstractionLayer.UI 2.0.7

dotnet add package DoenaSoft.AbstractionLayer.UI --version 2.0.7
                    
NuGet\Install-Package DoenaSoft.AbstractionLayer.UI -Version 2.0.7
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DoenaSoft.AbstractionLayer.UI" Version="2.0.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DoenaSoft.AbstractionLayer.UI" Version="2.0.7" />
                    
Directory.Packages.props
<PackageReference Include="DoenaSoft.AbstractionLayer.UI" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DoenaSoft.AbstractionLayer.UI --version 2.0.7
                    
#r "nuget: DoenaSoft.AbstractionLayer.UI, 2.0.7"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DoenaSoft.AbstractionLayer.UI@2.0.7
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DoenaSoft.AbstractionLayer.UI&version=2.0.7
                    
Install as a Cake Addin
#tool nuget:?package=DoenaSoft.AbstractionLayer.UI&version=2.0.7
                    
Install as a Cake Tool

DoenaSoft.AbstractionLayer.UI

Common UI abstractions used by the WinForms and WPF projects. This library provides small interface definitions that mirror important surface area of framework UI types so that application code can depend on interfaces instead of concrete types.

Package Id: DoenaSoft.AbstractionLayer.UI

Targets: netstandard2.0, net472, net10.0

Interfaces

The AbstractionLayer.UI project exposes the following interfaces in the Contracts folder. These are the actual interfaces implemented and used by the platform-specific adapters.

Main UI Services

  • IUIServices (namespace DoenaSoft.AbstractionLayer.UIServices) - The primary UI service interface. Provides methods to show message boxes and common file/folder dialogs:
    • ShowMessageBox - Display a message box with configurable text, caption, buttons, and icon
    • ShowOpenFileDialog - Show an open file dialog for single or multiple file selection
    • ShowSaveFileDialog - Show a save file dialog
    • ShowFolderBrowserDialog - Show a folder browser dialog

Clipboard Operations

  • IClipboardServices (namespace DoenaSoft.AbstractionLayer.UIServices) - Clipboard operations:
    • ContainsText - Check if clipboard contains text
    • GetText - Retrieve text from clipboard
    • SetText - Set text to clipboard
    • SetDataObject - Set data object to clipboard with retry logic and persistence options

Thread Synchronization

  • ISynchronizer (namespace DoenaSoft.AbstractionLayer.UI.Contracts) - Invoke work on the UI thread:

    • Invoke(Action) - Synchronously invoke an action on the UI thread
    • Invoke<T>(Func<T>) - Synchronously invoke a function on the UI thread and return its result
    • BeginInvoke(Action) - Asynchronously invoke an action on the UI thread
  • IDispatcherOperation (namespace DoenaSoft.AbstractionLayer.UI.Contracts) - Represents a posted dispatcher operation and exposes:

    • Result - Gets the result after completion
    • Status - Gets the current status (Pending, Aborted, Completed, Executing)
    • Task - Gets a Task that represents the operation

Supporting Data Types

Dialog Configuration

  • FileDialogOptions - Base configuration for file dialogs (filter, initial folder, title)
  • OpenFileDialogOptions - Configuration for open file dialogs (extends FileDialogOptions, adds multi-select support)
  • SaveFileDialogOptions - Configuration for save file dialogs (extends FileDialogOptions, adds overwrite prompt)
  • FolderBrowserDialogOptions - Configuration for folder browser dialogs (description, selected path)

Enumerations

  • MessageButton - Message box button configuration (OK, YesNo, YesNoCancel)
  • MessageIcon - Message box icon types (None, Information, Warning, Error, Question)
  • Result - Dialog result values (OK, Cancel, Yes, No, etc.)
  • DispatcherStatus - Dispatcher operation status (Pending, Aborted, Completed, Executing)

Usage

Program against these interfaces (for example IUIServices and ISynchronizer) and use the platform-specific adapter implementations in the WinForms or WPF projects. In unit tests provide fakes or mocks for these interfaces to avoid showing UI and to verify interactions.

Example

public class MyViewModel
{
    private readonly DoenaSoft.AbstractionLayer.UIServices.IUIServices _uiServices;

    public MyViewModel(DoenaSoft.AbstractionLayer.UIServices.IUIServices uiServices)
    {
        _uiServices = uiServices;
    }

    public void SaveFile(string content)
    {
        var options = new SaveFileDialogOptions
        {
            Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*",
            Title = "Save File"
        };

        if (_uiServices.ShowSaveFileDialog(options, out string fileName))
        {
            // Save content to fileName
        }
    }
}

Reference this project from UI-specific packages (WinForms/WPF) or your application and program against the interfaces. Concrete adapter/extension types in the platform-specific projects map the real framework objects to these interfaces at runtime.

License: MIT

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 is compatible.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.7.2

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.
  • net10.0

    • No dependencies.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on DoenaSoft.AbstractionLayer.UI:

Package Downloads
DoenaSoft.AbstractionLayer.WPF

WPF implementations of UI abstraction interfaces from DoenaSoft.AbstractionLayer.UI. Provides WindowUIServices (message boxes, dialogs), WindowClipboardServices (comprehensive clipboard operations including text, audio, images, file drop lists), and WindowSynchronizer for dispatcher invocation.

DoenaSoft.AbstractionLayer.WinForms

Windows Forms implementations of UI abstraction interfaces from DoenaSoft.AbstractionLayer.UI. Provides FormUIServices (message boxes, dialogs), FormClipboardServices (comprehensive clipboard operations including text, audio, images, file drop lists), and FormSynchronizer for thread marshaling.

DoenaSoft.AdaptBookFileNames

A .NET library for organizing and standardizing audiobook and e-book file names with consistent naming conventions. Supports MP3, M4A, MP4 audiobooks and EPUB, MOBI e-books with sequential numbering and chapter management.

DoenaSoft.CalculateAudioBookRunningTimes

A library for extracting and calculating audiobook metadata including running times, chapters, authors, and narrators. Supports MP3 and MP4 audiobook formats with customizable interaction handling.

DoenaSoft.PillRefresh

A .NET library for calculating medication supply duration and generating calendar reminders with automatic weekend and holiday avoidance. Supports multiple target frameworks and generates iCalendar (.ics) files compatible with Outlook, Google Calendar, and other applications.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.7 44 4/12/2026
2.0.6 121 3/29/2026
1.0.6 309 5/7/2024
1.0.5 329 12/5/2023
1.0.4 202 12/3/2023
1.0.3 247 12/3/2023
1.0.2 313 9/12/2023
1.0.1 301 8/28/2023
1.0.0 278 8/28/2023