From 2164a90f44c213d680758f0ad1c3ae0fff16cc61 Mon Sep 17 00:00:00 2001 From: SKProCH <29896317+SKProCH@users.noreply.github.com> Date: Mon, 18 Sep 2023 05:39:49 +0300 Subject: [PATCH] Update ci-build and fix fsharp project (#65) * Update ci-build.yml * Update ci-build.yml * Trying to fix fsharp project. I have no idea what I'm doing, but apparently it seems like everything works. --- .github/workflows/ci-build.yml | 2 +- Directory.build.props | 2 +- .../Live.Avalonia.FuncUI.Sample.fsproj | 8 ++++---- Live.Avalonia.FuncUI.Sample/Program.fs | 13 ++++++++----- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 4232e49..aa5fde6 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -26,7 +26,7 @@ jobs: - name: Install .NET Core uses: actions/setup-dotnet@v1 with: - dotnet-version: 5.0.100-rc.2.20479.15 + dotnet-version: 6.0.* - name: NBGV id: nbgv diff --git a/Directory.build.props b/Directory.build.props index 5ff1ae4..d5a90d0 100644 --- a/Directory.build.props +++ b/Directory.build.props @@ -22,7 +22,7 @@ 11.0.0 - 0.5.0-beta + 1.0.1 \ No newline at end of file diff --git a/Live.Avalonia.FuncUI.Sample/Live.Avalonia.FuncUI.Sample.fsproj b/Live.Avalonia.FuncUI.Sample/Live.Avalonia.FuncUI.Sample.fsproj index 1f7861f..d28a0ad 100644 --- a/Live.Avalonia.FuncUI.Sample/Live.Avalonia.FuncUI.Sample.fsproj +++ b/Live.Avalonia.FuncUI.Sample/Live.Avalonia.FuncUI.Sample.fsproj @@ -3,7 +3,7 @@ WinExe false - netcoreapp3.1 + net6.0 @@ -18,10 +18,10 @@ + - - - + + diff --git a/Live.Avalonia.FuncUI.Sample/Program.fs b/Live.Avalonia.FuncUI.Sample/Program.fs index 79a2f73..18bc57d 100644 --- a/Live.Avalonia.FuncUI.Sample/Program.fs +++ b/Live.Avalonia.FuncUI.Sample/Program.fs @@ -3,6 +3,7 @@ open System open System.Text.Json open System.Text.Json.Serialization +open Avalonia.Themes.Fluent open Elmish open Avalonia open Avalonia.Controls @@ -10,7 +11,6 @@ open Avalonia.Controls.ApplicationLifetimes open Live.Avalonia open Avalonia.FuncUI open Avalonia.FuncUI.Elmish -open Avalonia.FuncUI.Components.Hosts let transferState<'t> oldState = let jsonOptions = JsonSerializerOptions() @@ -34,7 +34,7 @@ let isProduction = #endif type MainControl(window: Window) as this = - inherit HostControl() + inherit Hosts.HostControl() do // Instead of just creating default init state, try to recover state from window.DataContext let hotInit () = @@ -47,7 +47,11 @@ type MainControl(window: Window) as this = Elmish.Program.mkSimple hotInit Counter.update Counter.view |> Program.withHost this // Every time state changes, save state to window.DataContext - |> Program.withTrace (fun _ state -> window.DataContext <- state) + |> Program.withTrace (fun model state -> + let setDataContext (subIds: SubId list) = + window.DataContext <- state + () // return unit + setDataContext) |> Program.run @@ -59,8 +63,7 @@ type App() = MainControl(window) :> obj override this.Initialize() = - this.Styles.Load "avares://Avalonia.Themes.Default/DefaultTheme.xaml" - this.Styles.Load "avares://Avalonia.Themes.Default/Accents/BaseDark.xaml" + this.Styles.Add (FluentTheme()) override this.OnFrameworkInitializationCompleted() = match this.ApplicationLifetime with