Skip to content

Commit

Permalink
Update with more breaking Avalonia 11 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Numpsy committed May 30, 2023
1 parent a81e8f0 commit 78c5559
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ open Avalonia.FuncUI.Elmish
open Avalonia.FuncUI.ControlCatalog.Views
open Avalonia.Themes.Fluent
open Avalonia.FuncUI
open Avalonia.Controls

type MainWindow() as this =
inherit HostWindow()
Expand All @@ -17,7 +18,7 @@ type MainWindow() as this =
base.Height <- 600.0
base.Width <- 800.0

this.VisualRoot.Renderer.Diagnostics.DebugOverlays <- Avalonia.Rendering.RendererDebugOverlays.Fps
TopLevel.GetTopLevel(this).RendererDiagnostics.DebugOverlays <- Avalonia.Rendering.RendererDebugOverlays.Fps
//this.VisualRoot.VisualRoot.Renderer.DrawDirtyRects <- true
()

Expand Down
4 changes: 2 additions & 2 deletions src/Avalonia.FuncUI/DSL/Base/Animatable.fs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ module Animatable =
static member transitions<'t when 't :> Animatable>(transitions: Transitions) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<Transitions>(Animatable.TransitionsProperty, transitions, ValueNone)

static member clock<'t when 't :> Animatable>(clock: IClock) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<IClock>(Animatable.ClockProperty, clock, ValueNone)
// static member clock<'t when 't :> Animatable>(clock: IClock) : IAttr<'t> =
// AttrBuilder<'t>.CreateProperty<IClock>(Animatable.ClockProperty, clock, ValueNone)
4 changes: 2 additions & 2 deletions src/Avalonia.FuncUI/DSL/MenuBase.fs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module MenuBase =
type MenuBase with

static member onMenuOpened<'t when 't :> MenuBase>(func: RoutedEventArgs -> unit, ?subPatchOptions) : IAttr<'t> =
AttrBuilder<'t>.CreateSubscription(MenuBase.MenuOpenedEvent, func, ?subPatchOptions = subPatchOptions);
AttrBuilder<'t>.CreateSubscription(MenuBase.OpenedEvent, func, ?subPatchOptions = subPatchOptions);

static member onMenuClosed<'t when 't :> MenuBase>(func: RoutedEventArgs -> unit, ?subPatchOptions) : IAttr<'t> =
AttrBuilder<'t>.CreateSubscription(MenuBase.MenuClosedEvent, func, ?subPatchOptions = subPatchOptions);
AttrBuilder<'t>.CreateSubscription(MenuBase.ClosedEvent, func, ?subPatchOptions = subPatchOptions);
7 changes: 4 additions & 3 deletions src/Avalonia.FuncUI/DSL/TabItem.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ module TabItem =
open Avalonia.Controls
open Avalonia.FuncUI.Types
open Avalonia.FuncUI.Builder

open System

let create (attrs: IAttr<TabItem> list): IView<TabItem> =
ViewBuilder.Create<TabItem>(attrs)

type TabItem with

static member tabStripPlacement<'t when 't :> TabItem>(placement: Dock) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<Dock>(TabItem.TabStripPlacementProperty, placement, ValueNone)
static member tabStripPlacement<'t when 't :> TabItem>(placement: Dock Nullable) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<Dock Nullable>(TabItem.TabStripPlacementProperty, placement, ValueNone)

static member isSelected<'t when 't :> TabItem>(value: bool) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<bool>(TabItem.IsSelectedProperty, value, ValueNone)
Expand Down
4 changes: 2 additions & 2 deletions src/Avalonia.FuncUI/DSL/TransitioningContentControl.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ module TransitioningContentControl =

type TransitioningContentControl with

static member currentContent<'t when 't :> TransitioningContentControl>(value: obj) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<obj>(TransitioningContentControl.CurrentContentProperty, value, ValueNone)
//static member currentContent<'t when 't :> TransitioningContentControl>(value: obj) : IAttr<'t> =
// AttrBuilder<'t>.CreateProperty<obj>(TransitioningContentControl.CurrentContentProperty, value, ValueNone)

static member pageTransition<'t when 't :> TransitioningContentControl>(transition: IPageTransition) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<IPageTransition>(TransitioningContentControl.PageTransitionProperty, transition, ValueNone)
2 changes: 1 addition & 1 deletion src/Avalonia.FuncUI/VirtualDom/VirtualDom.fs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module rec VirtualDom =
let delta = Differ.diff(last, next)
Patcher.patch(root, delta)

let updateRoot (host: IContentControl, last: IView option, next: IView option) =
let updateRoot (host: ContentControl, last: IView option, next: IView option) =
let root : Control voption =
if host.Content <> null then
match host.Content with
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<AvaloniaVersion>11.0.0-preview8</AvaloniaVersion>
<AvaloniaVersion>11.0.999-cibuild0035827-beta</AvaloniaVersion>
<FuncUIVersion>0.6.0-preview9.1</FuncUIVersion>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ module Extensions =
if uri.IsAbsoluteUri && uri.IsFile then
new Bitmap(uri.LocalPath)
else
let assets = AvaloniaLocator.Current.GetService<IAssetLoader>();
new Bitmap(assets.Open(uri));
new Bitmap(AssetLoader.Open(uri))
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ namespace Examples.MusicPlayer
[<AutoOpen>]
module Extensions =
open System
open Avalonia
open Avalonia.Controls
open Avalonia.Media.Imaging
open Avalonia.Platform
Expand All @@ -17,8 +16,7 @@ module Extensions =
if uri.IsAbsoluteUri && uri.IsFile then
new Bitmap(uri.LocalPath)
else
let assets = AvaloniaLocator.Current.GetService<IAssetLoader>()
new Bitmap(assets.Open(uri))
new Bitmap(AssetLoader.Open(uri))

type Image with
static member FromString(s: string): Image =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ module Extensions =
if uri.IsAbsoluteUri && uri.IsFile then
new Bitmap(uri.LocalPath)
else
let assets = AvaloniaLocator.Current.GetService<IAssetLoader>();
new Bitmap(assets.Open(uri));
new Bitmap(AssetLoader.Open(uri))
1 change: 1 addition & 0 deletions src/NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
<configuration>
<packageSources>
<add key="NuGet official package source" value="https://api.nuget.org/v3/index.json" />
<add key="avalonia-nightly" value="https://pkgs.dev.azure.com/AvaloniaUI/AvaloniaUI/_packaging/avalonia-nightly/nuget/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>

0 comments on commit 78c5559

Please sign in to comment.