Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
- to .Net 5.0
- to Avalonia 0.10 RC 1 (includes required fixes)
- add standalone menu to sample
  • Loading branch information
JaggerJo committed Dec 22, 2020
1 parent 0ca5166 commit b70b64b
Show file tree
Hide file tree
Showing 19 changed files with 95 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Include="Library\Extensions.fs" />
<Compile Include="Views\Tabs\ToggleSwitchDemo.fs" />

<Compile Include="Views\Tabs\SpinnerDemo.fs" />
<Compile Include="Views\Tabs\TreeViewDemo.fs" />
<Compile Include="Views\Tabs\NumericUpDownDemo.fs" />
Expand All @@ -17,7 +16,7 @@
<Compile Include="Views\Tabs\DataTemplateDemo.fs" />
<Compile Include="Views\Tabs\GridDemo.fs" />
<Compile Include="Views\Tabs\CanvasDemo.fs" />
<Compile Include="Views\Tabs\MenuDemo.fs" />
<Compile Include="Views\Tabs\ContextMenuDemo.fs" />
<Compile Include="Views\Tabs\StylesDemo.fs" />
<Compile Include="Views\Tabs\TextBoxDemo.fs" />
<Compile Include="Views\Tabs\GridPatchDemo.fs" />
Expand All @@ -26,9 +25,9 @@
<Compile Include="Views\Tabs\TimePickerDemo.fs" />
<Compile Include="Views\Tabs\SplitViewDemo.fs" />
<Compile Include="Views\Tabs\TickBarDemo.fs" />
<AvaloniaResource Include="**\*.xaml" />
<Compile Include="Views\Tabs\WindowMenuDemo.fs" />
<Compile Include="Views\MainView.fs" />

<AvaloniaResource Include="**\*.xaml" />
<Compile Include="Main.fs" />
</ItemGroup>

Expand All @@ -39,7 +38,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-preview5" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-rc1" />
<PackageReference Include="Bogus" Version="28.4.1" />
<PackageReference Update="FSharp.Core" Version="4.7.2" />
</ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/Avalonia.FuncUI.ControlCatalog/Main.fs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
namespace Avalonia.FuncUI.ControlCatalog

open Avalonia.FuncUI.Components.Hosts
open Avalonia
open Avalonia.FuncUI.Components.Hosts
open Avalonia.FuncUI.Elmish
open Avalonia.Themes.Fluent
open Elmish
open Avalonia.Controls.ApplicationLifetimes
open Avalonia.FuncUI.ControlCatalog.Views
Expand All @@ -23,8 +24,7 @@ type App() =
inherit Application()

override this.Initialize() =
this.Styles.Load "avares://Avalonia.Themes.Fluent/Accents/FluentDark.xaml"
this.Styles.Load "avares://Avalonia.Themes.Default/Accents/BaseDark.xaml"
this.Styles.Add (FluentTheme(baseUri = null, Mode = FluentThemeMode.Dark))
this.Styles.Load "avares://Avalonia.FuncUI.ControlCatalog/Styles/TabControl.xaml"

override this.OnFrameworkInitializationCompleted() =
Expand Down
8 changes: 6 additions & 2 deletions src/Avalonia.FuncUI.ControlCatalog/Views/MainView.fs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@ module MainView =
TabItem.content (ViewBuilder.Create<CanvasDemo.Host>([]))
]
TabItem.create [
TabItem.header "Menu Demo"
TabItem.content (ViewBuilder.Create<MenuDemo.Host>([]))
TabItem.header "Context Menu Demo"
TabItem.content (ViewBuilder.Create<ContextMenuDemo.Host>([]))
]
TabItem.create [
TabItem.header "Widow Menu Demo"
TabItem.content (ViewBuilder.Create<WindowMenuDemo.Host>([]))
]
// ToDo: return it back when styles will be worked
//TabItem.create [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ open Avalonia.FuncUI.Components
open Avalonia.FuncUI.Elmish
open Elmish

module MenuDemo =
module ContextMenuDemo =
type State = { color: string }

let init = { color = "gray" }
Expand All @@ -26,17 +26,6 @@ module MenuDemo =
ContextMenu.create [
ContextMenu.viewItems [
MenuItem.create [
MenuItem.header "Red"
MenuItem.viewItems [
MenuItem.create [
MenuItem.header "Light"
MenuItem.onClick (fun _ -> "#e74c3c" |> SetColor |> dispatch)
]
MenuItem.create [
MenuItem.header "Dark"
MenuItem.onClick (fun _ -> "#c0392b" |> SetColor |> dispatch)
]
]
MenuItem.header "Green"
MenuItem.viewItems [
MenuItem.create [
Expand Down
54 changes: 54 additions & 0 deletions src/Avalonia.FuncUI.ControlCatalog/Views/Tabs/WindowMenuDemo.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
namespace Avalonia.FuncUI.ControlCatalog.Views

open Avalonia.Controls
open Avalonia.FuncUI.DSL
open Avalonia.FuncUI.Components
open Avalonia.FuncUI.Elmish
open Elmish

module WindowMenuDemo =
type State = { color: string }

let init = { color = "gray" }

type Msg =
| SetColor of string

let update (msg: Msg) (state: State) : State =
match msg with
| SetColor color -> { state with color = color }

let view (state: State) (dispatch) =
StackPanel.create [
StackPanel.background state.color

StackPanel.children [
Menu.create [
Menu.viewItems [
MenuItem.create [
MenuItem.header "Red"
MenuItem.viewItems [
MenuItem.create [
MenuItem.header "Light"
MenuItem.onClick (fun _ -> "#e74c3c" |> SetColor |> dispatch)
]
MenuItem.create [
MenuItem.header "Dark"
MenuItem.onClick (fun _ -> "#c0392b" |> SetColor |> dispatch)
]
]
]
]
]
]
]


type Host() as this =
inherit Hosts.HostControl()
do
Elmish.Program.mkSimple (fun () -> init) update view
|> Program.withHost this
|> Program.withConsoleTrace
|> Program.run

2 changes: 1 addition & 1 deletion src/Avalonia.FuncUI.DSL/Avalonia.FuncUI.DSL.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@

<ItemGroup>
<ProjectReference Include="..\Avalonia.FuncUI\Avalonia.FuncUI.fsproj" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-preview5" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-rc1" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Avalonia.FuncUI.Elmish/Avalonia.FuncUI.Elmish.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-preview5" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-rc1" />
<PackageReference Include="Elmish" Version="3.0.6" />
<PackageReference Update="FSharp.Core" Version="4.7.2" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>

<IsPackable>false</IsPackable>
<GenerateProgramFile>false</GenerateProgramFile>
Expand All @@ -20,7 +20,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-preview5" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-rc1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
Expand Down
2 changes: 1 addition & 1 deletion src/Avalonia.FuncUI/Avalonia.FuncUI.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-preview5" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-rc1" />
<PackageReference Update="FSharp.Core" Version="4.7.2" />
</ItemGroup>

Expand Down
5 changes: 3 additions & 2 deletions src/Examples/Examples.ClockApp/Examples.ClockApp.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Include="Clock.fs" />
<Compile Include="Program.fs" />
<AvaloniaResource Include="**\*.xaml" />
</ItemGroup>

<ItemGroup>
Expand All @@ -17,7 +18,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-preview5" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-rc1" />
<PackageReference Update="FSharp.Core" Version="4.7.2" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions src/Examples/Examples.ClockApp/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

open System
open Avalonia
open Avalonia.Themes.Fluent
open Avalonia.Threading
open Elmish
open Avalonia.FuncUI.Components.Hosts
Expand Down Expand Up @@ -44,8 +45,7 @@ type App() =
inherit Application()

override this.Initialize() =
this.Styles.Load "avares://Avalonia.Themes.Fluent/Accents/FluentDark.xaml"
this.Styles.Load "avares://Avalonia.Themes.Default/Accents/BaseDark.xaml"
this.Styles.Add (FluentTheme(baseUri = null, Mode = FluentThemeMode.Dark))

override this.OnFrameworkInitializationCompleted() =
match this.ApplicationLifetime with
Expand Down
4 changes: 2 additions & 2 deletions src/Examples/Examples.CounterApp/Examples.CounterApp.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand All @@ -17,7 +17,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-preview5" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-rc1" />
<PackageReference Update="FSharp.Core" Version="4.7.2" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions src/Examples/Examples.CounterApp/Program.fs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace Examples.CounterApp

open Avalonia
open Avalonia.Themes.Fluent
open Elmish
open Avalonia.FuncUI.Components.Hosts
open Avalonia.FuncUI
Expand All @@ -25,8 +26,7 @@ type App() =
inherit Application()

override this.Initialize() =
this.Styles.Load "avares://Avalonia.Themes.Fluent/Accents/FluentDark.xaml"
this.Styles.Load "avares://Avalonia.Themes.Default/Accents/BaseDark.xaml"
this.Styles.Add (FluentTheme(baseUri = null, Mode = FluentThemeMode.Dark))

override this.OnFrameworkInitializationCompleted() =
match this.ApplicationLifetime with
Expand Down
4 changes: 2 additions & 2 deletions src/Examples/Examples.GameOfLife/Examples.GameOfLife.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand All @@ -21,7 +21,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-preview5" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-rc1" />
<PackageReference Update="FSharp.Core" Version="4.7.2" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions src/Examples/Examples.GameOfLife/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

open System
open Avalonia
open Avalonia.Themes.Fluent
open Elmish
open Avalonia.FuncUI.Components.Hosts
open Avalonia.FuncUI
Expand Down Expand Up @@ -38,8 +39,7 @@ type App() =
inherit Application()

override this.Initialize() =
this.Styles.Load "avares://Avalonia.Themes.Fluent/Accents/FluentDark.xaml"
this.Styles.Load "avares://Avalonia.Themes.Default/Accents/BaseDark.xaml"
this.Styles.Add (FluentTheme(baseUri = null, Mode = FluentThemeMode.Dark))

override this.OnFrameworkInitializationCompleted() =
match this.ApplicationLifetime with
Expand Down
4 changes: 2 additions & 2 deletions src/Examples/Examples.MusicPlayer/Examples.MusicPlayer.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand All @@ -22,7 +22,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-preview5" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-rc1" />
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.0-preview2" />
<PackageReference Include="VideoLAN.LibVLC.Mac" Version="3.1.3.1" />
<ProjectReference Include="..\..\Avalonia.FuncUI.DSL\Avalonia.FuncUI.DSL.fsproj" />
Expand Down
4 changes: 2 additions & 2 deletions src/Examples/Examples.MusicPlayer/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ namespace Examples.MusicPlayer
open Avalonia
open Avalonia.Controls.ApplicationLifetimes
open Avalonia.FuncUI
open Avalonia.Themes.Fluent
open LibVLCSharp.Shared


type App() =
inherit Application()

override this.Initialize() =
this.Styles.Load "avares://Avalonia.Themes.Default/Accents/BaseDark.xaml"
this.Styles.Load "avares://Avalonia.Themes.Fluent/Accents/FluentDark.xaml"
this.Styles.Add (FluentTheme(baseUri = null, Mode = FluentThemeMode.Dark))
this.Styles.Load "avares://Examples.MusicPlayer/Styles.xaml"
Core.Initialize()

Expand Down
4 changes: 2 additions & 2 deletions src/Examples/Examples.Presso/Examples.Presso.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<AvaloniaResource Include="**\*.xaml" />
<AvaloniaResource Include="Assets\*" />

<PackageReference Include="Avalonia.Desktop" Version="0.10.0-preview5" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-rc1" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit b70b64b

Please sign in to comment.