Fix Avalonia Build, update packages (#736)

* Fix Avalonia Build, update packages

* Fix Maui Manifest

* Update API Check result
This commit is contained in:
Chris Pulman 2024-01-25 07:34:18 +00:00 коммит произвёл GitHub
Родитель b7e227378c
Коммит 3153c82a22
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
31 изменённых файлов: 152 добавлений и 138 удалений

Просмотреть файл

@ -266,7 +266,7 @@ dotnet_diagnostic.SA1006.severity = error
dotnet_diagnostic.SA1007.severity = error
dotnet_diagnostic.SA1008.severity = error
dotnet_diagnostic.SA1009.severity = error
dotnet_diagnostic.SA1010.severity = error
dotnet_diagnostic.SA1010.severity = none
dotnet_diagnostic.SA1011.severity = error
dotnet_diagnostic.SA1012.severity = error
dotnet_diagnostic.SA1013.severity = error

Просмотреть файл

@ -2,6 +2,7 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using MsBox.Avalonia;
using Sextant;
using Sextant.Avalonia;
using SextantSample.Avalonia.Views;
@ -32,11 +33,9 @@ namespace SextantSample.Avalonia
.GetService<IViewStackService>()
.PushPage(new HomeViewModel());
Interactions.ErrorMessage.RegisterHandler(context =>
MessageBox.Avalonia
.MessageBoxManager
.GetMessageBoxStandardWindow("Notification", context.Input.ToString())
.Show());
Interactions.ErrorMessage.RegisterHandler(async context =>
await MessageBoxManager.GetMessageBoxStandard("Notification", context.Input.ToString())
.ShowAsync());
new Window { Content = Locator.Current.GetNavigationView() }.Show();
base.OnFrameworkInitializationCompleted();

Просмотреть файл

@ -1,22 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Citrus.Avalonia" Version="2.1.1" />
<PackageReference Include="MessageBox.Avalonia" Version="3.1.5.1" />
</ItemGroup>
<ItemGroup>
<Compile Update="**\*.xaml.cs">
<DependentUpon>%(Filename)</DependentUpon>
</Compile>
<EmbeddedResource Include="**\*.xaml">
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SextantSample.Core\SextantSample.ViewModels.csproj" />
<ProjectReference Include="..\..\src\Sextant.Avalonia\Sextant.Avalonia.csproj" />
</ItemGroup>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<LangVersion>preview</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Citrus.Avalonia" Version="2.1.1" />
<PackageReference Include="MessageBox.Avalonia" Version="3.1.5.1" />
</ItemGroup>
<ItemGroup>
<Compile Update="**\*.xaml.cs">
<DependentUpon>%(Filename)</DependentUpon>
</Compile>
<AvaloniaResource Include="**\*.xaml">
<SubType>Designer</SubType>
</AvaloniaResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SextantSample.Core\SextantSample.ViewModels.csproj" />
<ProjectReference Include="..\..\src\Sextant.Avalonia\Sextant.Avalonia.csproj" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,15 +1,9 @@
using System;
using Sextant;
using Sextant;
namespace SextantSample.ViewModels
{
public class FirstModalNavigationViewModel : ViewModelBase
public class FirstModalNavigationViewModel(IViewStackService viewStackService) : ViewModelBase(viewStackService)
{
public FirstModalNavigationViewModel(IViewStackService viewStackService)
: base(viewStackService)
{
}
public override string Id => nameof(FirstModalNavigationViewModel);
}
}

Просмотреть файл

@ -5,6 +5,6 @@ namespace SextantSample.ViewModels
{
public static class Interactions
{
public static readonly Interaction<Exception, bool> ErrorMessage = new Interaction<Exception, bool>();
public static readonly Interaction<Exception, bool> ErrorMessage = new();
}
}

Просмотреть файл

@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0</TargetFrameworks>
<Platforms>AnyCPU;x64</Platforms>
<LangVersion>preview</LangVersion>
</PropertyGroup>
<ItemGroup>

Просмотреть файл

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="31" />
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"></application>
<application android:allowBackup="true" android:supportsRtl="true"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>

Просмотреть файл

@ -33,14 +33,11 @@
<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" />
<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />
@ -58,6 +55,10 @@
<MauiFont Remove="Resources\Fonts\OpenSans-Semibold.ttf" />
</ItemGroup>
<ItemGroup>
<MauiImage Remove="Resources\Images\dotnet_bot.svg" />
</ItemGroup>
<ItemGroup>
<None Remove="Resources\AppIcon\appicon.svg" />
<None Remove="Resources\AppIcon\appiconfg.svg" />
@ -68,13 +69,13 @@
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\AppIcon\appicon.svg" />
<BundleResource Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
<BundleResource Include="Resources\AppIcon\appiconfg.svg" />
<BundleResource Include="Resources\Fonts\OpenSans-Regular.ttf" />
<BundleResource Include="Resources\Fonts\OpenSans-Semibold.ttf" />
<BundleResource Include="Resources\Images\dotnet_bot.svg" />
<BundleResource Include="Resources\Images\dotnet_bot.svg" BaseSize="168,208" />
<BundleResource Include="Resources\Raw\AboutAssets.txt" />
<BundleResource Include="Resources\Splash\splash.svg" />
<BundleResource Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
</ItemGroup>
<ItemGroup>
@ -106,7 +107,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,8 +1,11 @@
<wpf:FormsApplicationPage x:Class="SextantSample.WPF.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wpf="clr-namespace:Xamarin.Forms.Platform.WPF;assembly=Xamarin.Forms.Platform.WPF"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800" />
<wpf:FormsApplicationPage
x:Class="SextantSample.WPF.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wpf="clr-namespace:Xamarin.Forms.Platform.WPF;assembly=Xamarin.Forms.Platform.WPF"
Title="MainWindow"
Width="800"
Height="450"
mc:Ignorable="d" />

Просмотреть файл

@ -2,13 +2,13 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ReactiveUI.WPF" Version="13.0.38" />
<PackageReference Include="Xamarin.Forms.Platform.WPF" Version="4.8.0.1821" />
<PackageReference Include="ReactiveUI.WPF" Version="19.*" />
<PackageReference Include="Xamarin.Forms.Platform.WPF" Version="5.0.0.2622" />
</ItemGroup>
<ItemGroup>

Просмотреть файл

@ -14,7 +14,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sextant.XamForms", "..\src\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SextantSample.ViewModels", "SextantSample.Core\SextantSample.ViewModels.csproj", "{5818A5AF-3FF6-4E68-80FC-604D4AEF156C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SextantSample.WPF", "SextantSample.WPF\SextantSample.WPF.csproj", "{B3804254-BA2D-4ECF-9A71-8685843A546F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SextantSample.WPF", "SextantSample.WPF\SextantSample.WPF.csproj", "{B3804254-BA2D-4ECF-9A71-8685843A546F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SextantSample.Maui", "SextantSample.Maui\SextantSample.Maui.csproj", "{7CABE10D-4CDE-4012-9385-6E49EE2E492F}"
EndProject
@ -293,38 +293,48 @@ Global
{5818A5AF-3FF6-4E68-80FC-604D4AEF156C}.Sample Release|iPhone.Build.0 = Release|Any CPU
{5818A5AF-3FF6-4E68-80FC-604D4AEF156C}.Sample Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{5818A5AF-3FF6-4E68-80FC-604D4AEF156C}.Sample Release|iPhoneSimulator.Build.0 = Release|Any CPU
{5818A5AF-3FF6-4E68-80FC-604D4AEF156C}.Sample Release|x64.ActiveCfg = Release|x64
{5818A5AF-3FF6-4E68-80FC-604D4AEF156C}.Sample Release|x64.Build.0 = Release|x64
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Ad-Hoc|x64.Build.0 = Release|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.AppStore|iPhone.Build.0 = Debug|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.AppStore|x64.ActiveCfg = Release|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.AppStore|x64.Build.0 = Release|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Debug|iPhone.Build.0 = Debug|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Debug|x64.ActiveCfg = Debug|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Debug|x64.Build.0 = Debug|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Release|Any CPU.Build.0 = Release|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Release|iPhone.ActiveCfg = Release|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Release|iPhone.Build.0 = Release|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Release|x64.ActiveCfg = Release|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Release|x64.Build.0 = Release|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Sample Release|Any CPU.ActiveCfg = Release|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Sample Release|Any CPU.Build.0 = Release|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Sample Release|iPhone.ActiveCfg = Release|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Sample Release|iPhone.Build.0 = Release|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Sample Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Sample Release|iPhoneSimulator.Build.0 = Release|Any CPU
{5818A5AF-3FF6-4E68-80FC-604D4AEF156C}.Sample Release|x64.ActiveCfg = Release|x64
{5818A5AF-3FF6-4E68-80FC-604D4AEF156C}.Sample Release|x64.Build.0 = Release|x64
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Sample Release|x64.ActiveCfg = Release|Any CPU
{B3804254-BA2D-4ECF-9A71-8685843A546F}.Sample Release|x64.Build.0 = Release|Any CPU
{7CABE10D-4CDE-4012-9385-6E49EE2E492F}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{7CABE10D-4CDE-4012-9385-6E49EE2E492F}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{7CABE10D-4CDE-4012-9385-6E49EE2E492F}.Ad-Hoc|Any CPU.Deploy.0 = Debug|Any CPU

Просмотреть файл

@ -3,11 +3,10 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Platforms>AnyCPU;x64</Platforms>
<LangVersion>preview</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" />
<PackageReference Include="Pharmacist.MsBuild" Version="2.*" PrivateAssets="all" />
<PackageReference Include="Pharmacist.Common" Version="2.*" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Remove="MainPage.xaml" />

Просмотреть файл

@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<IsPackable>false</IsPackable>
<TargetFrameworks>net461;netcoreapp2.0</TargetFrameworks>
<TargetFrameworks>net462;net8.0</TargetFrameworks>
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
<OutputType>Exe</OutputType>
<Nullable>enable</Nullable>
<NoWarn>;1591;1701;1702;1705;CA1822</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="*" />
<PackageReference Include="System.Reactive" Version="4.*" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Sextant\Sextant.csproj" />

Просмотреть файл

@ -41,14 +41,14 @@
<ItemGroup Condition="$(IsTestProject)">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.5" />
<PackageReference Include="xunit" Version="2.6.6" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6" />
<PackageReference Include="Xunit.StaFact" Version="1.1.11" />
<PackageReference Include="Xamarin.Forms.Mocks" Version="4.7.0.1" />
<PackageReference Include="DiffEngine" Version="13.0.2" />
<PackageReference Include="DiffEngine" Version="15.1.1" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="ReactiveUI.Testing" Version="19.*" />
<PackageReference Include="Verify.Xunit" Version="22.8.0" />
<PackageReference Include="Verify.Xunit" Version="23.0.0" />
<PackageReference Include="PublicApiGenerator" Version="11.1.0" />
<PackageReference Include="NSubstitute" Version="5.1.0" />
<PackageReference Include="coverlet.msbuild" Version="6.0.0">
@ -63,7 +63,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="stylecop.analyzers" Version="1.2.0-beta.507" PrivateAssets="all" />
<PackageReference Include="Roslynator.Analyzers" Version="4.7.0" PrivateAssets="All" />
<PackageReference Include="Roslynator.Analyzers" Version="4.9.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>

Просмотреть файл

@ -44,12 +44,11 @@ namespace Sextant.Avalonia
string? contract = null)
{
var view = dependencyResolver.GetService<IView>(contract ?? "NavigationView");
if (view is null)
return view switch
{
throw new InvalidOperationException("NavigationView not registered.");
}
return view;
null => throw new InvalidOperationException("NavigationView not registered."),
_ => view
};
}
}
}

Просмотреть файл

@ -9,7 +9,7 @@ using System.Linq;
using System.Reactive.Linq;
using Avalonia.Animation;
using Avalonia.ReactiveUI;
using Avalonia.Controls;
using DynamicData.Aggregation;
using DynamicData.Binding;
@ -62,7 +62,7 @@ namespace Sextant.Avalonia
/// <summary>
/// Gets the control responsible for rendering the current view.
/// </summary>
public TransitioningContentControl Control { get; } = new TransitioningContentControl();
public TransitioningContentControl Control { get; } = new();
/// <summary>
/// Toggles the animations.

Просмотреть файл

@ -21,10 +21,10 @@ namespace Sextant.Avalonia
/// <summary>
/// The <see cref="IView"/> implementation for Avalonia.
/// </summary>
public sealed partial class NavigationView : ContentControl, IStyleable, IView
public sealed partial class NavigationView : ContentControl, IView
{
private readonly Navigation _modalNavigation = new Navigation();
private readonly Navigation _pageNavigation = new Navigation();
private readonly Navigation _modalNavigation = new();
private readonly Navigation _pageNavigation = new();
/// <summary>
/// Initializes a new instance of the <see cref="NavigationView"/> class.
@ -62,11 +62,6 @@ namespace Sextant.Avalonia
};
}
/// <summary>
/// Gets the style key of a <see cref="ContentControl"/>.
/// </summary>
Type IStyleable.StyleKey => typeof(ContentControl);
/// <summary>
/// Gets or sets the scheduler used by the <see cref="NavigationView"/>.
/// </summary>
@ -80,6 +75,18 @@ namespace Sextant.Avalonia
/// <inheritdoc />
public IObservable<IViewModel> PagePopped { get; } = Observable.Never<IViewModel>();
/// <summary>
/// Gets the type by which the element is styled.
/// </summary>
/// <remarks>
/// Usually controls are styled by their own type, but there are instances where you want
/// an element to be styled by its base type, e.g. creating SpecialButton that
/// derives from Button and adds extra functionality but is still styled as a regular
/// Button. Override this property to change the style for a control class, returning the
/// type that you wish the elements to be styled as.
/// </remarks>
protected override Type StyleKeyOverride => typeof(ContentControl);
/// <inheritdoc />
public IObservable<Unit> PushPage(
IViewModel viewModel,
@ -129,14 +136,9 @@ namespace Sextant.Avalonia
private IViewFor LocateView(IViewModel viewModel, string? contract)
{
var view = ViewLocator.ResolveView(viewModel, contract);
if (view is null)
{
throw new InvalidOperationException(
var view = ViewLocator.ResolveView(viewModel, contract) ?? throw new InvalidOperationException(
$"No view could be located for type '{viewModel.GetType().FullName}', " +
$"contract '{contract}'. Be sure Splat has an appropriate registration.");
}
view.ViewModel = viewModel;
return view;
}

Просмотреть файл

@ -1,17 +1,17 @@
<Project Sdk="MSBuild.Sdk.Extras">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net5.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0</TargetFrameworks>
<AssemblyName>Sextant.Avalonia</AssemblyName>
<RootNamespace>Sextant.Avalonia</RootNamespace>
<PackageId>Sextant.Avalonia</PackageId>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<LangVersion>preview</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ReactiveUI" Version="19.*" />
<PackageReference Include="Avalonia" Version="0.10.12" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.12" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.12" />
<PackageReference Include="Avalonia" Version="11.0.7" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.7" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.7" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Sextant\Sextant.csproj" />

Просмотреть файл

@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">$(TargetFrameworks);net461;</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">$(TargetFrameworks);net462;</TargetFrameworks>
<IsPackable>false</IsPackable>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>

Просмотреть файл

@ -6,7 +6,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using Sextant.APITests;
using VerifyXunit;
using Xunit;
namespace Sextant.Tests
@ -15,7 +14,6 @@ namespace Sextant.Tests
/// Tests to make sure that the API matches the approved ones.
/// </summary>
[ExcludeFromCodeCoverage]
[UsesVerify]
public class ApiApprovalTests
{
/// <summary>

Просмотреть файл

@ -17,7 +17,6 @@ namespace Sextant.APITests;
/// A helper for doing API approvals.
/// </summary>
[ExcludeFromCodeCoverage]
[UsesVerify]
public static class ApiExtensions
{
/// <summary>

Просмотреть файл

@ -31,13 +31,15 @@ namespace Sextant.XamForms
Device = 0,
NavigationService = 1,
}
public class NavigationView : Xamarin.Forms.NavigationPage, Sextant.IView, Splat.IEnableLogger
public class NavigationView : Xamarin.Forms.NavigationPage, Sextant.IView, Splat.IEnableLogger, System.IDisposable
{
public NavigationView() { }
public NavigationView(System.Reactive.Concurrency.IScheduler mainScheduler, System.Reactive.Concurrency.IScheduler backgroundScheduler, ReactiveUI.IViewLocator viewLocator) { }
public NavigationView(System.Reactive.Concurrency.IScheduler mainScheduler, System.Reactive.Concurrency.IScheduler backgroundScheduler, ReactiveUI.IViewLocator viewLocator, Xamarin.Forms.Page rootPage) { }
public System.Reactive.Concurrency.IScheduler MainThreadScheduler { get; }
public System.IObservable<Sextant.IViewModel> PagePopped { get; }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
public System.IObservable<System.Reactive.Unit> PopModal() { }
public System.IObservable<System.Reactive.Unit> PopPage(bool animate) { }
public System.IObservable<System.Reactive.Unit> PopToRootPage(bool animate) { }

Просмотреть файл

@ -11,7 +11,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="5.0.*" />
<PackageReference Include="Xamarin.Forms.Mocks" Version="4.7.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Sextant.Mocks\Sextant.Mocks.csproj" />

Просмотреть файл

@ -13,17 +13,12 @@ namespace Sextant.XamForms
/// <summary>
/// Represents a <see cref="BehaviorBase{T}"/> that intercepts the backwards navigation.
/// </summary>
public sealed class NavigationPageSystemPopBehavior : BehaviorBase<NavigationPage>
/// <remarks>
/// Initializes a new instance of the <see cref="NavigationPageSystemPopBehavior"/> class.
/// </remarks>
/// <param name="navigationSource">A value indicating whether the back button was pressed.</param>
public sealed class NavigationPageSystemPopBehavior(IObservable<NavigationSource> navigationSource) : BehaviorBase<NavigationPage>
{
private readonly IObservable<NavigationSource> _navigationSource;
/// <summary>
/// Initializes a new instance of the <see cref="NavigationPageSystemPopBehavior"/> class.
/// </summary>
/// <param name="navigationSource">A value indicating whether the back button was pressed.</param>
public NavigationPageSystemPopBehavior(IObservable<NavigationSource> navigationSource) =>
_navigationSource = navigationSource;
/// <inheritdoc/>
protected override void OnAttachedTo(NavigationPage bindable)
{
@ -36,7 +31,7 @@ namespace Sextant.XamForms
},
x => bindable.Popped += x,
x => bindable.Popped -= x)
.WithLatestFrom(_navigationSource, (navigated, navigationSource) => (navigated, navigationSource))
.WithLatestFrom(navigationSource, (navigated, navigationSource) => (navigated, navigationSource))
.Where(result => result.navigationSource == NavigationSource.Device)
.Select(x => x.navigated)
.Subscribe(navigated =>

Просмотреть файл

@ -18,14 +18,13 @@ namespace Sextant.XamForms
/// <summary>
/// The main navigation view.
/// </summary>
public class NavigationView : NavigationPage, IView, IEnableLogger
public class NavigationView : NavigationPage, IView, IEnableLogger, IDisposable
{
private readonly ISubject<NavigationSource> _navigationSource =
new BehaviorSubject<NavigationSource>(NavigationSource.Device);
private readonly BehaviorSubject<NavigationSource> _navigationSource = new(NavigationSource.Device);
private readonly IScheduler _backgroundScheduler;
private readonly IViewLocator _viewLocator;
private readonly IFullLogger _logger;
private bool _disposedValue;
/// <summary>
/// Initializes a new instance of the <see cref="NavigationView"/> class.
@ -198,6 +197,32 @@ namespace Sextant.XamForms
.ToObservable();
});
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
/// <summary>
/// Releases unmanaged and - optionally - managed resources.
/// </summary>
/// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
protected virtual void Dispose(bool disposing)
{
if (!_disposedValue)
{
if (disposing)
{
_navigationSource.Dispose();
}
_disposedValue = true;
}
}
private static void SetPageTitle(Page page, string resourceKey) =>
// var title = Localize.GetString(resourceKey);
@ -206,15 +231,9 @@ namespace Sextant.XamForms
private Page LocatePageFor(object viewModel, string? contract)
{
var view = _viewLocator.ResolveView(viewModel, contract);
if (view is null)
{
throw new InvalidOperationException(
var view = _viewLocator.ResolveView(viewModel, contract) ?? throw new InvalidOperationException(
$"No view could be located for type '{viewModel.GetType().FullName}', contract '{contract}'. Be sure Splat has an appropriate registration.");
}
if (!(view is Page page))
if (view is not Page page)
{
throw new InvalidOperationException(
$"Resolved view '{view.GetType().FullName}' for type '{viewModel.GetType().FullName}', contract '{contract}' is not a Page.");

Просмотреть файл

@ -1,12 +1,12 @@
<Project Sdk="MSBuild.Sdk.Extras">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0</TargetFrameworks>
<AssemblyName>Sextant.XamForms</AssemblyName>
<RootNamespace>Sextant.XamForms</RootNamespace>
<PackageId>Sextant.XamForms</PackageId>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<LangVersion>preview</LangVersion>
</PropertyGroup>
<ItemGroup>

Просмотреть файл

@ -22,10 +22,7 @@ namespace Sextant
/// <param name="sextant">The sextant.</param>
public static void Initialize(this Sextant sextant)
{
if (sextant is null)
{
throw new ArgumentNullException(nameof(sextant));
}
ArgumentNullException.ThrowIfNull(sextant);
sextant.MutableLocator.RegisterViewStackService();
}

Просмотреть файл

@ -4,10 +4,6 @@
// See the LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Reactive.Concurrency;
using System.Text;
using Splat;
namespace Sextant
{

Просмотреть файл

@ -4,9 +4,7 @@
// See the LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Reactive.Concurrency;
using System.Text;
using Splat;
namespace Sextant

Просмотреть файл

@ -6,7 +6,7 @@
<RootNamespace>Sextant</RootNamespace>
<PackageId>Sextant</PackageId>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<LangVersion>preview</LangVersion>
</PropertyGroup>
<ItemGroup>
@ -16,7 +16,7 @@
</ItemGroup>
<ItemGroup Condition=" $(TargetFramework.StartsWith('uap'))">
<PackageReference Include="ReactiveUI" Version="18.4.1" />
<PackageReference Include="ReactiveUI" Version="[18.4.1]" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('uap')) != true">

Просмотреть файл

@ -1,8 +1,7 @@
{
"sdk": {
"version": "8.0.10",
"rollForward": "latestMinor",
"allowPrerelease": true
"rollForward": "latestFeature"
},
"msbuild-sdks": {
"MSBuild.Sdk.Extras": "3.0.44"