-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test harness to support XAML hot reload (#478)
* Add test harness to support XAML hot reload. * Make the apps run on WinUI.
- Loading branch information
1 parent
78bbe66
commit 1b8cd57
Showing
40 changed files
with
1,032 additions
and
493 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 10 additions & 3 deletions
13
8.0/PlatformIntegration/NativeEmbeddingDemo/NativeEmbeddingDemo/App.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
<?xml version = "1.0" encoding = "UTF-8" ?> | ||
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:local="clr-namespace:NativeEmbeddingDemo" | ||
x:Class="NativeEmbeddingDemo.App"> | ||
<Application.Resources> | ||
<ResourceDictionary> | ||
<ResourceDictionary.MergedDictionaries> | ||
<ResourceDictionary Source="Resources/Styles/Colors.xaml" /> | ||
<ResourceDictionary Source="Resources/Styles/Styles.xaml" /> | ||
<ResourceDictionary Source="Resources/Styles/Colors.xaml;assembly=NativeEmbeddingDemo" /> | ||
<ResourceDictionary Source="Resources/Styles/Styles.xaml;assembly=NativeEmbeddingDemo" /> | ||
</ResourceDictionary.MergedDictionaries> | ||
|
||
<!-- Example styles to demonstrate how to use main app vs test app styles --> | ||
<Style x:Key="MainAppOnlyStyle" TargetType="VisualElement" ApplyToDerivedTypes="True"> | ||
</Style> | ||
<Style x:Key="TestAppOnlyStyle" TargetType="VisualElement" ApplyToDerivedTypes="True"> | ||
<Setter Property="IsVisible" Value="False" /> | ||
</Style> | ||
|
||
</ResourceDictionary> | ||
</Application.Resources> | ||
</Application> |
45 changes: 29 additions & 16 deletions
45
8.0/PlatformIntegration/NativeEmbeddingDemo/NativeEmbeddingDemo/MauiProgram.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,39 @@ | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace NativeEmbeddingDemo | ||
namespace NativeEmbeddingDemo; | ||
|
||
public static class MauiProgram | ||
{ | ||
public static class MauiProgram | ||
/// <summary> | ||
/// Create a new MauiApp using the default application. | ||
/// </summary> | ||
/// <param name="additional"></param> | ||
/// <returns></returns> | ||
public static MauiApp CreateMauiApp(Action<MauiAppBuilder>? additional = null) => | ||
CreateMauiApp<App>(additional); | ||
|
||
/// <summary> | ||
/// Create a new MauiAPp using the specified application. | ||
/// </summary> | ||
/// <typeparam name="TApp"></typeparam> | ||
/// <param name="additional"></param> | ||
/// <returns></returns> | ||
public static MauiApp CreateMauiApp<TApp>(Action<MauiAppBuilder>? additional = null) where TApp : App | ||
{ | ||
public static MauiApp CreateMauiApp(Action<MauiAppBuilder>? additional = null) | ||
{ | ||
var builder = MauiApp.CreateBuilder(); | ||
builder | ||
.UseMauiApp<App>() | ||
.ConfigureFonts(fonts => | ||
{ | ||
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); | ||
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); | ||
}); | ||
var builder = MauiApp.CreateBuilder(); | ||
builder | ||
.UseMauiApp<TApp>() | ||
.ConfigureFonts(fonts => | ||
{ | ||
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); | ||
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); | ||
}); | ||
|
||
#if DEBUG | ||
builder.Logging.AddDebug(); | ||
builder.Logging.AddDebug(); | ||
#endif | ||
additional?.Invoke(builder); | ||
additional?.Invoke(builder); | ||
|
||
return builder.Build(); | ||
} | ||
return builder.Build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 43 additions & 45 deletions
88
8.0/PlatformIntegration/NativeEmbeddingDemo/NativeEmbeddingDemo/Resources/Styles/Colors.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,43 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<?xaml-comp compile="true" ?> | ||
<ResourceDictionary | ||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"> | ||
|
||
<!-- Note: For Android please see also Platforms\Android\Resources\values\colors.xml --> | ||
|
||
<Color x:Key="Primary">#512BD4</Color> | ||
<Color x:Key="PrimaryDark">#ac99ea</Color> | ||
<Color x:Key="PrimaryDarkText">#242424</Color> | ||
<Color x:Key="Secondary">#DFD8F7</Color> | ||
<Color x:Key="SecondaryDarkText">#9880e5</Color> | ||
<Color x:Key="Tertiary">#2B0B98</Color> | ||
|
||
<Color x:Key="White">White</Color> | ||
<Color x:Key="Black">Black</Color> | ||
<Color x:Key="Magenta">#D600AA</Color> | ||
<Color x:Key="MidnightBlue">#190649</Color> | ||
<Color x:Key="OffBlack">#1f1f1f</Color> | ||
|
||
<Color x:Key="Gray100">#E1E1E1</Color> | ||
<Color x:Key="Gray200">#C8C8C8</Color> | ||
<Color x:Key="Gray300">#ACACAC</Color> | ||
<Color x:Key="Gray400">#919191</Color> | ||
<Color x:Key="Gray500">#6E6E6E</Color> | ||
<Color x:Key="Gray600">#404040</Color> | ||
<Color x:Key="Gray900">#212121</Color> | ||
<Color x:Key="Gray950">#141414</Color> | ||
|
||
<SolidColorBrush x:Key="PrimaryBrush" Color="{StaticResource Primary}"/> | ||
<SolidColorBrush x:Key="SecondaryBrush" Color="{StaticResource Secondary}"/> | ||
<SolidColorBrush x:Key="TertiaryBrush" Color="{StaticResource Tertiary}"/> | ||
<SolidColorBrush x:Key="WhiteBrush" Color="{StaticResource White}"/> | ||
<SolidColorBrush x:Key="BlackBrush" Color="{StaticResource Black}"/> | ||
|
||
<SolidColorBrush x:Key="Gray100Brush" Color="{StaticResource Gray100}"/> | ||
<SolidColorBrush x:Key="Gray200Brush" Color="{StaticResource Gray200}"/> | ||
<SolidColorBrush x:Key="Gray300Brush" Color="{StaticResource Gray300}"/> | ||
<SolidColorBrush x:Key="Gray400Brush" Color="{StaticResource Gray400}"/> | ||
<SolidColorBrush x:Key="Gray500Brush" Color="{StaticResource Gray500}"/> | ||
<SolidColorBrush x:Key="Gray600Brush" Color="{StaticResource Gray600}"/> | ||
<SolidColorBrush x:Key="Gray900Brush" Color="{StaticResource Gray900}"/> | ||
<SolidColorBrush x:Key="Gray950Brush" Color="{StaticResource Gray950}"/> | ||
</ResourceDictionary> | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ResourceDictionary xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
x:Class="NativeEmbeddingDemo.Resources.Styles.Colors"> | ||
<!-- Note: For Android please see also Platforms\Android\Resources\values\colors.xml --> | ||
|
||
<Color x:Key="Primary">#512BD4</Color> | ||
<Color x:Key="PrimaryDark">#ac99ea</Color> | ||
<Color x:Key="PrimaryDarkText">#242424</Color> | ||
<Color x:Key="Secondary">#DFD8F7</Color> | ||
<Color x:Key="SecondaryDarkText">#9880e5</Color> | ||
<Color x:Key="Tertiary">#2B0B98</Color> | ||
|
||
<Color x:Key="White">White</Color> | ||
<Color x:Key="Black">Black</Color> | ||
<Color x:Key="Magenta">#D600AA</Color> | ||
<Color x:Key="MidnightBlue">#190649</Color> | ||
<Color x:Key="OffBlack">#1f1f1f</Color> | ||
|
||
<Color x:Key="Gray100">#E1E1E1</Color> | ||
<Color x:Key="Gray200">#C8C8C8</Color> | ||
<Color x:Key="Gray300">#ACACAC</Color> | ||
<Color x:Key="Gray400">#919191</Color> | ||
<Color x:Key="Gray500">#6E6E6E</Color> | ||
<Color x:Key="Gray600">#404040</Color> | ||
<Color x:Key="Gray900">#212121</Color> | ||
<Color x:Key="Gray950">#141414</Color> | ||
|
||
<SolidColorBrush x:Key="PrimaryBrush" Color="{StaticResource Primary}"/> | ||
<SolidColorBrush x:Key="SecondaryBrush" Color="{StaticResource Secondary}"/> | ||
<SolidColorBrush x:Key="TertiaryBrush" Color="{StaticResource Tertiary}"/> | ||
<SolidColorBrush x:Key="WhiteBrush" Color="{StaticResource White}"/> | ||
<SolidColorBrush x:Key="BlackBrush" Color="{StaticResource Black}"/> | ||
|
||
<SolidColorBrush x:Key="Gray100Brush" Color="{StaticResource Gray100}"/> | ||
<SolidColorBrush x:Key="Gray200Brush" Color="{StaticResource Gray200}"/> | ||
<SolidColorBrush x:Key="Gray300Brush" Color="{StaticResource Gray300}"/> | ||
<SolidColorBrush x:Key="Gray400Brush" Color="{StaticResource Gray400}"/> | ||
<SolidColorBrush x:Key="Gray500Brush" Color="{StaticResource Gray500}"/> | ||
<SolidColorBrush x:Key="Gray600Brush" Color="{StaticResource Gray600}"/> | ||
<SolidColorBrush x:Key="Gray900Brush" Color="{StaticResource Gray900}"/> | ||
<SolidColorBrush x:Key="Gray950Brush" Color="{StaticResource Gray950}"/> | ||
</ResourceDictionary> |
9 changes: 9 additions & 0 deletions
9
...atformIntegration/NativeEmbeddingDemo/NativeEmbeddingDemo/Resources/Styles/Colors.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace NativeEmbeddingDemo.Resources.Styles; | ||
|
||
public partial class Colors : ResourceDictionary | ||
{ | ||
public Colors() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} |
Oops, something went wrong.