Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 2, 2025

Implements a Windows 11 Widget that displays current station and playback status with Play/Pause control, following the Windows App SDK widget provider pattern.

Implementation

Widget Provider (Widgets/TrdoWidgetProvider.cs)

  • COM server (CLSID D5A5B8F2-9C3A-4E1B-8F7D-6A4C3B2E1D9F) implementing IWidgetProvider
  • Manages widget lifecycle and delegates to RadioPlayerWidget instances

Widget UI (Widgets/RadioPlayerWidget.cs)

  • Subscribes to PlayerViewModel.PropertyChanged for real-time updates
  • Renders Adaptive Card showing station name, status, and Play/Pause button
  • Handles toggle verb to control playback

COM Registration (Widgets/Helper/)

  • WidgetProviderFactory: Creates widget provider instances via COM
  • RegistrationManager: Handles COM class registration lifecycle

App Integration (App.xaml.cs)

// Register widget provider when launched as COM server
if (cmdLineArgs.Contains("-RegisterProcessAsComServer"))
{
    WinRT.ComWrappersSupport.InitializeComWrappers();
    _widgetRegistrationManager = RegistrationManager<TrdoWidgetProvider>.RegisterProvider();
    return;
}

Manifest (Package.appxmanifest)

  • COM server extension: Launches app with -RegisterProcessAsComServer argument
  • Widget provider extension: Declares Trdo_RadioPlayer_Widget with small/medium/large sizes

Widget UI

Adaptive Card template binds to:

  • stationName: Current station or "No station selected"
  • statusText: "Now Playing" / "Paused"
  • buttonText: "▶ Play" / "⏸ Pause"

Updates automatically when user changes playback state or switches stations.

Files Added

  • 10 new files (5 code, 1 template, 2 assets, 2 docs)
  • 788 lines total

Note: Requires Windows 11 and MSIX packaging for testing. Implementation follows Microsoft's official widget sample.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add Windows Widget Support</issue_title>
<issue_description>https://learn.microsoft.com/en-us/windows/apps/develop/widgets/implement-widget-provider-cs</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 5 commits November 2, 2025 15:37
Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for Windows widget implementation Add Windows 11 Widget support for playback control Nov 2, 2025
Copilot AI requested a review from TheJoeFin November 2, 2025 15:45
Introduced COM server mode to support widgets, enabling shared
state synchronization for playback and stream URL between the
main app and widget processes. Enhanced SMTC integration for
system-wide media control. Updated widget assets, manifest,
and tray icon behavior. Improved watchdog service to respect
shared state. Added debug logging and refactored code for
maintainability.
Added fixes for widget synchronization, audio playback, and watchdog behavior. Introduced shared state via `ApplicationData.LocalSettings` to ensure consistent state across processes. Enhanced deployment with new scripts for debugging, testing, and automation. Updated documentation to include architecture details, fixes, and testing procedures. Improved reliability, user experience, and developer productivity.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Windows Widget Support

2 participants