From ade13fa70b8b2045d9112716ba433142ad78f9d5 Mon Sep 17 00:00:00 2001 From: Emmanuel Hansen Date: Thu, 16 May 2024 15:49:08 +0000 Subject: [PATCH] wip --- .../Remote/RemoteDesignerEntryPoint.cs | 10 ++++++++++ src/Avalonia.Remote.Protocol/DesignMessages.cs | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/Avalonia.DesignerSupport/Remote/RemoteDesignerEntryPoint.cs b/src/Avalonia.DesignerSupport/Remote/RemoteDesignerEntryPoint.cs index 0dfab530ea..67aea9ed54 100644 --- a/src/Avalonia.DesignerSupport/Remote/RemoteDesignerEntryPoint.cs +++ b/src/Avalonia.DesignerSupport/Remote/RemoteDesignerEntryPoint.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Net; using System.Reflection; using System.Threading; @@ -8,6 +9,7 @@ using Avalonia.DesignerSupport.Remote.HtmlTransport; using Avalonia.Remote.Protocol; using Avalonia.Remote.Protocol.Designer; using Avalonia.Remote.Protocol.Viewport; +using Avalonia.Styling; using Avalonia.Threading; namespace Avalonia.DesignerSupport.Remote @@ -219,6 +221,14 @@ namespace Avalonia.DesignerSupport.Remote s_viewportAllocatedMessage = viewport; RebuildPreFlight(); } + if(arg is ThemeVariantListRequestMessage) + { + var variants = Application.Current?.Styles.Select(x => (x as Styles)?.Resources.ThemeDictionaries.Keys.ToString())?.ToArray(); + s_transport.Send(new ThemeVariantListResponseMessage() + { + ThemeVariants = variants + }); + } if (arg is UpdateXamlMessage xaml) { if (s_currentWindow is not null) diff --git a/src/Avalonia.Remote.Protocol/DesignMessages.cs b/src/Avalonia.Remote.Protocol/DesignMessages.cs index 5c769ad48c..ad2a4d65c6 100644 --- a/src/Avalonia.Remote.Protocol/DesignMessages.cs +++ b/src/Avalonia.Remote.Protocol/DesignMessages.cs @@ -26,6 +26,17 @@ namespace Avalonia.Remote.Protocol.Designer { public string SessionId { get; set; } } + + [AvaloniaRemoteMessageGuid("F196DC31-43DF-4BEB-A56D-129E64454377")] + public class ThemeVariantListRequestMessage + { + } + + [AvaloniaRemoteMessageGuid("1AA06D40-F65A-4916-85F1-4CF5681781E8")] + public class ThemeVariantListResponseMessage + { + public string[] ThemeVariants { get; set; } + } public class ExceptionDetails {