Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with Avalonia 11.1, remove ReactiveUI dependency #49

Merged
merged 4 commits into from
Apr 11, 2024
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
8 changes: 2 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: .NET Build

on:
push:
branches-ignore:
- 'main'
pull_request:
branches:
- '**:**'
Expand All @@ -14,10 +12,8 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: 5.0.x
- name: Restore dependencies
run: dotnet restore
dotnet-version: 8
- name: Build with dotnet
run: dotnet build --configuration Release
7 changes: 4 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: .NET Publish

on:
push:
branches: [ main ]
tags:
- main

jobs:
build:
Expand All @@ -12,9 +13,9 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: 5.0.x
dotnet-version: 8
- name: Build and Pack
run: dotnet build DialogHost.Avalonia --configuration Release
- name: Publish to Nuget
Expand Down
7 changes: 3 additions & 4 deletions DialogHost.Avalonia/DialogHost.Avalonia.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>9</LangVersion>
<LangVersion>12</LangVersion>
<Nullable>enable</Nullable>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Title>DialogHost.Avalonia</Title>
Expand All @@ -15,7 +15,7 @@
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<RepositoryType>Git</RepositoryType>
<PackageTags>c-sharp xaml multi-platform gui control mvvm dialogs avalonia avaloniaui c-sharp-library</PackageTags>
<Version>0.7.7</Version>
<Version>0.8.0-avalonia11dot1-1</Version>
<RootNamespace>DialogHostAvalonia</RootNamespace>
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
<PackageReleaseNotes>
Expand All @@ -32,7 +32,6 @@
</AvaloniaResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.0.0"/>
<PackageReference Include="System.Reactive" Version="6.0.0"/>
<PackageReference Include="Avalonia" Version="11.1.0-beta1"/>
</ItemGroup>
</Project>
14 changes: 7 additions & 7 deletions DialogHost.Avalonia/DialogHost.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Disposables;
using System.Threading.Tasks;
using System.Windows.Input;
using Avalonia;
Expand All @@ -14,9 +13,10 @@
using Avalonia.Interactivity;
using Avalonia.Media;
using DialogHostAvalonia.Positioners;
using DialogHostAvalonia.Utilities;

namespace DialogHostAvalonia {
public class DialogHost : ContentControl {

Check warning on line 19 in DialogHost.Avalonia/DialogHost.axaml.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'DialogHost'

Check warning on line 19 in DialogHost.Avalonia/DialogHost.axaml.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'DialogHost'

Check warning on line 19 in DialogHost.Avalonia/DialogHost.axaml.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'DialogHost'
public const string ContentCoverName = "PART_ContentCover";
public const string DialogHostRoot = "PART_DialogHostRoot";

Expand Down Expand Up @@ -110,9 +110,6 @@
(o, v) => o.PopupPositioner = v,
defaultBindingMode: BindingMode.TwoWay);

private IDialogPopupPositioner? _popupPositioner;
private bool _disableOpeningAnimation;

private DialogClosingEventHandler? _asyncShowClosingEventHandler;
private DialogOpenedEventHandler? _asyncShowOpenedEventHandler;

Expand All @@ -127,22 +124,25 @@
private DialogOpenedEventHandler? _dialogOpenedCallback;

private TaskCompletionSource<object?>? _dialogTaskCompletionSource;
private bool _disableOpeningAnimation;

private string? _identifier;

private bool _isOpen;

private ICommand _openDialogCommand;

private Grid? _root;
private DialogOverlayPopupHost? _overlayPopupHost;

private IDialogPopupPositioner? _popupPositioner;
private IInputElement? _restoreFocusDialogClose;

private Grid? _root;

private IDisposable? _templateDisposables;

public DialogHost() {
_closeDialogCommand = new DialogHostCommandImpl(InternalClose, o => IsOpen, this.GetObservable(IsOpenProperty));
_openDialogCommand = new DialogHostCommandImpl(o => ShowInternal(o, null, null), o => !IsOpen, this.GetObservable(IsOpenProperty));

Check warning on line 145 in DialogHost.Avalonia/DialogHost.axaml.cs

View workflow job for this annotation

GitHub Actions / build

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 145 in DialogHost.Avalonia/DialogHost.axaml.cs

View workflow job for this annotation

GitHub Actions / build

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 145 in DialogHost.Avalonia/DialogHost.axaml.cs

View workflow job for this annotation

GitHub Actions / build

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.
}

public IControlTemplate? PopupTemplate {
Expand Down Expand Up @@ -227,8 +227,8 @@
public DialogSession? CurrentSession { get; private set; }

public DialogClosingEventHandler DialogClosingCallback {
get => _dialogClosingCallback;

Check warning on line 230 in DialogHost.Avalonia/DialogHost.axaml.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference return.

Check warning on line 230 in DialogHost.Avalonia/DialogHost.axaml.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference return.

Check warning on line 230 in DialogHost.Avalonia/DialogHost.axaml.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference return.
set => SetAndRaise(DialogClosingCallbackProperty, ref _dialogClosingCallback, value);

Check warning on line 231 in DialogHost.Avalonia/DialogHost.axaml.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference assignment.

Check warning on line 231 in DialogHost.Avalonia/DialogHost.axaml.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference assignment.

Check warning on line 231 in DialogHost.Avalonia/DialogHost.axaml.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference assignment.
}

/// <summary>
Expand Down Expand Up @@ -504,7 +504,7 @@
_overlayPopupHost!.Bind(TemplateProperty, this.GetBindingObservable(PopupTemplateProperty)),
_overlayPopupHost!.Bind(PaddingProperty, this.GetBindingObservable(DialogMarginProperty)),
_overlayPopupHost!.Bind(PopupPositionerProperty, this.GetBindingObservable(PopupPositionerProperty)),
e.NameScope.Find<Rectangle>(ContentCoverName)?.AddDisposableHandler(PointerReleasedEvent, ContentCoverGrid_OnPointerReleased) ?? Disposable.Empty
e.NameScope.Find<Rectangle>(ContentCoverName)?.AddDisposableHandler(PointerReleasedEvent, ContentCoverGrid_OnPointerReleased) ?? EmptyDisposable.Instance
};
base.OnApplyTemplate(e);
}
Expand Down
5 changes: 3 additions & 2 deletions DialogHost.Avalonia/DialogHostCommandImpl.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using System;
using System.Windows.Input;
using DialogHostAvalonia.Utilities;

namespace DialogHostAvalonia {
internal class DialogHostCommandImpl : ICommand {
private Func<object, bool> _canExecuteFunc;
private Action<object> _executeFunc;
private readonly Func<object, bool> _canExecuteFunc;
private readonly Action<object> _executeFunc;

public DialogHostCommandImpl(Action<object> executeFunc, Func<object, bool>? canExecuteFunc, IObservable<bool> canExecuteChangedObservable) {
_canExecuteFunc = canExecuteFunc ?? (o => true) ;
Expand Down
9 changes: 0 additions & 9 deletions DialogHost.Avalonia/DialogOverlayPopupHost.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Controls.Primitives.PopupPositioning;
using Avalonia.Data;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Media;
using Avalonia.Threading;
using Avalonia.VisualTree;
using DialogHostAvalonia.Positioners;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using Avalonia;
using Avalonia.Controls.Primitives.PopupPositioning;
using Avalonia;
using Avalonia.Layout;

namespace DialogHostAvalonia.Positioners {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Avalonia;
using Avalonia.Controls.Primitives.PopupPositioning;

namespace DialogHostAvalonia.Positioners {
/// <summary>
Expand Down
Loading
Loading