Skip to content

Commit

Permalink
Merge pull request #179 from AvaloniaCommunity/feature/PrismAvalona-11.1
Browse files Browse the repository at this point in the history
Upgrade NuGet packages to Avalonia v11.1.1
  • Loading branch information
DamianSuess authored Aug 4, 2024
2 parents f9bd68a + f7f4b9a commit be313b1
Show file tree
Hide file tree
Showing 22 changed files with 279 additions and 346 deletions.
21 changes: 19 additions & 2 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,23 @@

Change log history for Prism.Avalonia

## v9.0.401-pre (20204-04-13)
## v9.0.401.11110-pre (2024-08-03)

* Upgraded to Avalonia v11.1.1
* Fixed ItemsControlRegionAdapter not attaching object due to previous binding

## v9.0.401.11074-pre (2024-07-26)

* Prism.Core v9.0.401-pre
* Removed dependency on Avalonia.ReactiveUI
* Updated documentation
* Synced with latest develop

## v9.0.401.11000-pre (2024-04-28)

* Fixed Prism.Core targeting v9.0.401-pre

## v9.0.401.11074-pre (2024-04-13)

* Fixed typos
* DynamicallyAccessedMembers Attribute for linker hints
Expand All @@ -11,8 +27,9 @@ Change log history for Prism.Avalonia
## v9.0.271-pre (2024-04-12)

* Upgraded Prism.Core to v9.0.271-pre
* Using Prism.Container
* Breaking Changes:
* `Prism.Dialog`
* `Prism.Dialog` [see PR #128](https://github.com/AvaloniaCommunity/Prism.Avalonia/pull/128)
* `Prism.Region` -> `Prism.Navigation.Region`

## v8.1.97.11073 (2024-04-28)
Expand Down
23 changes: 9 additions & 14 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
<Project>

<!-- Prism -->
<ItemGroup>
<PackageVersion Include="Prism.Core" Version="9.0.401-pre" />
<PackageVersion Include="Prism.Container.Abstractions" Version="9.0.84-pre" />
<PackageVersion Include="Prism.Container.DryIoc" Version="9.0.84-pre" />
<PackageVersion Include="Prism.Container.Unity" Version="9.0.84-pre" />
</ItemGroup>

<!-- Avalonia -->
<ItemGroup>
<PackageVersion Include="Avalonia" Version="11.0.7" />
<PackageVersion Include="Avalonia.Desktop" Version="11.0.7" />
<PackageVersion Include="Avalonia.Diagnostics" Version="11.0.7" />
<PackageVersion Include="Avalonia.LinuxFramebuffer" Version="11.0.7" />
<PackageVersion Include="Avalonia.Markup.Xaml.Loader" Version="11.0.7" />
<PackageVersion Include="Avalonia" Version="11.1.1" />
<PackageVersion Include="Avalonia.Desktop" Version="11.1.1" />
<PackageVersion Include="Avalonia.Diagnostics" Version="11.1.1" />
<PackageVersion Include="Avalonia.LinuxFramebuffer" Version="11.1.1" />
<PackageVersion Include="Avalonia.Markup.Xaml.Loader" Version="11.1.1" />
<PackageVersion Include="Avalonia.ReactiveUI" Version="11.0.7" />
<PackageVersion Include="Avalonia.Themes.Simple" Version="11.0.7" />
<PackageVersion Include="Avalonia.Themes.Fluent" Version="11.0.7" />
<PackageVersion Include="Avalonia.Themes.Simple" Version="11.1.1" />
<PackageVersion Include="Avalonia.Themes.Fluent" Version="11.1.1" />
</ItemGroup>

<!-- 3rd-Party -->
<ItemGroup>
<PackageVersion Include="DryIoc.dll" Version="5.4.3" />
Expand All @@ -30,18 +27,16 @@
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.6.133" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
</ItemGroup>

<!-- Tests -->
<ItemGroup>
<!--<PackageVersion Include="MSTest.TestAdapter" Version="1.3.2" />
<PackageVersion Include="MSTest.TestFramework" Version="1.3.2" />-->

<PackageVersion Include="coverlet.collector" Version="6.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="Moq" Version="4.20.70" />
<PackageVersion Include="System.CodeDom" Version="6.0.0" />
<PackageVersion Include="xunit" Version="2.6.6" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.6"/>
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.6" />
<PackageVersion Include="Xunit.StaFact" Version="1.1.11" />
</ItemGroup>
</Project>
</Project>
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
> **Announcement!**
>
> * _Prism.Avalonia v9.0.401-pre just arrived!_
> * _Prism.Avalonia v9.0.271-pre just arrived!_
> * _Support for Avalonia v11.1.x has arrived!_
> * Follow the [Upgrading to Prism v9.0.x-pre](https://github.com/AvaloniaCommunity/Prism.Avalonia/wiki/Upgrading-to-Prism-v9.0) guide for breaking changes
**For more samples outside of this repo, check out:**
Expand All @@ -21,7 +21,7 @@ With Prism.Avalonia's logic and development approach being **similar** to that o

## Package Releases

Just like Prism.WPF or Prism.Maui, your project must reference both the Prism.Avalonia (_Core_) and Prism.DryIoc.Avalonia (_IoC container_) packages to work.
Just like _Prism.WPF or Prism.Maui_, your project must reference both the **Prism.Avalonia** (_Core_) and **Prism.DryIoc.Avalonia** (_IoC container_) packages to work.

| Package | Stable | Preview
|-|-|-|
Expand All @@ -34,9 +34,10 @@ Choose the NuGet package version that matches your Avalonia version.

Our [versioning schema](https://github.com/AvaloniaCommunity/Prism.Avalonia/wiki/Versioning-Schema) is based on the [SemVer](https://semver.org/) using the format `MAJOR.MINOR.PATCH.REVISION`. The `REVISION` segment indicates the Avalonia version support. For instance `v8.1.97.11073` equates to, Prism `v8.1.97`, Avalonia `v11.0.7`, _revision_ `3`.

| Prism Version | Avalonia Version | NuGet Package
| Prism | Avalonia | Prism.Avalonia NuGet Package
|-|-|-
| v9.0.401-pre | **11.0.7** | v9.0.401.11000-pre ([Core](https://www.nuget.org/packages/Prism.Avalonia/9.0.401.11000-pre)) ([DryIoc](https://www.nuget.org/packages/Prism.DryIoc.Avalonia/9.0.401.11000-pre))
| v9.0.401-pre | **11.1.1** | v9.0.401.11110-pre ([Core](https://www.nuget.org/packages/Prism.Avalonia/9.0.401.11110-pre)) ([DryIoc](https://www.nuget.org/packages/Prism.DryIoc.Avalonia/9.0.401.11110-pre))
| v9.0.401-pre | **11.0.7** | v9.0.401.11074-pre ([Core](https://www.nuget.org/packages/Prism.Avalonia/9.0.401.11074-pre)) ([DryIoc](https://www.nuget.org/packages/Prism.DryIoc.Avalonia/9.0.401.11074-pre))
| v9.0.271-pre | **11.0.7** | v9.0.271.11000-pre ([Core](https://www.nuget.org/packages/Prism.Avalonia/9.0.271.11000-pre)) ([DryIoc](https://www.nuget.org/packages/Prism.DryIoc.Avalonia/9.0.271.11000-pre))
| v8.1.97 | **11.0.7** | v8.1.97.11073 ([Core](https://www.nuget.org/packages/Prism.Avalonia/8.1.97.11073)) ([DryIoc](https://www.nuget.org/packages/Prism.DryIoc.Avalonia/8.1.97.11073))
| v8.1.97 | **0.10.21** | v8.1.97.1021 ([Core](https://www.nuget.org/packages/Prism.Avalonia/8.1.97.1021)) ([DryIoc](https://www.nuget.org/packages/Prism.DryIoc.Avalonia/8.1.97.1021))
Expand All @@ -62,7 +63,11 @@ Issues posted without a description may be closed immediately. Use the discussio
Add the Prism.Avalonia and its DryIoc packages to your project:

```powershell
# Avalonia v11
# Latest Preview Release
Install-Package Prism.Avalonia -Version 9.0.401.11110-pre
Install-Package Prism.DryIoc.Avalonia -Version 9.0.401.11110-pre
# Avalonia v11 (GA)
Install-Package Prism.Avalonia -Version 8.1.97.11073
Install-Package Prism.DryIoc.Avalonia -Version 8.1.97.11073
Expand Down
18 changes: 7 additions & 11 deletions Upgrading-Prism.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,16 @@ This file documents the upgrade path from Prism v8.1.97 to v9.0-pre support. Soo

Each of the following will be tagged and merged into the branch `Prism-9x` before being merged with `develop` and `master` branches.

**Progress:**

* [/] 9.0.271-pre - Will be tagged and released
* [ ] 9.0.401-pre - Will be tagged and released

### Release Comparison

As we all know, not everything is straight forward between these two XAML technologies. However, it's a good reminder to document the differences and 'got-yas'.

* [Prism v7.2.0.1422 to v8.0.0.1909](https://github.com/PrismLibrary/Prism/compare/v7.2.0.1422...v8.0.0.1909)
* [Prism v7.2.0.1422 to v8.1.97](https://github.com/PrismLibrary/Prism/compare/v7.2.0.1422...v8.1.97)
* [Prism v8.0.0.1909 to v8.1.97](https://github.com/PrismLibrary/Prism/compare/v8.0.0.1909...v8.1.97)
* [DNF - 9.0.264-pre](https://github.com/PrismLibrary/Prism/compare/DNF...9.0.264-pre) - (_DNF = Dot Net Foundation_)
* [9.0.264-pre - 9.0.274-pre](https://github.com/PrismLibrary/Prism/compare/9.0.264-pre...9.0.271-pre)
* [9.0.274-pre - 9.0.401-pre](https://github.com/PrismLibrary/Prism/compare/9.0.271-pre...9.0.401-pre)
* [9.0.264-pre - 9.0.274-pre](https://github.com/PrismLibrary/Prism/compare/9.0.264-pre...9.0.271-pre)
* [DNF - 9.0.264-pre](https://github.com/PrismLibrary/Prism/compare/DNF...9.0.264-pre) - (_DNF = Dot Net Foundation_)
* [Prism v8.0.0.1909 to v8.1.97](https://github.com/PrismLibrary/Prism/compare/v8.0.0.1909...v8.1.97)
* [Prism v7.2.0.1422 to v8.1.97](https://github.com/PrismLibrary/Prism/compare/v7.2.0.1422...v8.1.97)
* [Prism v7.2.0.1422 to v8.0.0.1909](https://github.com/PrismLibrary/Prism/compare/v7.2.0.1422...v8.0.0.1909)

### Changes

Expand Down Expand Up @@ -529,7 +524,8 @@ public class ItemMetadata : AvaloniaObject

### Property

Note
Note:

* Avalonia places WPF's `propertyType` as part of `TValue` in `<THost, TValue>`
* The `THost` object type is what is used in the Get and Set methods.

Expand Down
2 changes: 1 addition & 1 deletion build/Base.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Version>9.0.401.11074-pre</Version>
<Version>9.0.401.11110-pre</Version>
<PackageProjectUrl>https://github.com/AvaloniaCommunity/Prism.Avalonia</PackageProjectUrl>
<Copyright>Copyright (c) 2024 Xeno Innovations, Inc.</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
4 changes: 2 additions & 2 deletions build/Nuget.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageReleaseNotes>
* Upgraded to support Avalonia v11.1.1
* Upgraded to support Prism v9.0.401-pre
* Upgraded to support Avalonia v11.0.7
* Removed dependency on Avalonia.ReactiveUI
* Fixed ItemsControlRegionAdapter not attaching object due to previous binding (Avalonia v11.x)
</PackageReleaseNotes>
</PropertyGroup>

Expand Down
33 changes: 16 additions & 17 deletions e2e/DummyModule1/DummyModule1.cs
Original file line number Diff line number Diff line change
@@ -1,54 +1,53 @@
// Temp disabled logging:
// - Prism.Logging has been moved and `ILoggerFacade` is deprecated.Prism.Logging.Serilog is out of date.
// - https://github.com/augustoproiete/prism-logging-serilog/issues/3
using System.Threading;
using System.Threading;
using DummyModule.View;
using ModulesSample.Infrastructure;
using Prism.Avalonia.Infrastructure.Events;
using Prism.Events;
using Prism.Ioc;
////using Prism.Logging;
using Prism.Modularity;
using Prism.Navigation.Regions;

namespace DummyModule
{
public class DummyModule1 : IModule
{
////private readonly ILoggerFacade _logger;
private readonly IModuleTracker _moduleTracker;

private readonly IEventAggregator _eventAggregator;
private readonly IRegionManager _regionManager;

public DummyModule1(IModuleTracker moduleTracker, IEventAggregator eventAggregator, IRegionManager regionManager)
////public DummyModule1(ILoggerFacade logger, IModuleTracker moduleTracker, IEventAggregator eventAggregator, IRegionManager regionManager)
{
////_logger = logger;
_moduleTracker = moduleTracker;
_eventAggregator = eventAggregator;
_regionManager = regionManager;
}

private void DummyEventPublisher()
{
while (true)
{
Thread.Sleep(2500);
_eventAggregator.GetEvent<DummyEvent>().Publish();
}
_moduleTracker.RecordModuleConstructed(ModuleNames.ModuleDummy1);
}

public void RegisterTypes(IContainerRegistry containerRegistry)
{
_moduleTracker.RecordModuleLoaded(ModuleNames.ModuleDummy1);
}

public void OnInitialized(IContainerProvider containerProvider)
{
Thread thread = new Thread(new ThreadStart(DummyEventPublisher));
// Send Event messages for subscribers to react to
Thread thread = new(new ThreadStart(DummyEventPublisher));
thread.Start();

_regionManager.RegisterViewWithRegion(RegionNames.Region1, typeof(DummyModuleView));
_moduleTracker.RecordModuleInitialized(ModuleNames.ModuleDummy1);
}

/// <summary>Publish events to subscribers.</summary>
private void DummyEventPublisher()
{
while (true)
{
Thread.Sleep(500);
_eventAggregator.GetEvent<DummyEvent>().Publish();
}
}
}
}
5 changes: 4 additions & 1 deletion e2e/DummyModule2/DumyModule2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,19 @@ public DummyModule2(IModuleTracker moduleTracker, IRegionManager regionManager)
{
_moduleTracker = moduleTracker;
_regionManager = regionManager;

_moduleTracker.RecordModuleConstructed(ModuleNames.ModuleDummy2);
}

public void OnInitialized(IContainerProvider containerProvider)
{
_moduleTracker.RecordModuleInitialized(ModuleNames.ModuleDummy1);
_moduleTracker.RecordModuleInitialized(ModuleNames.ModuleDummy2);
_regionManager.RegisterViewWithRegion(RegionNames.Region2, typeof(DummyModuleView2));
}

public void RegisterTypes(IContainerRegistry containerRegistry)
{
_moduleTracker.RecordModuleLoaded(ModuleNames.ModuleDummy2);
}
}
}
22 changes: 13 additions & 9 deletions e2e/DummyModule2/Views/DummyModuleView2.axaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:prism="clr-namespace:Prism.Navigation.Regions.Behaviors;assembly=Prism.Avalonia"
xmlns:prism="http://prismlibrary.com/"
xmlns:prismBehaviors="clr-namespace:Prism.Navigation.Regions.Behaviors;assembly=Prism.Avalonia"
xmlns:prismRegions="clr-namespace:Prism.Navigation.Regions;assembly=Prism.Avalonia"
x:Class="DummyModule2.View.DummyModuleView2">
<Grid>
<TextBox Name="RegionViewTextBox"
Text="DummyModule2 Region View"
IsReadOnly="True" />

<ItemsControl prismRegions:RegionManager.RegionName="ListRegion"></ItemsControl>
x:Class="DummyModule2.View.DummyModuleView2"
prism:ViewModelLocator.AutoWireViewModel="True">
<Grid RowDefinitions="Auto,150">
<Label Content="DummyModule2 Region View"
FontWeight="Bold"
Name="RegionViewTextBox" />

<ScrollViewer Grid.Row="1">
<ItemsControl prismRegions:RegionManager.RegionName="ListRegion" />
</ScrollViewer>
</Grid>
</UserControl>
</UserControl>
18 changes: 13 additions & 5 deletions e2e/DummyModule2/Views/DummyModuleView2.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ namespace DummyModule2.View
public partial class DummyModuleView2 : UserControl
{
private readonly IEventAggregator _eventAggregator;
private TextBox _regionViewTextBox;
private readonly Label _regionViewTextBox;
private int _counter = 0;

public DummyModuleView2()
{
// Placed here so Avalonia viewer doesn't freak out
// Since we're not using an MVVM approach here
}

public DummyModuleView2(IEventAggregator eventAggregator, IRegionManager regionManager)
Expand All @@ -22,18 +25,23 @@ public DummyModuleView2(IEventAggregator eventAggregator, IRegionManager regionM

InitializeComponent();

_regionViewTextBox = this.FindControl<TextBox>("RegionViewTextBox");
_regionViewTextBox = this.FindControl<Label>("RegionViewTextBox");

// Note: 'keepSubscriberReferenceAlive' is set to true to avoid the WeakReferene
eventAggregator.GetEvent<DummyEvent>().Subscribe(() =>
{
Dispatcher.UIThread.InvokeAsync(() =>
{
_counter++;

regionManager.AddToRegion(
RegionNames.ListRegion,
new TextBlock { Text = "EventAggregator DummyEvent triggered for DummyModule2" });
new TextBlock { Text = $"EventAggregator DummyEvent triggered for DummyModule2: {_counter}" });

//_regionViewTextBox.Text += "\n EventAggregator DummyEvent triggered for DummyModule2 \r\n";
_regionViewTextBox.Content = $"EventAggregator DummyEvent triggered for DummyModule2: {_counter}";
});
});
},
keepSubscriberReferenceAlive: true);
}
}
}
5 changes: 2 additions & 3 deletions e2e/ModulesSample.Infrastructure/Events/DummyEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Prism.Avalonia.Infrastructure.Events
{
public class DummyEvent : PubSubEvent
{

{
}
}
}
Loading

0 comments on commit be313b1

Please sign in to comment.