AVLoop 1.1.9

There is a newer version of this package available.
See the version list below for details.
dotnet add package AVLoop --version 1.1.9                
NuGet\Install-Package AVLoop -Version 1.1.9                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AVLoop" Version="1.1.9" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AVLoop --version 1.1.9                
#r "nuget: AVLoop, 1.1.9"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install AVLoop as a Cake Addin
#addin nuget:?package=AVLoop&version=1.1.9

// Install AVLoop as a Cake Tool
#tool nuget:?package=AVLoop&version=1.1.9                

AVLoop

A little bit of infractructure required to support Avalonia windows in F# interactive, courtesy of the discussion in this issue.

Run the following script code before creating Avalonia windows.

#r "nuget: AVLoop"

open FSharp.Compiler.Interactive
open AVLoop

let install() =
        fsi.EventLoop <- {new IEventLoop with 
                                member x.Run() = 
                                    createApp [||]
                                    false //dummy
                                member x.Invoke(f) = disp f
                                member x.ScheduleRestart() = () //dummy
                        }

install() //wait till initialization message before submitting more code

Run the above snippent interactively first. Wait till you see a message "avalonia initialized" and then proceed to submit other code.

If you run this script along with window creation code in the same submit then that will not work. It seems the F# interactive main loop thread needs to be free to 'Run' the event loop (which actually initializes Avalonia).

Window example

Here is an example of a simple window

open Avalonia
let win1 = Controls.Window()
win1.Width <- 300
win1.Height <- 300
let btn1 = Controls.Button()
btn1.Width <- 100
btn1.Height <- 50
btn1.Content <- "Click me"
btn1.Click |> Observable.subscribe (fun _ -> btn1.Content <- "Clicked!")
win1.Content <- btn1
win1.Show()

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.6.1 70 7/24/2024
1.5.0 184 9/23/2023
1.4.1 306 2/9/2023
1.4.0 544 1/15/2022
1.3.0 307 1/15/2022
1.1.9 289 1/13/2022