Dreamine.Communication.Wpf 1.0.0

dotnet add package Dreamine.Communication.Wpf --version 1.0.0
                    
NuGet\Install-Package Dreamine.Communication.Wpf -Version 1.0.0
                    
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="Dreamine.Communication.Wpf" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Dreamine.Communication.Wpf" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Dreamine.Communication.Wpf" />
                    
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 Dreamine.Communication.Wpf --version 1.0.0
                    
#r "nuget: Dreamine.Communication.Wpf, 1.0.0"
                    
#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 Dreamine.Communication.Wpf@1.0.0
                    
#: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=Dreamine.Communication.Wpf&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Dreamine.Communication.Wpf&version=1.0.0
                    
Install as a Cake Tool

Dreamine.Communication.Wpf

Dreamine.Communication.Wpf is part of the Dreamine Communication package family.

This package provides WPF-specific monitoring and diagnostic components for Dreamine Communication.
It is separated from the default Dreamine.Communication.FullKit package to keep the core communication packages UI-independent.

➡️ 한국어 문서 보기

Description

WPF monitoring and diagnostic components for Dreamine Communication.

Features

  • WPF communication monitor UserControl
  • Communication channel state display
  • Message send/receive log display
  • Connection state visual indicator
  • Basic diagnostic view model foundation

Main Components

Views

  • CommunicationMonitorView

ViewModels

  • CommunicationMonitorViewModel

Models

  • CommunicationChannelViewItem
  • CommunicationMessageLogItem

Converters

  • ConnectionStateBrushConverter

Commands

  • DelegateCommand

Usage

The monitor is composed of three parts:

Part Role
CommunicationMonitorViewModel Holds channels and logs. Application code calls AddChannel, UpdateChannelState, AddSendLog, and AddReceiveLog.
CommunicationMonitorView WPF UserControl that renders channel state and send/receive logs. Bind a CommunicationMonitorViewModel to its DataContext.
ConnectionStateBrushConverter Maps ConnectionState to a brush for the channel state indicator. Used internally by the view.

Placing the monitor in a view

<UserControl x:Class="MyApp.Pages.CommunicationPage"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:commViews="clr-namespace:Dreamine.Communication.Wpf.Views;assembly=Dreamine.Communication.Wpf">
    <Grid>
        <commViews:CommunicationMonitorView
            DataContext="{Binding Monitor}" />
    </Grid>
</UserControl>

The host view model exposes a CommunicationMonitorViewModel instance as Monitor.

Driving the monitor from transports

using Dreamine.Communication.Abstractions.Enums;
using Dreamine.Communication.Abstractions.Models;
using Dreamine.Communication.Sockets.Clients;
using Dreamine.Communication.Sockets.Options;
using Dreamine.Communication.Wpf.ViewModels;

public sealed class CommunicationContext
{
    private readonly TcpClientTransport _client;

    public CommunicationMonitorViewModel Monitor { get; } = new();

    public CommunicationContext()
    {
        const string channelName = "TCP-Client";

        Monitor.AddChannel(
            channelName,
            TransportKind.Tcp,
            "TCP client to 127.0.0.1:15001.");

        _client = new TcpClientTransport(
            new TcpClientTransportOptions
            {
                Host = "127.0.0.1",
                Port = 15001
            });

        _client.MessageReceived += (_, message) =>
        {
            Monitor.AddReceiveLog(channelName, TransportKind.Tcp, message);
        };
    }

    public async Task ConnectAsync()
    {
        const string channelName = "TCP-Client";

        await _client.ConnectAsync();

        Monitor.UpdateChannelState(channelName, ConnectionState.Connected);
    }

    public async Task SendAsync(MessageEnvelope message)
    {
        const string channelName = "TCP-Client";

        Monitor.AddSendLog(channelName, TransportKind.Tcp, message);

        await _client.SendAsync(message);
    }
}

Threading note

CommunicationMonitorViewModel uses ObservableCollection<T> internally. Transport callbacks usually run on a background thread, so calls into AddReceiveLog, AddSendLog, and UpdateChannelState must be marshaled to the UI thread (for example through Application.Current.Dispatcher.Invoke) when invoked from a transport's MessageReceived event.

Design Principles

  • Keep WPF UI components separated from core communication logic.
  • Do not reference concrete transport packages such as Sockets, Serial, or RabbitMQ.
  • Depend only on Dreamine.Communication.Abstractions and Dreamine.Communication.Core.
  • Preserve one-way dependency flow.
  • Keep this package focused on monitoring and diagnostics UI.

Package Role

Dreamine.Communication.Abstractions
    ↑
Dreamine.Communication.Core
    ↑
Dreamine.Communication.Wpf

Dependencies

  • Dreamine.Communication.Abstractions
  • Dreamine.Communication.Core

Target Framework

net8.0-windows

Note

This package targets net8.0-windows and uses WPF.

It is intentionally excluded from the default Dreamine.Communication.FullKit package.

  • Dreamine.Communication.Abstractions
  • Dreamine.Communication.Core
  • Dreamine.Communication.Sockets
  • Dreamine.Communication.Serial
  • Dreamine.Communication.RabbitMQ
  • Dreamine.Communication.FullKit

License

This project is licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net8.0-windows7.0 is compatible.  net9.0-windows was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 103 5/14/2026