From 98f4ae95431b688703b82a10fa8133c392e42e00 Mon Sep 17 00:00:00 2001 From: Tom Laird-McConnell Date: Mon, 2 Dec 2024 12:08:40 -0800 Subject: [PATCH 01/21] snapshot --- src/Consolonia.Blazor/Class1.cs | 7 +++ .../Consolonia.Blazor.csproj | 11 ++++ src/Consolonia.sln | 14 ++++- src/Example.Blazor/App.axaml | 13 +++++ src/Example.Blazor/App.axaml.cs | 35 ++++++++++++ src/Example.Blazor/Components/MainPage.razor | 54 +++++++++++++++++++ src/Example.Blazor/Components/_imports.razor | 0 src/Example.Blazor/Example.Blazor.csproj | 20 +++++++ src/Example.Blazor/Program.cs | 28 ++++++++++ 9 files changed, 181 insertions(+), 1 deletion(-) create mode 100644 src/Consolonia.Blazor/Class1.cs create mode 100644 src/Consolonia.Blazor/Consolonia.Blazor.csproj create mode 100644 src/Example.Blazor/App.axaml create mode 100644 src/Example.Blazor/App.axaml.cs create mode 100644 src/Example.Blazor/Components/MainPage.razor create mode 100644 src/Example.Blazor/Components/_imports.razor create mode 100644 src/Example.Blazor/Example.Blazor.csproj create mode 100644 src/Example.Blazor/Program.cs diff --git a/src/Consolonia.Blazor/Class1.cs b/src/Consolonia.Blazor/Class1.cs new file mode 100644 index 00000000..986f2d46 --- /dev/null +++ b/src/Consolonia.Blazor/Class1.cs @@ -0,0 +1,7 @@ +namespace Consolonia.Blazor +{ + public class Class1 + { + + } +} diff --git a/src/Consolonia.Blazor/Consolonia.Blazor.csproj b/src/Consolonia.Blazor/Consolonia.Blazor.csproj new file mode 100644 index 00000000..b7218b15 --- /dev/null +++ b/src/Consolonia.Blazor/Consolonia.Blazor.csproj @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/Consolonia.sln b/src/Consolonia.sln index 305eeea4..95b57b95 100644 --- a/src/Consolonia.sln +++ b/src/Consolonia.sln @@ -59,7 +59,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{910B2845 EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.PreviewHost", "Tools\Avalonia.PreviewHost\Avalonia.PreviewHost.csproj", "{6D1DDDE9-34BE-47B8-88F2-F878AC2CC910}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Consolonia.Designer", "Consolonia.Designer\Consolonia.Designer.csproj", "{7F0EA682-C28C-4C1C-9D40-EC0561179505}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Consolonia.Designer", "Consolonia.Designer\Consolonia.Designer.csproj", "{7F0EA682-C28C-4C1C-9D40-EC0561179505}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Consolonia.Blazor", "Consolonia.Blazor\Consolonia.Blazor.csproj", "{66726106-2ED4-4516-A912-1C0FE0ACDCBD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example.Blazor", "Example.Blazor\Example.Blazor.csproj", "{000ED32A-027D-4005-BDE0-4DBF1ABC0829}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -115,6 +119,14 @@ Global {7F0EA682-C28C-4C1C-9D40-EC0561179505}.Debug|Any CPU.Build.0 = Debug|Any CPU {7F0EA682-C28C-4C1C-9D40-EC0561179505}.Release|Any CPU.ActiveCfg = Release|Any CPU {7F0EA682-C28C-4C1C-9D40-EC0561179505}.Release|Any CPU.Build.0 = Release|Any CPU + {66726106-2ED4-4516-A912-1C0FE0ACDCBD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {66726106-2ED4-4516-A912-1C0FE0ACDCBD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {66726106-2ED4-4516-A912-1C0FE0ACDCBD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {66726106-2ED4-4516-A912-1C0FE0ACDCBD}.Release|Any CPU.Build.0 = Release|Any CPU + {000ED32A-027D-4005-BDE0-4DBF1ABC0829}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {000ED32A-027D-4005-BDE0-4DBF1ABC0829}.Debug|Any CPU.Build.0 = Debug|Any CPU + {000ED32A-027D-4005-BDE0-4DBF1ABC0829}.Release|Any CPU.ActiveCfg = Release|Any CPU + {000ED32A-027D-4005-BDE0-4DBF1ABC0829}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Example.Blazor/App.axaml b/src/Example.Blazor/App.axaml new file mode 100644 index 00000000..abf7258b --- /dev/null +++ b/src/Example.Blazor/App.axaml @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/src/Example.Blazor/App.axaml.cs b/src/Example.Blazor/App.axaml.cs new file mode 100644 index 00000000..993d9b2d --- /dev/null +++ b/src/Example.Blazor/App.axaml.cs @@ -0,0 +1,35 @@ +using Avalonia; +using Avalonia.Markup.Xaml; +using BlazorBindingsAvalonia; + +namespace Example.Blazor +{ + + + public class App : BlazorBindingsApplication + { + public override void Initialize() + { + AvaloniaXamlLoader.Load(this); + } + + public override void OnFrameworkInitializationCompleted() + { + base.OnFrameworkInitializationCompleted(); + + this.AttachDevTools(); + } + } + + //public class BlazorBindingsApplicationMainPage : BlazorBindingsApplication + //{ + // //public App() + // //{ + // // //Styles.Add(new FluentTheme()); + // // //Styles.Add(new StyleInclude(XamlIlRuntimeHelpers.CreateRootServiceProviderV3(null))//(Uri?)null) + // // //{ + // // // Source = new Uri("avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml") + // // //}); + // //} + //} +} \ No newline at end of file diff --git a/src/Example.Blazor/Components/MainPage.razor b/src/Example.Blazor/Components/MainPage.razor new file mode 100644 index 00000000..5447f0c7 --- /dev/null +++ b/src/Example.Blazor/Components/MainPage.razor @@ -0,0 +1,54 @@ +@page "/" + +@namespace Example.Blazor + +@using System.Collections.ObjectModel +@using Microsoft.AspNetCore.Components +@using Microsoft.AspNetCore.Components.CompilerServices +@using Microsoft.AspNetCore.Components.Infrastructure +@using Microsoft.AspNetCore.Components.Rendering +@using Microsoft.AspNetCore.Components.RenderTree +@using Microsoft.AspNetCore.Components.Routing +@using Microsoft.AspNetCore.Components.Sections +@using A = global::Avalonia; +@using AL = global::Avalonia.Layout; +@using AC = global::Avalonia.Controls; +@using AM = global::Avalonia.Media +@using BlazorBindings.Core; +@using BlazorBindingsAvalonia.Elements +@using BlazorBindingsAvalonia.Elements.Shapes +@using BlazorBindingsAvalonia.Extensions + + + + @if (showCounter) + { + Counter: @ButtonText + + } + + + + +@code { + int count = 0; + bool showCounter = true; + + string ButtonText => count switch + { + 0 => "Click me", + 1 => $"Clicked 1 time", + _ => $"Clicked {count} times" + }; + + + void ToggleButton() + { + showCounter = !showCounter; + } + + void OnCounterClicked() + { + count++; + } +} \ No newline at end of file diff --git a/src/Example.Blazor/Components/_imports.razor b/src/Example.Blazor/Components/_imports.razor new file mode 100644 index 00000000..e69de29b diff --git a/src/Example.Blazor/Example.Blazor.csproj b/src/Example.Blazor/Example.Blazor.csproj new file mode 100644 index 00000000..b58574b8 --- /dev/null +++ b/src/Example.Blazor/Example.Blazor.csproj @@ -0,0 +1,20 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + + + + + + + diff --git a/src/Example.Blazor/Program.cs b/src/Example.Blazor/Program.cs new file mode 100644 index 00000000..f95cfbea --- /dev/null +++ b/src/Example.Blazor/Program.cs @@ -0,0 +1,28 @@ +using Avalonia; +using BlazorBindingsAvalonia; +using Consolonia.Core; +using Consolonia.Core.Infrastructure; +using Consolonia.PlatformSupport; + +namespace Example.Blazor +{ + internal class Program + { + // ReSharper disable once ParameterOnlyUsedForPreconditionCheck.Local Exactly why we are keeping it here + [STAThread] + private static void Main(string[] args) + { + BuildAvaloniaApp() + .StartWithConsoleLifetime(args); + } + + public static AppBuilder BuildAvaloniaApp() + => AppBuilder.Configure() + .UseConsolonia() + .UseAutoDetectedConsole() + .LogToException() + .UseAvaloniaBlazorBindings(services => + { + }); + } +} From 95bafe234b3a13b3c0aafd50288edf3b79c20f7d Mon Sep 17 00:00:00 2001 From: Tom Laird-McConnell Date: Mon, 2 Dec 2024 16:36:52 -0800 Subject: [PATCH 02/21] Wow, it works and it's sliiiiiick! --- src/Consolonia.Blazor/Class1.cs | 7 --- .../Themes/Material/MaterialTheme.cs | 4 ++ src/Consolonia.sln | 6 +++ .../Example.Blazor.Components.csproj | 24 +++++++++ src/Example.Blazor.Components/MainPage.razor | 48 +++++++++++++++++ src/Example.Blazor.Components/SubPage.razor | 20 +++++++ src/Example.Blazor.Components/_Imports.razor | 24 +++++++++ src/Example.Blazor/App.axaml | 7 +-- src/Example.Blazor/App.axaml.cs | 20 +------ src/Example.Blazor/Components/MainPage.razor | 54 ------------------- src/Example.Blazor/Components/_imports.razor | 0 src/Example.Blazor/Example.Blazor.csproj | 1 + 12 files changed, 132 insertions(+), 83 deletions(-) delete mode 100644 src/Consolonia.Blazor/Class1.cs create mode 100644 src/Example.Blazor.Components/Example.Blazor.Components.csproj create mode 100644 src/Example.Blazor.Components/MainPage.razor create mode 100644 src/Example.Blazor.Components/SubPage.razor create mode 100644 src/Example.Blazor.Components/_Imports.razor delete mode 100644 src/Example.Blazor/Components/MainPage.razor delete mode 100644 src/Example.Blazor/Components/_imports.razor diff --git a/src/Consolonia.Blazor/Class1.cs b/src/Consolonia.Blazor/Class1.cs deleted file mode 100644 index 986f2d46..00000000 --- a/src/Consolonia.Blazor/Class1.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Consolonia.Blazor -{ - public class Class1 - { - - } -} diff --git a/src/Consolonia.Themes.TurboVision/Themes/Material/MaterialTheme.cs b/src/Consolonia.Themes.TurboVision/Themes/Material/MaterialTheme.cs index 500a506f..df10912b 100644 --- a/src/Consolonia.Themes.TurboVision/Themes/Material/MaterialTheme.cs +++ b/src/Consolonia.Themes.TurboVision/Themes/Material/MaterialTheme.cs @@ -7,6 +7,10 @@ namespace Consolonia.Themes.TurboVision.Themes.Material [SuppressMessage("ReSharper", "UnusedMember.Global")] public class MaterialTheme : ResourceIncludeBase { + public MaterialTheme() : base(new Uri("avares://Consolonia.Themes.TurboVision/Themes/Material/Material.axaml")) + { + } + public MaterialTheme(Uri baseUri) : base(baseUri) { } diff --git a/src/Consolonia.sln b/src/Consolonia.sln index 95b57b95..421b3cac 100644 --- a/src/Consolonia.sln +++ b/src/Consolonia.sln @@ -65,6 +65,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Consolonia.Blazor", "Consol EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example.Blazor", "Example.Blazor\Example.Blazor.csproj", "{000ED32A-027D-4005-BDE0-4DBF1ABC0829}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example.Blazor.Components", "Example.Blazor.Components\Example.Blazor.Components.csproj", "{F60897B7-2B53-4E2F-B7AE-C3706B928214}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -127,6 +129,10 @@ Global {000ED32A-027D-4005-BDE0-4DBF1ABC0829}.Debug|Any CPU.Build.0 = Debug|Any CPU {000ED32A-027D-4005-BDE0-4DBF1ABC0829}.Release|Any CPU.ActiveCfg = Release|Any CPU {000ED32A-027D-4005-BDE0-4DBF1ABC0829}.Release|Any CPU.Build.0 = Release|Any CPU + {F60897B7-2B53-4E2F-B7AE-C3706B928214}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F60897B7-2B53-4E2F-B7AE-C3706B928214}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F60897B7-2B53-4E2F-B7AE-C3706B928214}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F60897B7-2B53-4E2F-B7AE-C3706B928214}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Example.Blazor.Components/Example.Blazor.Components.csproj b/src/Example.Blazor.Components/Example.Blazor.Components.csproj new file mode 100644 index 00000000..f9536633 --- /dev/null +++ b/src/Example.Blazor.Components/Example.Blazor.Components.csproj @@ -0,0 +1,24 @@ + + + + net8.0 + enable + enable + + + + + + + + + + + + + + + + diff --git a/src/Example.Blazor.Components/MainPage.razor b/src/Example.Blazor.Components/MainPage.razor new file mode 100644 index 00000000..2678b390 --- /dev/null +++ b/src/Example.Blazor.Components/MainPage.razor @@ -0,0 +1,48 @@ +@page "/" +@inject INavigation navigation + +@namespace Example.Blazor.Components + + + + @if (showCounter) + { + Counter: @CounterText + } + + + + + + + + + +@code { + int counter = 0; + bool showCounter = true; + + string CounterText => counter switch + { + 0 => "Not clicked", + 1 => $"Clicked 1 time", + _ => $"Clicked {counter} times" + }; + + string ToggleText => showCounter ? "Hide Counter" : "Show Counter"; + + void OnIncrement() + => counter++; + + void OnToggleCounter() + => showCounter = !showCounter; + + void OnGotoSubPage() + => navigation.PushAsync(); + + async void OnMessageBox(RoutedEventArgs args) + { + await new MessageBox() + .ShowDialogAsync((AC.Control)args.Source, "Hello, Blazor!", "Blazor Bindings for Consolonia"); + } +} \ No newline at end of file diff --git a/src/Example.Blazor.Components/SubPage.razor b/src/Example.Blazor.Components/SubPage.razor new file mode 100644 index 00000000..eb56c630 --- /dev/null +++ b/src/Example.Blazor.Components/SubPage.razor @@ -0,0 +1,20 @@ +@page "/sub" + +@namespace Example.Blazor.Components + +@inject INavigation navigation + + + + + + + + +@code { + public async Task Back() + { + await navigation.PopAsync(); + } +} \ No newline at end of file diff --git a/src/Example.Blazor.Components/_Imports.razor b/src/Example.Blazor.Components/_Imports.razor new file mode 100644 index 00000000..d0e40431 --- /dev/null +++ b/src/Example.Blazor.Components/_Imports.razor @@ -0,0 +1,24 @@ +// @using Microsoft.AspNetCore.Components.Web +@using System.Collections.ObjectModel +@using Microsoft.AspNetCore.Components +@using Microsoft.AspNetCore.Components.CompilerServices +@using Microsoft.AspNetCore.Components.Infrastructure +@using Microsoft.AspNetCore.Components.Rendering +@using Microsoft.AspNetCore.Components.RenderTree +@using Microsoft.AspNetCore.Components.Routing +@using Microsoft.AspNetCore.Components.Sections +@using A = global::Avalonia; +@using AL = global::Avalonia.Layout; +@using AC = global::Avalonia.Controls; +@using AM = global::Avalonia.Media +@using global::Avalonia; +@using global::Avalonia.Controls; +@using global::Avalonia.Interactivity +@using global::Avalonia.Layout; +@using global::Avalonia.Media +@using BlazorBindings.Core; +@using BlazorBindingsAvalonia +@using BlazorBindingsAvalonia.Elements +@using BlazorBindingsAvalonia.Elements.Shapes +@using BlazorBindingsAvalonia.Extensions +@using Consolonia.Core.Controls diff --git a/src/Example.Blazor/App.axaml b/src/Example.Blazor/App.axaml index abf7258b..49b4cb5b 100644 --- a/src/Example.Blazor/App.axaml +++ b/src/Example.Blazor/App.axaml @@ -3,11 +3,12 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="Example.Blazor.App" xmlns:local="using:Example.Blazor" - xmlns:turboVisionBlack="clr-namespace:Consolonia.Themes.TurboVision.Themes.TurboVisionBlack;assembly=Consolonia.Themes.TurboVision" + xmlns:theme="clr-namespace:Consolonia.Themes.TurboVision.Themes.Material;assembly=Consolonia.Themes.TurboVision" xmlns:infrastructure="clr-namespace:Consolonia.Core.Infrastructure;assembly=Consolonia.Core" RequestedThemeVariant="Default"> - + - + + \ No newline at end of file diff --git a/src/Example.Blazor/App.axaml.cs b/src/Example.Blazor/App.axaml.cs index 993d9b2d..8bff0dc9 100644 --- a/src/Example.Blazor/App.axaml.cs +++ b/src/Example.Blazor/App.axaml.cs @@ -1,6 +1,7 @@ using Avalonia; using Avalonia.Markup.Xaml; using BlazorBindingsAvalonia; +using Example.Blazor.Components; namespace Example.Blazor { @@ -12,24 +13,5 @@ public override void Initialize() { AvaloniaXamlLoader.Load(this); } - - public override void OnFrameworkInitializationCompleted() - { - base.OnFrameworkInitializationCompleted(); - - this.AttachDevTools(); - } } - - //public class BlazorBindingsApplicationMainPage : BlazorBindingsApplication - //{ - // //public App() - // //{ - // // //Styles.Add(new FluentTheme()); - // // //Styles.Add(new StyleInclude(XamlIlRuntimeHelpers.CreateRootServiceProviderV3(null))//(Uri?)null) - // // //{ - // // // Source = new Uri("avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml") - // // //}); - // //} - //} } \ No newline at end of file diff --git a/src/Example.Blazor/Components/MainPage.razor b/src/Example.Blazor/Components/MainPage.razor deleted file mode 100644 index 5447f0c7..00000000 --- a/src/Example.Blazor/Components/MainPage.razor +++ /dev/null @@ -1,54 +0,0 @@ -@page "/" - -@namespace Example.Blazor - -@using System.Collections.ObjectModel -@using Microsoft.AspNetCore.Components -@using Microsoft.AspNetCore.Components.CompilerServices -@using Microsoft.AspNetCore.Components.Infrastructure -@using Microsoft.AspNetCore.Components.Rendering -@using Microsoft.AspNetCore.Components.RenderTree -@using Microsoft.AspNetCore.Components.Routing -@using Microsoft.AspNetCore.Components.Sections -@using A = global::Avalonia; -@using AL = global::Avalonia.Layout; -@using AC = global::Avalonia.Controls; -@using AM = global::Avalonia.Media -@using BlazorBindings.Core; -@using BlazorBindingsAvalonia.Elements -@using BlazorBindingsAvalonia.Elements.Shapes -@using BlazorBindingsAvalonia.Extensions - - - - @if (showCounter) - { - Counter: @ButtonText - - } - - - - -@code { - int count = 0; - bool showCounter = true; - - string ButtonText => count switch - { - 0 => "Click me", - 1 => $"Clicked 1 time", - _ => $"Clicked {count} times" - }; - - - void ToggleButton() - { - showCounter = !showCounter; - } - - void OnCounterClicked() - { - count++; - } -} \ No newline at end of file diff --git a/src/Example.Blazor/Components/_imports.razor b/src/Example.Blazor/Components/_imports.razor deleted file mode 100644 index e69de29b..00000000 diff --git a/src/Example.Blazor/Example.Blazor.csproj b/src/Example.Blazor/Example.Blazor.csproj index b58574b8..fff2509b 100644 --- a/src/Example.Blazor/Example.Blazor.csproj +++ b/src/Example.Blazor/Example.Blazor.csproj @@ -15,6 +15,7 @@ + From ee365614726ea579b8d36fd53ecad71d5c234b77 Mon Sep 17 00:00:00 2001 From: Tom Laird-McConnell Date: Mon, 2 Dec 2024 16:40:26 -0800 Subject: [PATCH 03/21] cleanup --- src/Example.Blazor.Components/_Imports.razor | 1 - src/Example.Blazor/App.axaml.cs | 8 -------- 2 files changed, 9 deletions(-) diff --git a/src/Example.Blazor.Components/_Imports.razor b/src/Example.Blazor.Components/_Imports.razor index d0e40431..f6dcb9f0 100644 --- a/src/Example.Blazor.Components/_Imports.razor +++ b/src/Example.Blazor.Components/_Imports.razor @@ -1,4 +1,3 @@ -// @using Microsoft.AspNetCore.Components.Web @using System.Collections.ObjectModel @using Microsoft.AspNetCore.Components @using Microsoft.AspNetCore.Components.CompilerServices diff --git a/src/Example.Blazor/App.axaml.cs b/src/Example.Blazor/App.axaml.cs index 8bff0dc9..36a1df72 100644 --- a/src/Example.Blazor/App.axaml.cs +++ b/src/Example.Blazor/App.axaml.cs @@ -1,17 +1,9 @@ -using Avalonia; -using Avalonia.Markup.Xaml; using BlazorBindingsAvalonia; using Example.Blazor.Components; namespace Example.Blazor { - - public class App : BlazorBindingsApplication { - public override void Initialize() - { - AvaloniaXamlLoader.Load(this); - } } } \ No newline at end of file From 94396e7171834e3e15bc323aa194b9caa81c1a2a Mon Sep 17 00:00:00 2001 From: Tom Laird-McConnell Date: Mon, 2 Dec 2024 18:26:29 -0800 Subject: [PATCH 04/21] * added consolonia.blazor project * added example.blazor project * added example.blazor.components project * bumped .net version to 8.0 due to AvaloniaBlazorBindings projectdependency needing it * cleaned up project package dependencies to prepare publishing package dependencies. * tied consolonia package version to avalonia major/minor version since we depend on undocumented interfaces. --- Directory.Build.props | 4 +- src/Consolonia.Blazor/BuilderExtensions.cs | 37 +++++++++++++++ .../Consolonia.Blazor.csproj | 8 +++- .../ConsoloniaBlazorApplication.cs | 33 ++++++++++++++ src/Consolonia.Core/Helpers/Extensions.cs | 45 +++++++++++++++++++ .../Infrastructure/ConsoloniaApplication.cs | 38 +--------------- .../Infrastructure/ConsoloniaException.cs | 4 -- .../ConsoloniaNotSupportedException.cs | 6 --- .../Consolonia.Designer.csproj | 2 + src/Consolonia.GuiCS/binding.cs | 5 ++- src/Consolonia.NUnit/Consolonia.NUnit.csproj | 1 + .../Consolonia.PlatformSupport.csproj | 7 ++- .../Consolonia.Themes.TurboVision.csproj | 5 ++- .../Example.Blazor.Components.csproj | 9 +--- src/Example.Blazor.Components/MainPage.razor | 12 +++-- src/Example.Blazor/App.axaml | 1 - src/Example.Blazor/App.axaml.cs | 4 +- src/Example.Blazor/Example.Blazor.csproj | 6 +-- src/Example.Blazor/Program.cs | 8 ++-- 19 files changed, 159 insertions(+), 76 deletions(-) create mode 100644 src/Consolonia.Blazor/BuilderExtensions.cs create mode 100644 src/Consolonia.Blazor/ConsoloniaBlazorApplication.cs diff --git a/Directory.Build.props b/Directory.Build.props index 5c03ebf1..4190adb6 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,11 +1,11 @@  - net6.0 + net8.0 disable - 11.0.9 + 11.2 https://github.com/jinek/Consolonia/graphs/contributors Text User Interface implementation of Avalonia UI (GUI Framework) Copyright © Evgeny Gorbovoy 2021 - 2022 diff --git a/src/Consolonia.Blazor/BuilderExtensions.cs b/src/Consolonia.Blazor/BuilderExtensions.cs new file mode 100644 index 00000000..40d6206b --- /dev/null +++ b/src/Consolonia.Blazor/BuilderExtensions.cs @@ -0,0 +1,37 @@ +using System; +using Avalonia; +using Avalonia.Controls.ApplicationLifetimes; +using BlazorBindingsAvalonia; +using Consolonia.Core; +using Consolonia.Core.Infrastructure; +using Microsoft.Extensions.DependencyInjection; + +namespace Consolonia.Blazor +{ + public static class BuilderExtensions + { + /// + /// Use Consolonize in Blazor mode + /// + /// + /// + /// + public static AppBuilder UseConsoloniaBlazor(this AppBuilder builder, Action configureServices = null) + { + return builder + .UseConsolonia() + .UseAvaloniaBlazorBindings((sp) => + { + // register IApplicationLifetime interfaces, making it so you can just @inject do IClassicDesktopStyleApplicationLifetime lifetime; + //sp.AddSingleton((sp) => Application.Current.ApplicationLifetime as ISingleViewApplicationLifetime); + //sp.AddSingleton((sp) => Application.Current.ApplicationLifetime as IControlledApplicationLifetime); + sp.AddSingleton((sp) => Application.Current.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime); + + if (configureServices != null) + { + configureServices(sp); + } + }); + } + } +} diff --git a/src/Consolonia.Blazor/Consolonia.Blazor.csproj b/src/Consolonia.Blazor/Consolonia.Blazor.csproj index b7218b15..c742ffc5 100644 --- a/src/Consolonia.Blazor/Consolonia.Blazor.csproj +++ b/src/Consolonia.Blazor/Consolonia.Blazor.csproj @@ -5,7 +5,13 @@ - + + + + + + + diff --git a/src/Consolonia.Blazor/ConsoloniaBlazorApplication.cs b/src/Consolonia.Blazor/ConsoloniaBlazorApplication.cs new file mode 100644 index 00000000..aed696a8 --- /dev/null +++ b/src/Consolonia.Blazor/ConsoloniaBlazorApplication.cs @@ -0,0 +1,33 @@ +using Avalonia.Input; +using Avalonia; +using BlazorBindingsAvalonia; +using Consolonia.Core.Helpers; +using Consolonia.Core.Infrastructure; +using Microsoft.AspNetCore.Components; +using Avalonia.Platform; + +namespace Consolonia.Blazor +{ + /// + /// Use this application as your app base class to use Consolonia.Blazor Blazor engine. + /// + /// The root window for the application. + public class ConsoloniaBlazorApplication : BlazorBindingsApplication + where TComponent : IComponent + { + public override void RegisterServices() + { + base.RegisterServices(); + + AvaloniaLocator.CurrentMutable.Bind() + .ToTransient(); + } + + public override void OnFrameworkInitializationCompleted() + { + base.OnFrameworkInitializationCompleted(); + + this.AddConsoloniaDesignMode(); + } + } +} diff --git a/src/Consolonia.Core/Helpers/Extensions.cs b/src/Consolonia.Core/Helpers/Extensions.cs index bc774e2d..6bf249ef 100644 --- a/src/Consolonia.Core/Helpers/Extensions.cs +++ b/src/Consolonia.Core/Helpers/Extensions.cs @@ -2,7 +2,11 @@ using System.Collections.Generic; using System.Text; using Avalonia; +using Avalonia.Controls.Primitives; +using Avalonia.Controls; +using Avalonia.Media; using Avalonia.Reactive; +using Avalonia.Styling; using Consolonia.Core.Drawing.PixelBufferImplementation; using Consolonia.Core.Infrastructure; using NeoSmart.Unicode; @@ -19,6 +23,47 @@ public static void SubscribeAction( observable.Subscribe(new AnonymousObserver>(action)); } + public static void AddConsoloniaDesignMode(this Application application) + { + if (Design.IsDesignMode) + { + // For previewing in Visual Studio designer without Design.PreviewWith tag we need to set default font and colors + // get anything to render. This is not perfect, but nicer than getting a big error screen. + IBrush foregroundBrush = Brushes.White; + if (application.Styles.TryGetResource("ThemeForegroundBrush", null, out object brush)) + foregroundBrush = (IBrush)brush; + + IBrush backgroundBrush = Brushes.Black; + if (application.Styles.TryGetResource("ThemeBackgroundBrush", null, out brush)) + backgroundBrush = (IBrush)brush; + + application.Styles.Add(new Style(x => x.Is()) + { + Setters = + { + new Setter(TemplatedControl.FontSizeProperty, 16.0), + new Setter(TemplatedControl.FontFamilyProperty, new FontFamily("Cascadia Mono")), + new Setter(TemplatedControl.ForegroundProperty, foregroundBrush), + new Setter(TemplatedControl.BackgroundProperty, backgroundBrush) + } + }); + + // EXPERIMENTAL + // If you do RenderTRansform="scale(10.0,10.0) you can actually sort of see the UI get bigger + // but this doesn' seem to work when using these style setters. + //this.Styles.Add(new Style(x => x.Is()) + //{ + // Setters = + // { + // //new Setter(Visual.RenderTransformOriginProperty, RelativePoint.TopLeft), + // //new Setter(Visual.RenderTransformProperty, new ScaleTransform(2.0, 2.0)), + // //new Setter(Visual.RenderTransformProperty, new ScaleTransform(2.0, 2.0)), + // } + //}); + } + + } + public static void Print(this IConsole console, PixelBufferCoordinate point, Pixel pixel) { console.Print(point, diff --git a/src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs b/src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs index cda946f7..1969bfce 100644 --- a/src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs +++ b/src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs @@ -4,6 +4,7 @@ using Avalonia.Input; using Avalonia.Media; using Avalonia.Styling; +using Consolonia.Core.Helpers; namespace Consolonia.Core.Infrastructure { @@ -21,42 +22,7 @@ public override void OnFrameworkInitializationCompleted() { base.OnFrameworkInitializationCompleted(); - if (Design.IsDesignMode) - { - // For previewing in Visual Studio designer without Design.PreviewWith tag we need to set default font and colors - // get anything to render. This is not perfect, but nicer than getting a big error screen. - IBrush foregroundBrush = Brushes.White; - if (Styles.TryGetResource("ThemeForegroundBrush", null, out object brush)) - foregroundBrush = (IBrush)brush; - - IBrush backgroundBrush = Brushes.Black; - if (Styles.TryGetResource("ThemeBackgroundBrush", null, out brush)) - backgroundBrush = (IBrush)brush; - - Styles.Add(new Style(x => x.Is()) - { - Setters = - { - new Setter(TemplatedControl.FontSizeProperty, 16.0), - new Setter(TemplatedControl.FontFamilyProperty, new FontFamily("Cascadia Mono")), - new Setter(TemplatedControl.ForegroundProperty, foregroundBrush), - new Setter(TemplatedControl.BackgroundProperty, backgroundBrush) - } - }); - - // EXPERIMENTAL - // If you do RenderTRansform="scale(10.0,10.0) you can actually sort of see the UI get bigger - // but this doesn' seem to work when using these style setters. - //this.Styles.Add(new Style(x => x.Is()) - //{ - // Setters = - // { - // //new Setter(Visual.RenderTransformOriginProperty, RelativePoint.TopLeft), - // //new Setter(Visual.RenderTransformProperty, new ScaleTransform(2.0, 2.0)), - // //new Setter(Visual.RenderTransformProperty, new ScaleTransform(2.0, 2.0)), - // } - //}); - } + this.AddConsoloniaDesignMode(); } } } \ No newline at end of file diff --git a/src/Consolonia.Core/Infrastructure/ConsoloniaException.cs b/src/Consolonia.Core/Infrastructure/ConsoloniaException.cs index 2693c330..85ea7119 100644 --- a/src/Consolonia.Core/Infrastructure/ConsoloniaException.cs +++ b/src/Consolonia.Core/Infrastructure/ConsoloniaException.cs @@ -12,10 +12,6 @@ public ConsoloniaException() { } - protected ConsoloniaException([NotNull] SerializationInfo info, StreamingContext context) : base(info, context) - { - } - public ConsoloniaException(string message) : base(message) { } diff --git a/src/Consolonia.Core/Infrastructure/ConsoloniaNotSupportedException.cs b/src/Consolonia.Core/Infrastructure/ConsoloniaNotSupportedException.cs index 11394801..03e58ce1 100644 --- a/src/Consolonia.Core/Infrastructure/ConsoloniaNotSupportedException.cs +++ b/src/Consolonia.Core/Infrastructure/ConsoloniaNotSupportedException.cs @@ -11,12 +11,6 @@ internal ConsoloniaNotSupportedException(NotSupportedRequest request) Request = request; } - protected ConsoloniaNotSupportedException( - SerializationInfo info, - StreamingContext context) : base(info, context) - { - } - public NotSupportedRequest Request { get; } } } \ No newline at end of file diff --git a/src/Consolonia.Designer/Consolonia.Designer.csproj b/src/Consolonia.Designer/Consolonia.Designer.csproj index d36a8f58..469b3e80 100644 --- a/src/Consolonia.Designer/Consolonia.Designer.csproj +++ b/src/Consolonia.Designer/Consolonia.Designer.csproj @@ -8,6 +8,8 @@ + + diff --git a/src/Consolonia.GuiCS/binding.cs b/src/Consolonia.GuiCS/binding.cs index c26cb218..aaa6d759 100644 --- a/src/Consolonia.GuiCS/binding.cs +++ b/src/Consolonia.GuiCS/binding.cs @@ -1,3 +1,4 @@ +#pragma warning disable CS8981 // The type name only contains lower-cased ascii characters. Such names may become reserved for the language. // // TODO: // * FindNCurses needs to remove the old probing code @@ -328,8 +329,8 @@ static public int IsAlt (int key) internal class Delegates { #pragma warning restore RCS1102 // Make class static. public delegate IntPtr initscr (); - public delegate int endwin (); - public delegate bool isendwin (); + public delegate int endwin (); + public delegate bool isendwin (); public delegate int cbreak (); public delegate int nocbreak (); public delegate int echo (); diff --git a/src/Consolonia.NUnit/Consolonia.NUnit.csproj b/src/Consolonia.NUnit/Consolonia.NUnit.csproj index dae1791f..620824ed 100644 --- a/src/Consolonia.NUnit/Consolonia.NUnit.csproj +++ b/src/Consolonia.NUnit/Consolonia.NUnit.csproj @@ -7,6 +7,7 @@ + diff --git a/src/Consolonia.PlatformSupport/Consolonia.PlatformSupport.csproj b/src/Consolonia.PlatformSupport/Consolonia.PlatformSupport.csproj index 67b5a320..4b1ec17c 100644 --- a/src/Consolonia.PlatformSupport/Consolonia.PlatformSupport.csproj +++ b/src/Consolonia.PlatformSupport/Consolonia.PlatformSupport.csproj @@ -1,6 +1,11 @@ - + + + + + + diff --git a/src/Consolonia.Themes.TurboVision/Consolonia.Themes.TurboVision.csproj b/src/Consolonia.Themes.TurboVision/Consolonia.Themes.TurboVision.csproj index 0a5c6c47..ee0a63fc 100644 --- a/src/Consolonia.Themes.TurboVision/Consolonia.Themes.TurboVision.csproj +++ b/src/Consolonia.Themes.TurboVision/Consolonia.Themes.TurboVision.csproj @@ -3,11 +3,12 @@ - + + - + diff --git a/src/Example.Blazor.Components/Example.Blazor.Components.csproj b/src/Example.Blazor.Components/Example.Blazor.Components.csproj index f9536633..20424284 100644 --- a/src/Example.Blazor.Components/Example.Blazor.Components.csproj +++ b/src/Example.Blazor.Components/Example.Blazor.Components.csproj @@ -6,15 +6,8 @@ enable - - - - - - + diff --git a/src/Example.Blazor.Components/MainPage.razor b/src/Example.Blazor.Components/MainPage.razor index 2678b390..2e4950b6 100644 --- a/src/Example.Blazor.Components/MainPage.razor +++ b/src/Example.Blazor.Components/MainPage.razor @@ -1,10 +1,12 @@ @page "/" @inject INavigation navigation +@inject IClassicDesktopStyleApplicationLifetime lifetime @namespace Example.Blazor.Components +@using Avalonia.Controls.ApplicationLifetimes - + @if (showCounter) { Counter: @CounterText @@ -14,8 +16,9 @@ + - + @code { @@ -43,6 +46,9 @@ async void OnMessageBox(RoutedEventArgs args) { await new MessageBox() - .ShowDialogAsync((AC.Control)args.Source, "Hello, Blazor!", "Blazor Bindings for Consolonia"); + .ShowDialogAsync((AC.Control)args.Source!, "Hello, Blazor!", "Blazor Bindings for Consolonia"); } + + void OnExit() + => lifetime.Shutdown(); } \ No newline at end of file diff --git a/src/Example.Blazor/App.axaml b/src/Example.Blazor/App.axaml index 49b4cb5b..de0ce36a 100644 --- a/src/Example.Blazor/App.axaml +++ b/src/Example.Blazor/App.axaml @@ -4,7 +4,6 @@ x:Class="Example.Blazor.App" xmlns:local="using:Example.Blazor" xmlns:theme="clr-namespace:Consolonia.Themes.TurboVision.Themes.Material;assembly=Consolonia.Themes.TurboVision" - xmlns:infrastructure="clr-namespace:Consolonia.Core.Infrastructure;assembly=Consolonia.Core" RequestedThemeVariant="Default"> diff --git a/src/Example.Blazor/App.axaml.cs b/src/Example.Blazor/App.axaml.cs index 36a1df72..7bfd5226 100644 --- a/src/Example.Blazor/App.axaml.cs +++ b/src/Example.Blazor/App.axaml.cs @@ -1,9 +1,9 @@ -using BlazorBindingsAvalonia; +using Consolonia.Blazor; using Example.Blazor.Components; namespace Example.Blazor { - public class App : BlazorBindingsApplication + public class App : ConsoloniaBlazorApplication { } } \ No newline at end of file diff --git a/src/Example.Blazor/Example.Blazor.csproj b/src/Example.Blazor/Example.Blazor.csproj index fff2509b..eb50000c 100644 --- a/src/Example.Blazor/Example.Blazor.csproj +++ b/src/Example.Blazor/Example.Blazor.csproj @@ -8,13 +8,13 @@ - - - + + + diff --git a/src/Example.Blazor/Program.cs b/src/Example.Blazor/Program.cs index f95cfbea..d562621d 100644 --- a/src/Example.Blazor/Program.cs +++ b/src/Example.Blazor/Program.cs @@ -1,5 +1,5 @@ using Avalonia; -using BlazorBindingsAvalonia; +using Consolonia.Blazor; using Consolonia.Core; using Consolonia.Core.Infrastructure; using Consolonia.PlatformSupport; @@ -18,11 +18,9 @@ private static void Main(string[] args) public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure() - .UseConsolonia() + .UseConsoloniaBlazor() .UseAutoDetectedConsole() .LogToException() - .UseAvaloniaBlazorBindings(services => - { - }); +; } } From f6db4ac5cf467eadeef658dfeb800c8a236a5f0f Mon Sep 17 00:00:00 2001 From: Tom Laird-McConnell Date: Mon, 2 Dec 2024 18:32:33 -0800 Subject: [PATCH 05/21] removed dependency on platformsupport for blazor component. --- src/Consolonia.Blazor/BuilderExtensions.cs | 1 - src/Consolonia.Blazor/Consolonia.Blazor.csproj | 2 -- src/Example.Blazor/Example.Blazor.csproj | 2 ++ 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Consolonia.Blazor/BuilderExtensions.cs b/src/Consolonia.Blazor/BuilderExtensions.cs index 40d6206b..2d989367 100644 --- a/src/Consolonia.Blazor/BuilderExtensions.cs +++ b/src/Consolonia.Blazor/BuilderExtensions.cs @@ -3,7 +3,6 @@ using Avalonia.Controls.ApplicationLifetimes; using BlazorBindingsAvalonia; using Consolonia.Core; -using Consolonia.Core.Infrastructure; using Microsoft.Extensions.DependencyInjection; namespace Consolonia.Blazor diff --git a/src/Consolonia.Blazor/Consolonia.Blazor.csproj b/src/Consolonia.Blazor/Consolonia.Blazor.csproj index c742ffc5..f6c1dc62 100644 --- a/src/Consolonia.Blazor/Consolonia.Blazor.csproj +++ b/src/Consolonia.Blazor/Consolonia.Blazor.csproj @@ -4,7 +4,6 @@ - @@ -12,6 +11,5 @@ - diff --git a/src/Example.Blazor/Example.Blazor.csproj b/src/Example.Blazor/Example.Blazor.csproj index eb50000c..c47a0b5b 100644 --- a/src/Example.Blazor/Example.Blazor.csproj +++ b/src/Example.Blazor/Example.Blazor.csproj @@ -10,10 +10,12 @@ + + From ba8740486209338ff8595c7c839a24b0f3cf3151 Mon Sep 17 00:00:00 2001 From: Tom Laird-McConnell Date: Mon, 2 Dec 2024 18:44:07 -0800 Subject: [PATCH 06/21] cleanup --- src/Example.Blazor.Components/MainPage.razor | 3 +-- src/Example.Blazor.Components/_Imports.razor | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Example.Blazor.Components/MainPage.razor b/src/Example.Blazor.Components/MainPage.razor index 2e4950b6..1bb501b5 100644 --- a/src/Example.Blazor.Components/MainPage.razor +++ b/src/Example.Blazor.Components/MainPage.razor @@ -3,7 +3,6 @@ @inject IClassicDesktopStyleApplicationLifetime lifetime @namespace Example.Blazor.Components -@using Avalonia.Controls.ApplicationLifetimes @@ -12,7 +11,7 @@ Counter: @CounterText } - + diff --git a/src/Example.Blazor.Components/_Imports.razor b/src/Example.Blazor.Components/_Imports.razor index f6dcb9f0..7d3faa86 100644 --- a/src/Example.Blazor.Components/_Imports.razor +++ b/src/Example.Blazor.Components/_Imports.razor @@ -15,6 +15,7 @@ @using global::Avalonia.Interactivity @using global::Avalonia.Layout; @using global::Avalonia.Media +@using Avalonia.Controls.ApplicationLifetimes @using BlazorBindings.Core; @using BlazorBindingsAvalonia @using BlazorBindingsAvalonia.Elements From 697e2c9912596f07980cb97e80dbf01ee535198a Mon Sep 17 00:00:00 2001 From: Tom Laird-McConnell Date: Mon, 2 Dec 2024 18:45:52 -0800 Subject: [PATCH 07/21] bump net to 8.0 for build actions --- .github/workflows/editorconfig.yml | 2 +- .github/workflows/general_build.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/editorconfig.yml b/.github/workflows/editorconfig.yml index c258de2d..f3b19014 100644 --- a/.github/workflows/editorconfig.yml +++ b/.github/workflows/editorconfig.yml @@ -27,7 +27,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v1 with: - dotnet-version: 6.0.x + dotnet-version: 8.0.x - name: Restore run: dotnet restore diff --git a/.github/workflows/general_build.yml b/.github/workflows/general_build.yml index 4bc85551..7a4b9879 100644 --- a/.github/workflows/general_build.yml +++ b/.github/workflows/general_build.yml @@ -22,7 +22,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v1 with: - dotnet-version: 6.0.x + dotnet-version: 8.0.x - name: Restore dependencies run: dotnet restore - name: Build From a7945a1f664065f2ad77c70f6c97b2af148d0989 Mon Sep 17 00:00:00 2001 From: Tom Laird-McConnell Date: Mon, 2 Dec 2024 18:52:33 -0800 Subject: [PATCH 08/21] add IStorageProder and IClipboard to injection --- src/Consolonia.Blazor/BuilderExtensions.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Consolonia.Blazor/BuilderExtensions.cs b/src/Consolonia.Blazor/BuilderExtensions.cs index 2d989367..8a27e536 100644 --- a/src/Consolonia.Blazor/BuilderExtensions.cs +++ b/src/Consolonia.Blazor/BuilderExtensions.cs @@ -1,6 +1,12 @@ using System; using Avalonia; +using Avalonia.Controls; using Avalonia.Controls.ApplicationLifetimes; +using Avalonia.Controls.Platform; +using Avalonia.Input.Platform; +using Avalonia.Input; +using Avalonia.Platform.Storage; +using Avalonia.Platform; using BlazorBindingsAvalonia; using Consolonia.Core; using Microsoft.Extensions.DependencyInjection; @@ -21,10 +27,16 @@ public static AppBuilder UseConsoloniaBlazor(this AppBuilder builder, Action { - // register IApplicationLifetime interfaces, making it so you can just @inject do IClassicDesktopStyleApplicationLifetime lifetime; - //sp.AddSingleton((sp) => Application.Current.ApplicationLifetime as ISingleViewApplicationLifetime); - //sp.AddSingleton((sp) => Application.Current.ApplicationLifetime as IControlledApplicationLifetime); + // Register services for injectoin sp.AddSingleton((sp) => Application.Current.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime); + sp.AddTransient((sp) => sp.GetService().MainWindow.StorageProvider); + sp.AddTransient((sp) => sp.GetService().MainWindow.Clipboard); + sp.AddTransient((sp) => sp.GetService().MainWindow.InsetsManager); + sp.AddTransient((sp) => sp.GetService().MainWindow.InputPane); + sp.AddTransient((sp) => sp.GetService().MainWindow.Launcher); + sp.AddTransient((sp) => sp.GetService().MainWindow.Screens); + sp.AddTransient((sp) => sp.GetService().MainWindow.FocusManager); + sp.AddTransient((sp) => sp.GetService().MainWindow.PlatformSettings); if (configureServices != null) { From ff0fb7d4c6e0baafb072937295670478ba21553a Mon Sep 17 00:00:00 2001 From: Tom Laird-McConnell Date: Tue, 3 Dec 2024 08:25:56 -0800 Subject: [PATCH 09/21] lint issues --- src/Consolonia.Blazor/BuilderExtensions.cs | 28 ++++++++----------- .../Infrastructure/ConsoloniaApplication.cs | 4 --- .../ConsoloniaNotSupportedException.cs | 1 - 3 files changed, 11 insertions(+), 22 deletions(-) diff --git a/src/Consolonia.Blazor/BuilderExtensions.cs b/src/Consolonia.Blazor/BuilderExtensions.cs index 8a27e536..8f0d02fd 100644 --- a/src/Consolonia.Blazor/BuilderExtensions.cs +++ b/src/Consolonia.Blazor/BuilderExtensions.cs @@ -1,12 +1,6 @@ using System; using Avalonia; -using Avalonia.Controls; using Avalonia.Controls.ApplicationLifetimes; -using Avalonia.Controls.Platform; -using Avalonia.Input.Platform; -using Avalonia.Input; -using Avalonia.Platform.Storage; -using Avalonia.Platform; using BlazorBindingsAvalonia; using Consolonia.Core; using Microsoft.Extensions.DependencyInjection; @@ -25,22 +19,22 @@ public static AppBuilder UseConsoloniaBlazor(this AppBuilder builder, Action + .UseAvaloniaBlazorBindings((sc) => { // Register services for injectoin - sp.AddSingleton((sp) => Application.Current.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime); - sp.AddTransient((sp) => sp.GetService().MainWindow.StorageProvider); - sp.AddTransient((sp) => sp.GetService().MainWindow.Clipboard); - sp.AddTransient((sp) => sp.GetService().MainWindow.InsetsManager); - sp.AddTransient((sp) => sp.GetService().MainWindow.InputPane); - sp.AddTransient((sp) => sp.GetService().MainWindow.Launcher); - sp.AddTransient((sp) => sp.GetService().MainWindow.Screens); - sp.AddTransient((sp) => sp.GetService().MainWindow.FocusManager); - sp.AddTransient((sp) => sp.GetService().MainWindow.PlatformSettings); + sc.AddSingleton((_) => Application.Current.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime); + sc.AddTransient((sp) => sp.GetRequiredService().MainWindow?.StorageProvider); + sc.AddTransient((sp) => sp.GetRequiredService().MainWindow?.Clipboard); + sc.AddTransient((sp) => sp.GetRequiredService().MainWindow?.InsetsManager); + sc.AddTransient((sp) => sp.GetRequiredService().MainWindow?.InputPane); + sc.AddTransient((sp) => sp.GetRequiredService().MainWindow?.Launcher); + sc.AddTransient((sp) => sp.GetRequiredService().MainWindow?.Screens); + sc.AddTransient((sp) => sp.GetRequiredService().MainWindow?.FocusManager); + sc.AddTransient((sp) => sp.GetRequiredService().MainWindow?.PlatformSettings); if (configureServices != null) { - configureServices(sp); + configureServices(sc); } }); } diff --git a/src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs b/src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs index 1969bfce..fd420103 100644 --- a/src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs +++ b/src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs @@ -1,9 +1,5 @@ using Avalonia; -using Avalonia.Controls; -using Avalonia.Controls.Primitives; using Avalonia.Input; -using Avalonia.Media; -using Avalonia.Styling; using Consolonia.Core.Helpers; namespace Consolonia.Core.Infrastructure diff --git a/src/Consolonia.Core/Infrastructure/ConsoloniaNotSupportedException.cs b/src/Consolonia.Core/Infrastructure/ConsoloniaNotSupportedException.cs index 03e58ce1..d71b502b 100644 --- a/src/Consolonia.Core/Infrastructure/ConsoloniaNotSupportedException.cs +++ b/src/Consolonia.Core/Infrastructure/ConsoloniaNotSupportedException.cs @@ -1,5 +1,4 @@ using System; -using System.Runtime.Serialization; namespace Consolonia.Core.Infrastructure { From 17ecbddfe3a1ce166d74408820864cfad53e9787 Mon Sep 17 00:00:00 2001 From: Tom Laird-McConnell Date: Tue, 3 Dec 2024 11:46:23 -0800 Subject: [PATCH 10/21] lint pass 2 --- src/Consolonia.Blazor/BuilderExtensions.cs | 7 +++++- .../ConsoloniaBlazorApplication.cs | 1 - .../Infrastructure/ConsoloniaException.cs | 2 -- src/Example.Blazor.Components/MainPage.razor | 24 +++++++++---------- src/Example.Blazor.Components/SubPage.razor | 4 ++-- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/Consolonia.Blazor/BuilderExtensions.cs b/src/Consolonia.Blazor/BuilderExtensions.cs index 8f0d02fd..6c1802a2 100644 --- a/src/Consolonia.Blazor/BuilderExtensions.cs +++ b/src/Consolonia.Blazor/BuilderExtensions.cs @@ -22,7 +22,12 @@ public static AppBuilder UseConsoloniaBlazor(this AppBuilder builder, Action { // Register services for injectoin - sc.AddSingleton((_) => Application.Current.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime); + sc.AddSingleton((_) => + { + var lifetime = (IClassicDesktopStyleApplicationLifetime)Application.Current.ApplicationLifetime; + ArgumentNullException.ThrowIfNull(lifetime); + return lifetime; + }); sc.AddTransient((sp) => sp.GetRequiredService().MainWindow?.StorageProvider); sc.AddTransient((sp) => sp.GetRequiredService().MainWindow?.Clipboard); sc.AddTransient((sp) => sp.GetRequiredService().MainWindow?.InsetsManager); diff --git a/src/Consolonia.Blazor/ConsoloniaBlazorApplication.cs b/src/Consolonia.Blazor/ConsoloniaBlazorApplication.cs index aed696a8..8af53bab 100644 --- a/src/Consolonia.Blazor/ConsoloniaBlazorApplication.cs +++ b/src/Consolonia.Blazor/ConsoloniaBlazorApplication.cs @@ -4,7 +4,6 @@ using Consolonia.Core.Helpers; using Consolonia.Core.Infrastructure; using Microsoft.AspNetCore.Components; -using Avalonia.Platform; namespace Consolonia.Blazor { diff --git a/src/Consolonia.Core/Infrastructure/ConsoloniaException.cs b/src/Consolonia.Core/Infrastructure/ConsoloniaException.cs index 85ea7119..5861522f 100644 --- a/src/Consolonia.Core/Infrastructure/ConsoloniaException.cs +++ b/src/Consolonia.Core/Infrastructure/ConsoloniaException.cs @@ -1,6 +1,4 @@ using System; -using System.Diagnostics.CodeAnalysis; -using System.Runtime.Serialization; namespace Consolonia.Core.Infrastructure { diff --git a/src/Example.Blazor.Components/MainPage.razor b/src/Example.Blazor.Components/MainPage.razor index 1bb501b5..731be1cf 100644 --- a/src/Example.Blazor.Components/MainPage.razor +++ b/src/Example.Blazor.Components/MainPage.razor @@ -1,12 +1,12 @@ @page "/" -@inject INavigation navigation -@inject IClassicDesktopStyleApplicationLifetime lifetime +@inject INavigation Navigation +@inject IClassicDesktopStyleApplicationLifetime Lifetime @namespace Example.Blazor.Components - @if (showCounter) + @if (_showCounter) { Counter: @CounterText } @@ -21,26 +21,26 @@ @code { - int counter = 0; - bool showCounter = true; + int _counter; + bool _showCounter = true; - string CounterText => counter switch + string CounterText => _counter switch { 0 => "Not clicked", 1 => $"Clicked 1 time", - _ => $"Clicked {counter} times" + _ => $"Clicked {_counter} times" }; - string ToggleText => showCounter ? "Hide Counter" : "Show Counter"; + string ToggleText => _showCounter ? "Hide Counter" : "Show Counter"; void OnIncrement() - => counter++; + => _counter++; void OnToggleCounter() - => showCounter = !showCounter; + => _showCounter = !_showCounter; void OnGotoSubPage() - => navigation.PushAsync(); + => Navigation.PushAsync(); async void OnMessageBox(RoutedEventArgs args) { @@ -49,5 +49,5 @@ } void OnExit() - => lifetime.Shutdown(); + => Lifetime.Shutdown(); } \ No newline at end of file diff --git a/src/Example.Blazor.Components/SubPage.razor b/src/Example.Blazor.Components/SubPage.razor index eb56c630..33f102fc 100644 --- a/src/Example.Blazor.Components/SubPage.razor +++ b/src/Example.Blazor.Components/SubPage.razor @@ -2,7 +2,7 @@ @namespace Example.Blazor.Components -@inject INavigation navigation +@inject INavigation Navigation Date: Tue, 3 Dec 2024 11:52:00 -0800 Subject: [PATCH 11/21] Attempt number 3 --- src/Consolonia.Blazor/BuilderExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Consolonia.Blazor/BuilderExtensions.cs b/src/Consolonia.Blazor/BuilderExtensions.cs index 6c1802a2..d3f3a688 100644 --- a/src/Consolonia.Blazor/BuilderExtensions.cs +++ b/src/Consolonia.Blazor/BuilderExtensions.cs @@ -24,7 +24,7 @@ public static AppBuilder UseConsoloniaBlazor(this AppBuilder builder, Action { - var lifetime = (IClassicDesktopStyleApplicationLifetime)Application.Current.ApplicationLifetime; + var lifetime = (IClassicDesktopStyleApplicationLifetime)Application.Current?.ApplicationLifetime; ArgumentNullException.ThrowIfNull(lifetime); return lifetime; }); From 03f04b4b19c5136ad6b6f8e1f23e3d6cddc1730b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 3 Dec 2024 19:56:14 +0000 Subject: [PATCH 12/21] Automated JetBrains cleanup Co-authored-by: <+@users.noreply.github.com> --- src/Consolonia.Blazor/BuilderExtensions.cs | 43 +++++++++++-------- .../ConsoloniaBlazorApplication.cs | 6 +-- src/Consolonia.Core/Helpers/Extensions.cs | 3 +- src/Example.Blazor.Components/MainPage.razor | 23 +++++++--- src/Example.Blazor.Components/SubPage.razor | 2 + src/Example.Blazor.Components/_Imports.razor | 20 ++++----- src/Example.Blazor/App.axaml | 13 +++--- src/Example.Blazor/Program.cs | 13 +++--- 8 files changed, 70 insertions(+), 53 deletions(-) diff --git a/src/Consolonia.Blazor/BuilderExtensions.cs b/src/Consolonia.Blazor/BuilderExtensions.cs index d3f3a688..18f55698 100644 --- a/src/Consolonia.Blazor/BuilderExtensions.cs +++ b/src/Consolonia.Blazor/BuilderExtensions.cs @@ -10,38 +10,45 @@ namespace Consolonia.Blazor public static class BuilderExtensions { /// - /// Use Consolonize in Blazor mode + /// Use Consolonize in Blazor mode /// /// /// /// - public static AppBuilder UseConsoloniaBlazor(this AppBuilder builder, Action configureServices = null) + public static AppBuilder UseConsoloniaBlazor(this AppBuilder builder, + Action configureServices = null) { return builder .UseConsolonia() - .UseAvaloniaBlazorBindings((sc) => + .UseAvaloniaBlazorBindings(sc => { // Register services for injectoin - sc.AddSingleton((_) => + sc.AddSingleton(_ => { - var lifetime = (IClassicDesktopStyleApplicationLifetime)Application.Current?.ApplicationLifetime; + var lifetime = + (IClassicDesktopStyleApplicationLifetime)Application.Current?.ApplicationLifetime; ArgumentNullException.ThrowIfNull(lifetime); return lifetime; }); - sc.AddTransient((sp) => sp.GetRequiredService().MainWindow?.StorageProvider); - sc.AddTransient((sp) => sp.GetRequiredService().MainWindow?.Clipboard); - sc.AddTransient((sp) => sp.GetRequiredService().MainWindow?.InsetsManager); - sc.AddTransient((sp) => sp.GetRequiredService().MainWindow?.InputPane); - sc.AddTransient((sp) => sp.GetRequiredService().MainWindow?.Launcher); - sc.AddTransient((sp) => sp.GetRequiredService().MainWindow?.Screens); - sc.AddTransient((sp) => sp.GetRequiredService().MainWindow?.FocusManager); - sc.AddTransient((sp) => sp.GetRequiredService().MainWindow?.PlatformSettings); + sc.AddTransient(sp => + sp.GetRequiredService().MainWindow?.StorageProvider); + sc.AddTransient(sp => + sp.GetRequiredService().MainWindow?.Clipboard); + sc.AddTransient(sp => + sp.GetRequiredService().MainWindow?.InsetsManager); + sc.AddTransient(sp => + sp.GetRequiredService().MainWindow?.InputPane); + sc.AddTransient(sp => + sp.GetRequiredService().MainWindow?.Launcher); + sc.AddTransient(sp => + sp.GetRequiredService().MainWindow?.Screens); + sc.AddTransient(sp => + sp.GetRequiredService().MainWindow?.FocusManager); + sc.AddTransient(sp => + sp.GetRequiredService().MainWindow?.PlatformSettings); - if (configureServices != null) - { - configureServices(sc); - } + if (configureServices != null) configureServices(sc); }); } } -} +} \ No newline at end of file diff --git a/src/Consolonia.Blazor/ConsoloniaBlazorApplication.cs b/src/Consolonia.Blazor/ConsoloniaBlazorApplication.cs index 8af53bab..3c8476b9 100644 --- a/src/Consolonia.Blazor/ConsoloniaBlazorApplication.cs +++ b/src/Consolonia.Blazor/ConsoloniaBlazorApplication.cs @@ -1,5 +1,5 @@ -using Avalonia.Input; using Avalonia; +using Avalonia.Input; using BlazorBindingsAvalonia; using Consolonia.Core.Helpers; using Consolonia.Core.Infrastructure; @@ -8,7 +8,7 @@ namespace Consolonia.Blazor { /// - /// Use this application as your app base class to use Consolonia.Blazor Blazor engine. + /// Use this application as your app base class to use Consolonia.Blazor Blazor engine. /// /// The root window for the application. public class ConsoloniaBlazorApplication : BlazorBindingsApplication @@ -29,4 +29,4 @@ public override void OnFrameworkInitializationCompleted() this.AddConsoloniaDesignMode(); } } -} +} \ No newline at end of file diff --git a/src/Consolonia.Core/Helpers/Extensions.cs b/src/Consolonia.Core/Helpers/Extensions.cs index 6bf249ef..d1497233 100644 --- a/src/Consolonia.Core/Helpers/Extensions.cs +++ b/src/Consolonia.Core/Helpers/Extensions.cs @@ -2,8 +2,8 @@ using System.Collections.Generic; using System.Text; using Avalonia; -using Avalonia.Controls.Primitives; using Avalonia.Controls; +using Avalonia.Controls.Primitives; using Avalonia.Media; using Avalonia.Reactive; using Avalonia.Styling; @@ -61,7 +61,6 @@ public static void AddConsoloniaDesignMode(this Application application) // } //}); } - } public static void Print(this IConsole console, PixelBufferCoordinate point, Pixel pixel) diff --git a/src/Example.Blazor.Components/MainPage.razor b/src/Example.Blazor.Components/MainPage.razor index 731be1cf..2fd90a00 100644 --- a/src/Example.Blazor.Components/MainPage.razor +++ b/src/Example.Blazor.Components/MainPage.razor @@ -5,7 +5,7 @@ @namespace Example.Blazor.Components - + @if (_showCounter) { Counter: @CounterText @@ -17,7 +17,7 @@ - + @code { @@ -27,20 +27,26 @@ string CounterText => _counter switch { 0 => "Not clicked", - 1 => $"Clicked 1 time", + 1 => "Clicked 1 time", _ => $"Clicked {_counter} times" }; string ToggleText => _showCounter ? "Hide Counter" : "Show Counter"; void OnIncrement() - => _counter++; + { + _counter++; + } void OnToggleCounter() - => _showCounter = !_showCounter; + { + _showCounter = !_showCounter; + } void OnGotoSubPage() - => Navigation.PushAsync(); + { + Navigation.PushAsync(); + } async void OnMessageBox(RoutedEventArgs args) { @@ -49,5 +55,8 @@ } void OnExit() - => Lifetime.Shutdown(); + { + Lifetime.Shutdown(); + } + } \ No newline at end of file diff --git a/src/Example.Blazor.Components/SubPage.razor b/src/Example.Blazor.Components/SubPage.razor index 33f102fc..1f589241 100644 --- a/src/Example.Blazor.Components/SubPage.razor +++ b/src/Example.Blazor.Components/SubPage.razor @@ -13,8 +13,10 @@ @code { + public async Task Back() { await Navigation.PopAsync(); } + } \ No newline at end of file diff --git a/src/Example.Blazor.Components/_Imports.razor b/src/Example.Blazor.Components/_Imports.razor index 7d3faa86..43b64544 100644 --- a/src/Example.Blazor.Components/_Imports.razor +++ b/src/Example.Blazor.Components/_Imports.razor @@ -6,19 +6,19 @@ @using Microsoft.AspNetCore.Components.RenderTree @using Microsoft.AspNetCore.Components.Routing @using Microsoft.AspNetCore.Components.Sections -@using A = global::Avalonia; -@using AL = global::Avalonia.Layout; -@using AC = global::Avalonia.Controls; -@using AM = global::Avalonia.Media -@using global::Avalonia; -@using global::Avalonia.Controls; -@using global::Avalonia.Interactivity -@using global::Avalonia.Layout; -@using global::Avalonia.Media +@using A = Avalonia; +@using AL = Avalonia.Layout; +@using AC = Avalonia.Controls; +@using AM = Avalonia.Media +@using Avalonia; +@using Avalonia.Controls; +@using Avalonia.Interactivity +@using Avalonia.Layout; +@using Avalonia.Media @using Avalonia.Controls.ApplicationLifetimes @using BlazorBindings.Core; @using BlazorBindingsAvalonia @using BlazorBindingsAvalonia.Elements @using BlazorBindingsAvalonia.Elements.Shapes @using BlazorBindingsAvalonia.Extensions -@using Consolonia.Core.Controls +@using Consolonia.Core.Controls \ No newline at end of file diff --git a/src/Example.Blazor/App.axaml b/src/Example.Blazor/App.axaml index de0ce36a..83542b7c 100644 --- a/src/Example.Blazor/App.axaml +++ b/src/Example.Blazor/App.axaml @@ -1,10 +1,9 @@ - + diff --git a/src/Example.Blazor/Program.cs b/src/Example.Blazor/Program.cs index d562621d..e62f5698 100644 --- a/src/Example.Blazor/Program.cs +++ b/src/Example.Blazor/Program.cs @@ -17,10 +17,11 @@ private static void Main(string[] args) } public static AppBuilder BuildAvaloniaApp() - => AppBuilder.Configure() - .UseConsoloniaBlazor() - .UseAutoDetectedConsole() - .LogToException() -; + { + return AppBuilder.Configure() + .UseConsoloniaBlazor() + .UseAutoDetectedConsole() + .LogToException(); + } } -} +} \ No newline at end of file From e96595731a30805ac4d8e465d3b4d4dbd97781b7 Mon Sep 17 00:00:00 2001 From: Tom Laird-McConnell Date: Fri, 6 Dec 2024 17:37:56 -0800 Subject: [PATCH 13/21] remove extra packages references. Rest of package cleanup is in the Packages PR --- .gitignore | 1 + Directory.Build.props | 2 +- src/Consolonia.Blazor/Consolonia.Blazor.csproj | 1 - .../ConsoloniaNotSupportedException.cs | 1 - src/Consolonia.Designer/ConsolePreview.cs | 11 ----------- src/Consolonia.Designer/Consolonia.Designer.csproj | 8 +++----- src/Consolonia.Designer/Extensions.cs | 4 +--- src/Consolonia.Gallery/Consolonia.Gallery.csproj | 1 - src/Consolonia.Gallery/Program.cs | 5 ----- src/Consolonia.NUnit/Consolonia.NUnit.csproj | 1 - .../Consolonia.PlatformSupport.csproj | 5 ----- .../Example.Blazor.Components.csproj | 7 +++---- src/Example.Blazor/Example.Blazor.csproj | 6 ------ src/Tools/Consolonia.PreviewHost/App.axaml.cs | 7 ++++++- .../Properties/launchSettings.json | 13 ------------- 15 files changed, 15 insertions(+), 58 deletions(-) delete mode 100644 src/Tools/Consolonia.PreviewHost/Properties/launchSettings.json diff --git a/.gitignore b/.gitignore index 03d170b3..1cff3edc 100644 --- a/.gitignore +++ b/.gitignore @@ -766,3 +766,4 @@ fabric.properties .idea/ *.sln.iml +/src/Tools/Consolonia.PreviewHost/Properties/launchSettings.json diff --git a/Directory.Build.props b/Directory.Build.props index 4190adb6..b4360b68 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -5,7 +5,7 @@ disable - 11.2 + 11.2.1 https://github.com/jinek/Consolonia/graphs/contributors Text User Interface implementation of Avalonia UI (GUI Framework) Copyright © Evgeny Gorbovoy 2021 - 2022 diff --git a/src/Consolonia.Blazor/Consolonia.Blazor.csproj b/src/Consolonia.Blazor/Consolonia.Blazor.csproj index f6c1dc62..a63a5e60 100644 --- a/src/Consolonia.Blazor/Consolonia.Blazor.csproj +++ b/src/Consolonia.Blazor/Consolonia.Blazor.csproj @@ -10,6 +10,5 @@ - diff --git a/src/Consolonia.Core/Infrastructure/ConsoloniaNotSupportedException.cs b/src/Consolonia.Core/Infrastructure/ConsoloniaNotSupportedException.cs index d71b502b..f750627e 100644 --- a/src/Consolonia.Core/Infrastructure/ConsoloniaNotSupportedException.cs +++ b/src/Consolonia.Core/Infrastructure/ConsoloniaNotSupportedException.cs @@ -2,7 +2,6 @@ namespace Consolonia.Core.Infrastructure { - [Serializable] public class ConsoloniaNotSupportedException : Exception { internal ConsoloniaNotSupportedException(NotSupportedRequest request) diff --git a/src/Consolonia.Designer/ConsolePreview.cs b/src/Consolonia.Designer/ConsolePreview.cs index 92a40bb9..5be89b3e 100644 --- a/src/Consolonia.Designer/ConsolePreview.cs +++ b/src/Consolonia.Designer/ConsolePreview.cs @@ -2,7 +2,6 @@ using Avalonia; using Avalonia.Controls; -#if DEBUG using Consolonia.PreviewHost; using System; using System.Diagnostics; @@ -15,7 +14,6 @@ using Avalonia.Threading; using Consolonia.Core.Drawing.PixelBufferImplementation; using Newtonsoft.Json; -#endif namespace Consolonia.Designer { @@ -45,7 +43,6 @@ public class ConsolePreview : UserControl public ConsolePreview() { -#if DEBUG _process = null; FontFamily = FontFamily.Parse("Cascadia Mono"); Initialized += (_, _) => LoadXaml(); @@ -54,7 +51,6 @@ public ConsolePreview() { if (e.Property == FileNameProperty) LoadXaml(); }; -#endif } @@ -102,7 +98,6 @@ protected void Dispose(bool disposing) if (disposing) { // TODO: dispose managed state (managed objects) -#if DEBUG #pragma warning disable CA1416 // Validate platform compatibility if (_process != null) { @@ -111,7 +106,6 @@ protected void Dispose(bool disposing) _process = null; } #pragma warning restore CA1416 // Validate platform compatibility -#endif } _disposedValue = true; @@ -125,14 +119,10 @@ public void Dispose() Dispose(true); } -#if DEBUG private Process? _process; private readonly Typeface _typeface = new("Cascadia Mono"); private double _charWidth; private double _charHeight; -#endif - -#if DEBUG private void LoadXaml() { @@ -451,6 +441,5 @@ public void Flush() _textRunCharWidth = 0; } } -#endif } } \ No newline at end of file diff --git a/src/Consolonia.Designer/Consolonia.Designer.csproj b/src/Consolonia.Designer/Consolonia.Designer.csproj index 469b3e80..8a103035 100644 --- a/src/Consolonia.Designer/Consolonia.Designer.csproj +++ b/src/Consolonia.Designer/Consolonia.Designer.csproj @@ -5,16 +5,14 @@ - - + + - - - + diff --git a/src/Consolonia.Designer/Extensions.cs b/src/Consolonia.Designer/Extensions.cs index e6722a4d..12cfb558 100644 --- a/src/Consolonia.Designer/Extensions.cs +++ b/src/Consolonia.Designer/Extensions.cs @@ -19,13 +19,11 @@ public static class Extensions /// public static AppBuilder UseConsoloniaDesigner(this AppBuilder builder) { -#if DEBUG - if (Design.IsDesignMode) //AppDomain.CurrentDomain.FriendlyName == "Avalonia.Designer.HostApp") + if (Design.IsDesignMode) return builder .UsePlatformDetect() .WithInterFont() .LogToTrace(); -#endif return builder.UseConsolonia(); } diff --git a/src/Consolonia.Gallery/Consolonia.Gallery.csproj b/src/Consolonia.Gallery/Consolonia.Gallery.csproj index e3f51ac4..ddd3e7a5 100644 --- a/src/Consolonia.Gallery/Consolonia.Gallery.csproj +++ b/src/Consolonia.Gallery/Consolonia.Gallery.csproj @@ -13,7 +13,6 @@ - diff --git a/src/Consolonia.Gallery/Program.cs b/src/Consolonia.Gallery/Program.cs index eb90f436..a02af67c 100644 --- a/src/Consolonia.Gallery/Program.cs +++ b/src/Consolonia.Gallery/Program.cs @@ -2,7 +2,6 @@ using Avalonia; using Consolonia.Core; using Consolonia.Core.Infrastructure; -using Consolonia.Designer; using Consolonia.PlatformSupport; namespace Consolonia.Gallery @@ -19,11 +18,7 @@ private static void Main(string[] args) public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure() -#if DEBUG - .UseConsoloniaDesigner() -#else .UseConsolonia() -#endif .UseAutoDetectedConsole() .LogToException(); } diff --git a/src/Consolonia.NUnit/Consolonia.NUnit.csproj b/src/Consolonia.NUnit/Consolonia.NUnit.csproj index 620824ed..dae1791f 100644 --- a/src/Consolonia.NUnit/Consolonia.NUnit.csproj +++ b/src/Consolonia.NUnit/Consolonia.NUnit.csproj @@ -7,7 +7,6 @@ - diff --git a/src/Consolonia.PlatformSupport/Consolonia.PlatformSupport.csproj b/src/Consolonia.PlatformSupport/Consolonia.PlatformSupport.csproj index 4b1ec17c..e5021693 100644 --- a/src/Consolonia.PlatformSupport/Consolonia.PlatformSupport.csproj +++ b/src/Consolonia.PlatformSupport/Consolonia.PlatformSupport.csproj @@ -1,11 +1,6 @@ - - - - - diff --git a/src/Example.Blazor.Components/Example.Blazor.Components.csproj b/src/Example.Blazor.Components/Example.Blazor.Components.csproj index 20424284..9c058741 100644 --- a/src/Example.Blazor.Components/Example.Blazor.Components.csproj +++ b/src/Example.Blazor.Components/Example.Blazor.Components.csproj @@ -7,10 +7,9 @@ - - - - + + + diff --git a/src/Example.Blazor/Example.Blazor.csproj b/src/Example.Blazor/Example.Blazor.csproj index c47a0b5b..8877968a 100644 --- a/src/Example.Blazor/Example.Blazor.csproj +++ b/src/Example.Blazor/Example.Blazor.csproj @@ -7,12 +7,6 @@ enable - - - - - - diff --git a/src/Tools/Consolonia.PreviewHost/App.axaml.cs b/src/Tools/Consolonia.PreviewHost/App.axaml.cs index 64724bb2..1fa0f380 100644 --- a/src/Tools/Consolonia.PreviewHost/App.axaml.cs +++ b/src/Tools/Consolonia.PreviewHost/App.axaml.cs @@ -37,7 +37,12 @@ public override void OnFrameworkInitializationCompleted() { string folder; if (Path.IsPathFullyQualified(path)) - folder = Path.GetDirectoryName(path)!; + { + if (Directory.Exists(path)) + folder = path; + else + folder = Path.GetDirectoryName(path)!; + } else folder = Environment.CurrentDirectory; ArgumentNullException.ThrowIfNull(folder); diff --git a/src/Tools/Consolonia.PreviewHost/Properties/launchSettings.json b/src/Tools/Consolonia.PreviewHost/Properties/launchSettings.json deleted file mode 100644 index 75d4abbf..00000000 --- a/src/Tools/Consolonia.PreviewHost/Properties/launchSettings.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "profiles": { - "WSL": { - "commandName": "WSL2", - "distributionName": "" - }, - "Consolonia.PreviewHost": { - "commandName": "Project", - "commandLineArgs": ".", - "workingDirectory": "S:\\github\\Consolonia\\src\\Consolonia.Gallery" - } - } -} \ No newline at end of file From 9cce291b839efc0bef8747528a7c284f324c15aa Mon Sep 17 00:00:00 2001 From: Tom Laird-McConnell Date: Fri, 6 Dec 2024 17:45:22 -0800 Subject: [PATCH 14/21] disable resharper --- .../Infrastructure/ConsoloniaNotSupportedException.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Consolonia.Core/Infrastructure/ConsoloniaNotSupportedException.cs b/src/Consolonia.Core/Infrastructure/ConsoloniaNotSupportedException.cs index f750627e..16775ec3 100644 --- a/src/Consolonia.Core/Infrastructure/ConsoloniaNotSupportedException.cs +++ b/src/Consolonia.Core/Infrastructure/ConsoloniaNotSupportedException.cs @@ -8,7 +8,7 @@ internal ConsoloniaNotSupportedException(NotSupportedRequest request) { Request = request; } - + // ReSharper disable once UnusedAutoPropertyAccessor.Global public NotSupportedRequest Request { get; } } } \ No newline at end of file From 9328751b3cd427c9df1ae5df621eabbc083c40f3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 7 Dec 2024 01:51:35 +0000 Subject: [PATCH 15/21] Automated JetBrains cleanup Co-authored-by: <+@users.noreply.github.com> --- .../ConsoloniaNotSupportedException.cs | 1 + src/Consolonia.Designer/ConsolePreview.cs | 17 +++++++++-------- src/Consolonia.Designer/Extensions.cs | 2 +- src/Tools/Consolonia.PreviewHost/App.axaml.cs | 3 +++ 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/Consolonia.Core/Infrastructure/ConsoloniaNotSupportedException.cs b/src/Consolonia.Core/Infrastructure/ConsoloniaNotSupportedException.cs index 16775ec3..4f87d2ff 100644 --- a/src/Consolonia.Core/Infrastructure/ConsoloniaNotSupportedException.cs +++ b/src/Consolonia.Core/Infrastructure/ConsoloniaNotSupportedException.cs @@ -8,6 +8,7 @@ internal ConsoloniaNotSupportedException(NotSupportedRequest request) { Request = request; } + // ReSharper disable once UnusedAutoPropertyAccessor.Global public NotSupportedRequest Request { get; } } diff --git a/src/Consolonia.Designer/ConsolePreview.cs b/src/Consolonia.Designer/ConsolePreview.cs index 5be89b3e..9967c811 100644 --- a/src/Consolonia.Designer/ConsolePreview.cs +++ b/src/Consolonia.Designer/ConsolePreview.cs @@ -1,18 +1,18 @@ #nullable enable -using Avalonia; -using Avalonia.Controls; -using Consolonia.PreviewHost; using System; using System.Diagnostics; using System.IO; using System.Text; using System.Threading.Tasks; +using Avalonia; +using Avalonia.Controls; using Avalonia.Layout; using Avalonia.Media; using Avalonia.Media.TextFormatting; using Avalonia.Threading; using Consolonia.Core.Drawing.PixelBufferImplementation; +using Consolonia.PreviewHost; using Newtonsoft.Json; namespace Consolonia.Designer @@ -39,8 +39,14 @@ public class ConsolePreview : UserControl public static readonly StyledProperty MonitorChangesProperty = AvaloniaProperty.Register(nameof(MonitorChanges)); + private readonly Typeface _typeface = new("Cascadia Mono"); + private double _charHeight; + private double _charWidth; + private bool _disposedValue; + private Process? _process; + public ConsolePreview() { _process = null; @@ -119,11 +125,6 @@ public void Dispose() Dispose(true); } - private Process? _process; - private readonly Typeface _typeface = new("Cascadia Mono"); - private double _charWidth; - private double _charHeight; - private void LoadXaml() { string xamlPath; diff --git a/src/Consolonia.Designer/Extensions.cs b/src/Consolonia.Designer/Extensions.cs index 12cfb558..9de4078f 100644 --- a/src/Consolonia.Designer/Extensions.cs +++ b/src/Consolonia.Designer/Extensions.cs @@ -19,7 +19,7 @@ public static class Extensions /// public static AppBuilder UseConsoloniaDesigner(this AppBuilder builder) { - if (Design.IsDesignMode) + if (Design.IsDesignMode) return builder .UsePlatformDetect() .WithInterFont() diff --git a/src/Tools/Consolonia.PreviewHost/App.axaml.cs b/src/Tools/Consolonia.PreviewHost/App.axaml.cs index 1fa0f380..81f613be 100644 --- a/src/Tools/Consolonia.PreviewHost/App.axaml.cs +++ b/src/Tools/Consolonia.PreviewHost/App.axaml.cs @@ -44,7 +44,10 @@ public override void OnFrameworkInitializationCompleted() folder = Path.GetDirectoryName(path)!; } else + { folder = Environment.CurrentDirectory; + } + ArgumentNullException.ThrowIfNull(folder); string projectFile = FindProjectFileFromPath(folder); From c25169acbe6f21132188c4ef260b289f6dced0c9 Mon Sep 17 00:00:00 2001 From: Tom Laird-McConnell Date: Sat, 7 Dec 2024 20:30:20 -0800 Subject: [PATCH 16/21] merge fixes --- src/Consolonia.Blazor/BuilderExtensions.cs | 3 +-- .../Consolonia.Blazor.csproj | 2 +- .../Infrastructure/ConsoloniaApplication.cs | 21 ++++++++++++++++++- src/Consolonia.Gallery/App.cs | 1 - .../Example.Blazor.Components.csproj | 3 --- src/Example.Blazor/App.axaml | 2 +- src/Example.Blazor/Example.Blazor.csproj | 2 -- src/Example.Blazor/Program.cs | 5 +---- src/Example/App.cs | 2 +- 9 files changed, 25 insertions(+), 16 deletions(-) diff --git a/src/Consolonia.Blazor/BuilderExtensions.cs b/src/Consolonia.Blazor/BuilderExtensions.cs index 18f55698..4f506250 100644 --- a/src/Consolonia.Blazor/BuilderExtensions.cs +++ b/src/Consolonia.Blazor/BuilderExtensions.cs @@ -2,10 +2,9 @@ using Avalonia; using Avalonia.Controls.ApplicationLifetimes; using BlazorBindingsAvalonia; -using Consolonia.Core; using Microsoft.Extensions.DependencyInjection; -namespace Consolonia.Blazor +namespace Consolonia { public static class BuilderExtensions { diff --git a/src/Consolonia.Blazor/Consolonia.Blazor.csproj b/src/Consolonia.Blazor/Consolonia.Blazor.csproj index a63a5e60..1fe597d0 100644 --- a/src/Consolonia.Blazor/Consolonia.Blazor.csproj +++ b/src/Consolonia.Blazor/Consolonia.Blazor.csproj @@ -3,7 +3,7 @@ - + diff --git a/src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs b/src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs index 852dbbdf..e3636bb7 100644 --- a/src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs +++ b/src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs @@ -1,9 +1,12 @@ using System; using Avalonia; +using Avalonia.Controls; +using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Input; using Consolonia.Core.Helpers; +using Consolonia.Core.Infrastructure; -namespace Consolonia.Core.Infrastructure +namespace Consolonia { public class ConsoloniaApplication : Application { @@ -22,4 +25,20 @@ public override void OnFrameworkInitializationCompleted() this.AddConsoloniaDesignMode(); } } + + public class ConsoloniaApplication : ConsoloniaApplication + where TMainWindow : Window, new() + { + public override void OnFrameworkInitializationCompleted() + { + if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) + { + var window = Activator.CreateInstance(); + ArgumentNullException.ThrowIfNull(window, typeof(TMainWindow).Name); + desktop.MainWindow = window; + } + + base.OnFrameworkInitializationCompleted(); + } + } } \ No newline at end of file diff --git a/src/Consolonia.Gallery/App.cs b/src/Consolonia.Gallery/App.cs index 6d9cfccd..3f594b7a 100644 --- a/src/Consolonia.Gallery/App.cs +++ b/src/Consolonia.Gallery/App.cs @@ -1,6 +1,5 @@ using System.Globalization; using System.Threading; -using Consolonia.Core.Infrastructure; using Consolonia.Gallery.View; using Consolonia.Themes; diff --git a/src/Example.Blazor.Components/Example.Blazor.Components.csproj b/src/Example.Blazor.Components/Example.Blazor.Components.csproj index 9c058741..e022ea6b 100644 --- a/src/Example.Blazor.Components/Example.Blazor.Components.csproj +++ b/src/Example.Blazor.Components/Example.Blazor.Components.csproj @@ -8,9 +8,6 @@ - - - diff --git a/src/Example.Blazor/App.axaml b/src/Example.Blazor/App.axaml index 83542b7c..8c471670 100644 --- a/src/Example.Blazor/App.axaml +++ b/src/Example.Blazor/App.axaml @@ -2,7 +2,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="Example.Blazor.App" xmlns:local="using:Example.Blazor" - xmlns:theme="clr-namespace:Consolonia.Themes.TurboVision.Themes.Material;assembly=Consolonia.Themes.TurboVision" + xmlns:theme="clr-namespace:Consolonia.Themes;assembly=Consolonia.Themes" RequestedThemeVariant="Default"> diff --git a/src/Example.Blazor/Example.Blazor.csproj b/src/Example.Blazor/Example.Blazor.csproj index 8877968a..4882e64b 100644 --- a/src/Example.Blazor/Example.Blazor.csproj +++ b/src/Example.Blazor/Example.Blazor.csproj @@ -9,8 +9,6 @@ - - diff --git a/src/Example.Blazor/Program.cs b/src/Example.Blazor/Program.cs index e62f5698..22ae1aa3 100644 --- a/src/Example.Blazor/Program.cs +++ b/src/Example.Blazor/Program.cs @@ -1,8 +1,5 @@ using Avalonia; -using Consolonia.Blazor; -using Consolonia.Core; -using Consolonia.Core.Infrastructure; -using Consolonia.PlatformSupport; +using Consolonia; namespace Example.Blazor { diff --git a/src/Example/App.cs b/src/Example/App.cs index 0aa85663..46f087d3 100644 --- a/src/Example/App.cs +++ b/src/Example/App.cs @@ -1,4 +1,4 @@ -using Consolonia.Core.Infrastructure; +using Consolonia; using Consolonia.Themes; using Example.Views; From caf0951f92891c254283c6dcb27d67e423e812cd Mon Sep 17 00:00:00 2001 From: Tom Laird-McConnell Date: Sat, 7 Dec 2024 20:34:18 -0800 Subject: [PATCH 17/21] cleanup namespaces --- src/Consolonia.Blazor/Consolonia.Blazor.csproj | 1 - src/Example.Blazor.Components/Example.Blazor.Components.csproj | 1 + src/Example.Blazor/Example.Blazor.csproj | 1 + src/Tools/Consolonia.PreviewHost/App.cs | 1 - 4 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Consolonia.Blazor/Consolonia.Blazor.csproj b/src/Consolonia.Blazor/Consolonia.Blazor.csproj index 1fe597d0..1a282d4f 100644 --- a/src/Consolonia.Blazor/Consolonia.Blazor.csproj +++ b/src/Consolonia.Blazor/Consolonia.Blazor.csproj @@ -1,5 +1,4 @@ - diff --git a/src/Example.Blazor.Components/Example.Blazor.Components.csproj b/src/Example.Blazor.Components/Example.Blazor.Components.csproj index e022ea6b..263703cd 100644 --- a/src/Example.Blazor.Components/Example.Blazor.Components.csproj +++ b/src/Example.Blazor.Components/Example.Blazor.Components.csproj @@ -4,6 +4,7 @@ net8.0 enable enable + False diff --git a/src/Example.Blazor/Example.Blazor.csproj b/src/Example.Blazor/Example.Blazor.csproj index 4882e64b..4dee0d7c 100644 --- a/src/Example.Blazor/Example.Blazor.csproj +++ b/src/Example.Blazor/Example.Blazor.csproj @@ -5,6 +5,7 @@ net8.0 enable enable + False diff --git a/src/Tools/Consolonia.PreviewHost/App.cs b/src/Tools/Consolonia.PreviewHost/App.cs index e57045b3..fc0f3a7d 100644 --- a/src/Tools/Consolonia.PreviewHost/App.cs +++ b/src/Tools/Consolonia.PreviewHost/App.cs @@ -1,6 +1,5 @@ using System.Globalization; using Avalonia.Controls.ApplicationLifetimes; -using Consolonia.Core.Infrastructure; using Consolonia.PreviewHost.ViewModels; using Consolonia.PreviewHost.Views; using Consolonia.Themes; From eeec29c7f3a55641658d191b94f21aff90d8531e Mon Sep 17 00:00:00 2001 From: Tom Laird-McConnell Date: Sat, 7 Dec 2024 20:40:12 -0800 Subject: [PATCH 18/21] remove IsPackable as default build props marks assemblies as not packable --- Directory.Build.props | 1 + src/Consolonia.Blazor/README.md | 83 +++++++++++++++++-- .../Consolonia.Gallery.csproj | 1 - src/Consolonia.GuiCS/Consolonia.GuiCS.csproj | 1 - .../Example.Blazor.Components.csproj | 1 - src/Example.Blazor/Example.Blazor.csproj | 1 - src/Example/Example.csproj | 1 - .../Consolonia.Core.Tests.csproj | 7 -- .../Consolonia.Gallery.Tests.csproj | 4 - 9 files changed, 76 insertions(+), 24 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 33527dbb..54a627a0 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -11,6 +11,7 @@ Copyright © Evgeny Gorbovoy 2021 - 2022 Icon.png AVA3001 + False 11.2.1 diff --git a/src/Consolonia.Blazor/README.md b/src/Consolonia.Blazor/README.md index 92292772..811e1b4b 100644 --- a/src/Consolonia.Blazor/README.md +++ b/src/Consolonia.Blazor/README.md @@ -1,14 +1,81 @@ -# Consolonia UI +# Consolonia.Blazor +This package provides the ability to use Blazor .razor files to create Consolonia applications. +* Use [⚡ Blazor](https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blazor) syntax for [Avalonia](https://avaloniaui.net/) apps +* 😎 Simpler syntax than XAML +* 🪄 IntelliSense support +* Get free [🔥 Hot Reload](https://devblogs.microsoft.com/dotnet/introducing-net-hot-reload/) support on-top +* See https://github.com/Epictek/Avalonia-Blazor-Bindings -TUI (Text User Interface) (GUI Framework) implementation for [Avalonia UI](https://github.com/AvaloniaUI) - -Supports XAML, data bindings, animation, styling and the rest from Avalonia. - -> Project is in proof of concept state and is looking for collaboration. +## Background +Consolonia is a TUI (Text User Interface) (GUI Framework) implementation for [Avalonia UI](https://github.com/AvaloniaUI) ## Showcase (click picture to see video) [![datagridpic](https://user-images.githubusercontent.com/10516222/141980173-4eb4057a-6996-45bf-83f6-931316c98d88.png)](https://youtu.be/ttgZmbruk3Y) -Example of usage: https://github.com/jinek/ToolUI -Solution contains one more readme file with coding information. +## Example Razor file +Things to note: +* Method binding to code behind +* Conditional layout of elements +* Full intellisense for renaming going to code behind autocomplete etc. +* injection of **INavigation** so you can push and pop views off of the nav stack +* injection of **IClassicDesktopStyleApplicationLifetime** so you can access Args and shutdown the app. +* HOT RELOAD. simple save the file and your view gets rebuilt and rerendered! + +![blazor](https://github.com/user-attachments/assets/ae1ba484-b3a9-46c6-8c1b-99026e7f924c) + +```razor +@page "/" +@inject INavigation navigation +@inject IClassicDesktopStyleApplicationLifetime lifetime + +@namespace Example.Blazor.Components + + + + @if (showCounter) + { + Counter: @CounterText + } + + + + + + + + + + +@code { + int counter = 0; + bool showCounter = true; + + string CounterText => counter switch + { + 0 => "Not clicked", + 1 => $"Clicked 1 time", + _ => $"Clicked {counter} times" + }; + + string ToggleText => showCounter ? "Hide Counter" : "Show Counter"; + + void OnIncrement() + => counter++; + + void OnToggleCounter() + => showCounter = !showCounter; + + void OnGotoSubPage() + => navigation.PushAsync(); + + async void OnMessageBox(RoutedEventArgs args) + { + await new MessageBox() + .ShowDialogAsync((AC.Control)args.Source!, "Hello, Blazor!", "Blazor Bindings for Consolonia"); + } + + void OnExit() + => lifetime.Shutdown(); +} +``` diff --git a/src/Consolonia.Gallery/Consolonia.Gallery.csproj b/src/Consolonia.Gallery/Consolonia.Gallery.csproj index 3bb77c69..c96afa22 100644 --- a/src/Consolonia.Gallery/Consolonia.Gallery.csproj +++ b/src/Consolonia.Gallery/Consolonia.Gallery.csproj @@ -2,7 +2,6 @@ Exe - False diff --git a/src/Consolonia.GuiCS/Consolonia.GuiCS.csproj b/src/Consolonia.GuiCS/Consolonia.GuiCS.csproj index e0834556..5173a009 100644 --- a/src/Consolonia.GuiCS/Consolonia.GuiCS.csproj +++ b/src/Consolonia.GuiCS/Consolonia.GuiCS.csproj @@ -4,7 +4,6 @@ false false false - false diff --git a/src/Example.Blazor.Components/Example.Blazor.Components.csproj b/src/Example.Blazor.Components/Example.Blazor.Components.csproj index 263703cd..e022ea6b 100644 --- a/src/Example.Blazor.Components/Example.Blazor.Components.csproj +++ b/src/Example.Blazor.Components/Example.Blazor.Components.csproj @@ -4,7 +4,6 @@ net8.0 enable enable - False diff --git a/src/Example.Blazor/Example.Blazor.csproj b/src/Example.Blazor/Example.Blazor.csproj index 4dee0d7c..4882e64b 100644 --- a/src/Example.Blazor/Example.Blazor.csproj +++ b/src/Example.Blazor/Example.Blazor.csproj @@ -5,7 +5,6 @@ net8.0 enable enable - False diff --git a/src/Example/Example.csproj b/src/Example/Example.csproj index abe69091..76ebb073 100644 --- a/src/Example/Example.csproj +++ b/src/Example/Example.csproj @@ -1,7 +1,6 @@ Exe - False Example diff --git a/src/Tests/Consolonia.Core.Tests/Consolonia.Core.Tests.csproj b/src/Tests/Consolonia.Core.Tests/Consolonia.Core.Tests.csproj index 15b69440..15ab14c7 100644 --- a/src/Tests/Consolonia.Core.Tests/Consolonia.Core.Tests.csproj +++ b/src/Tests/Consolonia.Core.Tests/Consolonia.Core.Tests.csproj @@ -1,12 +1,5 @@ - - - - false - - - diff --git a/src/Tests/Consolonia.Gallery.Tests/Consolonia.Gallery.Tests.csproj b/src/Tests/Consolonia.Gallery.Tests/Consolonia.Gallery.Tests.csproj index 8715e73d..22702d8c 100644 --- a/src/Tests/Consolonia.Gallery.Tests/Consolonia.Gallery.Tests.csproj +++ b/src/Tests/Consolonia.Gallery.Tests/Consolonia.Gallery.Tests.csproj @@ -1,9 +1,5 @@ - - false - - From b432ede80344e37699564f1c25d40c24126a076f Mon Sep 17 00:00:00 2001 From: Tom Laird-McConnell Date: Sat, 7 Dec 2024 20:41:23 -0800 Subject: [PATCH 19/21] fix namespace resharper --- src/Consolonia.Blazor/BuilderExtensions.cs | 1 + src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Consolonia.Blazor/BuilderExtensions.cs b/src/Consolonia.Blazor/BuilderExtensions.cs index 4f506250..9a73b43a 100644 --- a/src/Consolonia.Blazor/BuilderExtensions.cs +++ b/src/Consolonia.Blazor/BuilderExtensions.cs @@ -4,6 +4,7 @@ using BlazorBindingsAvalonia; using Microsoft.Extensions.DependencyInjection; +// ReSharper disable once CheckNamespace namespace Consolonia { public static class BuilderExtensions diff --git a/src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs b/src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs index e3636bb7..728947af 100644 --- a/src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs +++ b/src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs @@ -6,6 +6,7 @@ using Consolonia.Core.Helpers; using Consolonia.Core.Infrastructure; +// ReSharper disable once CheckNamespace namespace Consolonia { public class ConsoloniaApplication : Application From 5e45af33ea8fac0328b8f0c4bc651e77a446b12f Mon Sep 17 00:00:00 2001 From: Tom Laird-McConnell Date: Sat, 7 Dec 2024 20:44:09 -0800 Subject: [PATCH 20/21] remove net8 hardcoded value --- src/Example.Blazor.Components/Example.Blazor.Components.csproj | 1 - src/Example.Blazor/Example.Blazor.csproj | 1 - 2 files changed, 2 deletions(-) diff --git a/src/Example.Blazor.Components/Example.Blazor.Components.csproj b/src/Example.Blazor.Components/Example.Blazor.Components.csproj index e022ea6b..94a59e1a 100644 --- a/src/Example.Blazor.Components/Example.Blazor.Components.csproj +++ b/src/Example.Blazor.Components/Example.Blazor.Components.csproj @@ -1,7 +1,6 @@ - net8.0 enable enable diff --git a/src/Example.Blazor/Example.Blazor.csproj b/src/Example.Blazor/Example.Blazor.csproj index 4882e64b..d0f933a9 100644 --- a/src/Example.Blazor/Example.Blazor.csproj +++ b/src/Example.Blazor/Example.Blazor.csproj @@ -2,7 +2,6 @@ Exe - net8.0 enable enable From b4c31e675f4d01feb63ca727a9646c30c9f15be5 Mon Sep 17 00:00:00 2001 From: Tom Laird-McConnell Date: Sat, 7 Dec 2024 20:49:40 -0800 Subject: [PATCH 21/21] fix unit test regression --- .../Consolonia.Core.Tests/Consolonia.Core.Tests.csproj | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Tests/Consolonia.Core.Tests/Consolonia.Core.Tests.csproj b/src/Tests/Consolonia.Core.Tests/Consolonia.Core.Tests.csproj index 15ab14c7..6b5d1c10 100644 --- a/src/Tests/Consolonia.Core.Tests/Consolonia.Core.Tests.csproj +++ b/src/Tests/Consolonia.Core.Tests/Consolonia.Core.Tests.csproj @@ -1,4 +1,10 @@ + + + + + false +