Browse Source

wip

designer_protocol_theme_variant
Emmanuel Hansen 2 years ago
parent
commit
ade13fa70b
  1. 10
      src/Avalonia.DesignerSupport/Remote/RemoteDesignerEntryPoint.cs
  2. 11
      src/Avalonia.Remote.Protocol/DesignMessages.cs

10
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)

11
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
{

Loading…
Cancel
Save