Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<DisableImplicitSystemValueTupleReference>true</DisableImplicitSystemValueTupleReference>
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
<AvaloniaVersion>11.2.2</AvaloniaVersion>
<AvaloniaVersion>11.2.3</AvaloniaVersion>
<FabulousVersion>3.0.0-pre19</FabulousVersion>
</PropertyGroup>

Expand Down
12 changes: 6 additions & 6 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
<PackageVersion Include="Avalonia.Headless" Version="11.2.2" />
<PackageVersion Include="Avalonia.Headless.XUnit" Version="11.2.2" />
<PackageVersion Include="Fabulous" Version="$(FabulousVersion)" />
<PackageVersion Include="FsCheck.NUnit" Version="2.16.4" />
<PackageVersion Include="FSharp.Core" Version="8.0.301" />
<PackageVersion Include="FsCheck.NUnit" Version="2.16.6" />
<PackageVersion Include="FSharp.Core" Version="8.0.403" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageVersion Include="NUnit" Version="3.13.3" />
<PackageVersion Include="FsUnit" Version="5.2.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageVersion Include="NUnit" Version="4.3.2" />
<PackageVersion Include="FsUnit" Version="7.0.1" />
<PackageVersion Include="NUnit3TestAdapter" Version="5.0.0" />
<PackageVersion Include="Avalonia" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Themes.Fluent" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Android" Version="$(AvaloniaVersion)" />
Expand All @@ -25,7 +25,7 @@
<PackageVersion Include="Avalonia.Controls.ItemsRepeater" Version="11.1.5" />
<PackageVersion Include="Avalonia.Controls.ColorPicker" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Controls.TreeDataGrid" Version="11.0.10" />
<PackageVersion Include="Avalonia.Controls.TreeDataGrid" Version="11.1.1" />
<PackageVersion Include="xunit" Version="2.9.2" />
</ItemGroup>
</Project>
23 changes: 20 additions & 3 deletions src/Fabulous.Avalonia/Views/Application.fs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ open Avalonia.Styling
open Fabulous
open Fabulous.Avalonia
open Fabulous.StackAllocatedCollections
open Fabulous.StackAllocatedCollections.StackList

#nowarn "0044" // Disable obsolete warnings in Fabulous.Avalonia. Please remove after deleting obsolete code.

type IFabApplication =
inherit IFabElement
Expand All @@ -24,6 +21,8 @@ type FabApplication() =
let mutable _mainWindow: Window = null
let mutable _mainView: Control = null

let mutable _shutdownMode: ShutdownMode = ShutdownMode.OnLastWindowClose

let mutable _onFrameworkInitialized: Application -> unit = fun _ -> ()

member this.OnFrameworkInitialized
Expand Down Expand Up @@ -101,6 +100,13 @@ type FabApplication() =
_mainView <- value
this.UpdateLifetime()

member this.ShutdownMode
with get () =
match this.ApplicationLifetime with
| :? IClassicDesktopStyleApplicationLifetime as lifeTime -> lifeTime.ShutdownMode
| _ -> failwith "ShutdownMode is not supported for this ApplicationLifetime"
and set value = _shutdownMode <- value

/// <summary>Gets the current application instance.</summary>
static member Current = Application.Current :?> FabApplication

Expand Down Expand Up @@ -184,6 +190,10 @@ module Application =
(fun target -> (target :?> FabApplication).InsetsManager.SystemBarColor)
(fun target value -> (target :?> FabApplication).InsetsManager.SystemBarColor <- value)

let ShutdownMode =
Attributes.definePropertyWithGetSet "Application_ShutdownMode" (fun target -> (target :?> FabApplication).ShutdownMode) (fun target value ->
(target :?> FabApplication).ShutdownMode <- value)

let RequestedThemeVariant =
Attributes.defineAvaloniaPropertyWithEquality Application.RequestedThemeVariantProperty

Expand Down Expand Up @@ -254,6 +264,13 @@ type ApplicationModifiers =
static member inline actualThemeVariant(this: WidgetBuilder<'msg, #IFabApplication>, value: ThemeVariant) =
this.AddScalar(Application.ActualThemeVariant.WithValue(value))

/// <summary>Sets the application ShutdownMode.</summary>
/// <param name="this">Current widget.</param>
/// <param name="value">ShutdownMode to be used for the application.</param>
[<Extension>]
static member inline shutdownMode(this: WidgetBuilder<'msg, #IFabApplication>, value: ShutdownMode) =
this.AddScalar(Application.ShutdownMode.WithValue(value))

/// <summary>Links a ViewRef to access the direct Application control instance</summary>
/// <param name="this">Current widget</param>
/// <param name="value">The ViewRef instance that will receive access to the underlying control</param>
Expand Down
8 changes: 4 additions & 4 deletions templates/content/blank/.template.config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,25 +62,25 @@
"type": "parameter",
"dataType": "string",
"replaces": "AvaloniaAndroidPkgVersion",
"defaultValue": "11.2.2"
"defaultValue": "11.2.3"
},
"AvaloniaDesktopPkgVersion": {
"type": "parameter",
"dataType": "string",
"replaces": "AvaloniaDesktopPkgVersion",
"defaultValue": "11.2.2"
"defaultValue": "11.2.3"
},
"AvaloniaiOSPkgVersion": {
"type": "parameter",
"dataType": "string",
"replaces": "AvaloniaiOSPkgVersion",
"defaultValue": "11.2.2"
"defaultValue": "11.2.3"
},
"AvaloniaThemesFluentPkgVersion": {
"type": "parameter",
"dataType": "string",
"replaces": "AvaloniaThemesFluentPkgVersion",
"defaultValue": "11.2.2"
"defaultValue": "11.2.3"
}
}
}
10 changes: 5 additions & 5 deletions templates/content/multi/.template.config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,31 +62,31 @@
"type": "parameter",
"dataType": "string",
"replaces": "AvaloniaAndroidPkgVersion",
"defaultValue": "11.2.2"
"defaultValue": "11.2.3"
},
"AvaloniaBrowserPkgVersion": {
"type": "parameter",
"dataType": "string",
"replaces": "AvaloniaBrowserPkgVersion",
"defaultValue": "11.2.2"
"defaultValue": "11.2.3"
},
"AvaloniaDesktopPkgVersion": {
"type": "parameter",
"dataType": "string",
"replaces": "AvaloniaDesktopPkgVersion",
"defaultValue": "11.2.2"
"defaultValue": "11.2.3"
},
"AvaloniaiOSPkgVersion": {
"type": "parameter",
"dataType": "string",
"replaces": "AvaloniaiOSPkgVersion",
"defaultValue": "11.2.2"
"defaultValue": "11.2.3"
},
"AvaloniaThemesFluentPkgVersion": {
"type": "parameter",
"dataType": "string",
"replaces": "AvaloniaThemesFluentPkgVersion",
"defaultValue": "11.2.2"
"defaultValue": "11.2.3"
}
}
}