Skip to content

Commit

Permalink
Update ci-build and fix fsharp project (#65)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
SKProCH committed Sep 18, 2023
1 parent a1ab34c commit 2164a90
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Directory.build.props
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<!-- region package versions -->
<PropertyGroup>
<AvaloniaVersion>11.0.0</AvaloniaVersion>
<FuncUIVersion>0.5.0-beta</FuncUIVersion>
<FuncUIVersion>1.0.1</FuncUIVersion>
</PropertyGroup>
<!-- endregion -->
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<IsPackable>false</IsPackable>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand All @@ -18,10 +18,10 @@

<ItemGroup>
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="$(AvaloniaVersion)" />
<PackageReference Include="FSharp.SystemTextJson" Version="1.1.23" />
<PackageReference Include="JaggerJo.Avalonia.FuncUI" Version="$(FuncUIVersion)" />
<PackageReference Include="JaggerJo.Avalonia.FuncUI.DSL" Version="$(FuncUIVersion)" />
<PackageReference Include="JaggerJo.Avalonia.FuncUI.Elmish" Version="$(FuncUIVersion)" />
<PackageReference Include="Avalonia.FuncUI" Version="$(FuncUIVersion)" />
<PackageReference Include="Avalonia.FuncUI.Elmish" Version="$(FuncUIVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
13 changes: 8 additions & 5 deletions Live.Avalonia.FuncUI.Sample/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
open System
open System.Text.Json
open System.Text.Json.Serialization
open Avalonia.Themes.Fluent
open Elmish
open Avalonia
open Avalonia.Controls
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()
Expand All @@ -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 () =
Expand All @@ -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


Expand All @@ -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
Expand Down

0 comments on commit 2164a90

Please sign in to comment.