Skip to content

Commit

Permalink
feat: Add .NET 9.0 support, update packages, and refactor
Browse files Browse the repository at this point in the history
Updated Directory.build.props to support net8.0 and net9.0, and updated MyNet package versions.
Remove ICommand interface. Use System.Windows.Input.ICommand.
Updated Fody in MyNet.UI.csproj to 6.9.1.
Changed namespaces in IDisplayMode.cs and IDisplayViewModel.cs.

BREAKING CHANGE: Add .NET 9.0 support. Remove ICommand interface.
  • Loading branch information
Stéphane ANDRE (E104915) committed Dec 21, 2024
1 parent 308f8ef commit cbcf314
Show file tree
Hide file tree
Showing 46 changed files with 57 additions and 36 deletions.
2 changes: 1 addition & 1 deletion src/Directory.build.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<!-- Configuration -->
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<BaseOutputPath>bin</BaseOutputPath>
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
<Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
Expand Down
1 change: 1 addition & 0 deletions src/MyNet.UI/Busy/Models/Busy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// See the LICENSE file in the project root for more information.

using System;
using System.Windows.Input;
using MyNet.Observable;
using MyNet.UI.Commands;

Expand Down
1 change: 1 addition & 0 deletions src/MyNet.UI/Commands/CommandsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// See the LICENSE file in the project root for more information.

using System;
using System.Windows.Input;

namespace MyNet.UI.Commands
{
Expand Down
9 changes: 0 additions & 9 deletions src/MyNet.UI/Commands/ICommand.cs

This file was deleted.

1 change: 1 addition & 0 deletions src/MyNet.UI/Commands/ICommandFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// See the LICENSE file in the project root for more information.

using System;
using System.Windows.Input;

namespace MyNet.UI.Commands
{
Expand Down
1 change: 1 addition & 0 deletions src/MyNet.UI/Commands/RelayCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// See the LICENSE file in the project root for more information.

using System;
using System.Windows.Input;

namespace MyNet.UI.Commands
{
Expand Down
1 change: 1 addition & 0 deletions src/MyNet.UI/Commands/RelayCommandFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// See the LICENSE file in the project root for more information.

using System;
using System.Windows.Input;

namespace MyNet.UI.Commands
{
Expand Down
2 changes: 1 addition & 1 deletion src/MyNet.UI/Locators/NamingConvention.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public static string ResolveNamingConvention(Dictionary<string, string> constant
{
var fullnamespace = GetParentPath(value);
var separator = GetParentSeparator(fullnamespace) ?? string.Empty;
var namespaces = fullnamespace.Split(new[] { separator }, StringSplitOptions.RemoveEmptyEntries).ToList();
var namespaces = fullnamespace.Split([separator], StringSplitOptions.RemoveEmptyEntries).ToList();

var result = conventionToUse;

Expand Down
12 changes: 6 additions & 6 deletions src/MyNet.UI/MyNet.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Fody" Version="6.8.2">
<PackageReference Include="Fody" Version="6.9.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="MyNet.DynamicData.Extensions" Version="2.2.1-pre.1" />
<PackageReference Include="MyNet.Observable" Version="6.0.1-pre.7" />
<PackageReference Include="MyNet.Observable.Collections" Version="6.0.1-pre.7" />
<PackageReference Include="MyNet.Observable.Translatables" Version="6.0.1-pre.7" />
<PackageReference Include="MyNet.Utilities" Version="5.2.1-pre.6" />
<PackageReference Include="MyNet.DynamicData.Extensions" Version="3.0.0" />
<PackageReference Include="MyNet.Observable" Version="7.0.0" />
<PackageReference Include="MyNet.Observable.Collections" Version="7.0.0" />
<PackageReference Include="MyNet.Observable.Translatables" Version="7.0.0" />
<PackageReference Include="MyNet.Utilities" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/MyNet.UI/Services/Handlers/FileNotification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// See the LICENSE file in the project root for more information.

using System;
using System.Windows.Input;
using MyNet.UI.Commands;
using MyNet.UI.Notifications;
using MyNet.UI.Resources;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

using System;
using System.ComponentModel;
using System.Windows.Input;
using MyNet.Observable;
using MyNet.UI.Commands;
using MyNet.UI.ViewModels.FileHistory;
using MyNet.UI.ViewModels.List;
using MyNet.UI.ViewModels.List.Filtering;
Expand Down
1 change: 1 addition & 0 deletions src/MyNet.UI/ViewModels/Dialogs/DialogViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.ComponentModel;
using System.Threading.Tasks;
using System.Windows.Input;
using MyNet.Observable;
using MyNet.Observable.Attributes;
using MyNet.UI.Commands;
Expand Down
3 changes: 1 addition & 2 deletions src/MyNet.UI/ViewModels/Display/DisplayMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Windows.Input;
using MyNet.Observable.Attributes;
using MyNet.Observable.Translatables;
using MyNet.UI.Commands;
Expand Down
5 changes: 3 additions & 2 deletions src/MyNet.UI/ViewModels/Display/DisplayViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows.Input;
using MyNet.Observable;
using MyNet.UI.Commands;

Expand All @@ -29,9 +30,9 @@ public DisplayViewModel(IEnumerable<IDisplayMode> allowedModes, IDisplayMode? de

public void SetMode<T>() where T : IDisplayMode => Mode = AllowedModes.OfType<T>().FirstOrDefault();

public void SetMode(Type type) => Mode = AllowedModes.Where(x => x.GetType() == type).FirstOrDefault();
public void SetMode(Type type) => Mode = AllowedModes.FirstOrDefault(x => x.GetType() == type);

public void SetMode(string key) => Mode = AllowedModes.Where(x => x.Key == key).FirstOrDefault();
public void SetMode(string key) => Mode = AllowedModes.FirstOrDefault(x => x.Key == key);

public DisplayViewModel AddMode(IDisplayMode mode, bool isDefault = false)
{
Expand Down
2 changes: 1 addition & 1 deletion src/MyNet.UI/ViewModels/Display/IDisplayMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using MyNet.Observable;

namespace MyNet.UI.ViewModels
namespace MyNet.UI.ViewModels.Display
{
public interface IDisplayMode : IProvideValue<string>
{
Expand Down
2 changes: 1 addition & 1 deletion src/MyNet.UI/ViewModels/Display/IDisplayViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Collections.ObjectModel;
using System.ComponentModel;

namespace MyNet.UI.ViewModels
namespace MyNet.UI.ViewModels.Display
{
public interface IDisplayViewModel : INotifyPropertyChanged
{
Expand Down
1 change: 1 addition & 0 deletions src/MyNet.UI/ViewModels/Edition/EditionViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Input;
using MyNet.Observable.Attributes;
using MyNet.UI.Commands;
using MyNet.UI.Dialogs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.Collections.ObjectModel;
using System.Linq;
using System.Windows.Input;
using DynamicData.Binding;
using MyNet.DynamicData.Extensions;
using MyNet.Observable;
Expand Down
1 change: 1 addition & 0 deletions src/MyNet.UI/ViewModels/Export/ExportViewModelBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Input;
using MyNet.Humanizer;
using MyNet.UI.Commands;
using MyNet.UI.Resources;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Input;
using DynamicData;
using DynamicData.Binding;
using MyNet.Observable.Attributes;
Expand Down
1 change: 1 addition & 0 deletions src/MyNet.UI/ViewModels/Export/FileExportViewModelBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Threading.Tasks;
using System.Windows.Input;
using MyNet.Observable.Attributes;
using MyNet.UI.Commands;
using MyNet.UI.Dialogs;
Expand Down
1 change: 1 addition & 0 deletions src/MyNet.UI/ViewModels/FileHistory/RecentFileViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.IO;
using System.Threading.Tasks;
using System.Windows.Input;
using MyNet.Observable;
using MyNet.UI.Busy;
using MyNet.UI.Commands;
Expand Down
1 change: 1 addition & 0 deletions src/MyNet.UI/ViewModels/IListViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.Collections;
using System.Collections.ObjectModel;
using MyNet.UI.ViewModels.Display;
using MyNet.UI.ViewModels.List;
using MyNet.UI.ViewModels.List.Filtering;
using MyNet.UI.ViewModels.List.Grouping;
Expand Down
1 change: 0 additions & 1 deletion src/MyNet.UI/ViewModels/Import/ImportDialogViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using MyNet.UI.Selection;
using MyNet.UI.Toasting;
using MyNet.UI.Toasting.Settings;
using MyNet.UI.ViewModels.Dialogs;
using MyNet.UI.ViewModels.List;
using MyNet.Utilities.Providers;

Expand Down
1 change: 1 addition & 0 deletions src/MyNet.UI/ViewModels/Import/ImportablesListViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Reactive.Linq;
using System.Windows.Input;
using DynamicData;
using MyNet.Observable.Attributes;
using MyNet.Observable.Collections.Providers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Windows.Input;
using MyNet.UI.Commands;
using MyNet.Utilities;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace MyNet.UI.ViewModels.List.Filtering
{
public class ExtendedFiltersViewModel : FiltersViewModel
{
private IReadOnlyCollection<IFilterViewModel> _defaultFilters;
private ReadOnlyCollection<IFilterViewModel> _defaultFilters;

public override bool IsReadOnly => true;

Expand All @@ -27,7 +27,7 @@ public class ExtendedFiltersViewModel : FiltersViewModel

public ObservableCollection<DisplayWrapper<IEnumerable<IFilterViewModel>>> PresetFilters { get; } = [];

public DisplayWrapper<IEnumerable<IFilterViewModel>>? SelectedPresetFilter { get; private set; }
public DisplayWrapper<IEnumerable<IFilterViewModel>>? SelectedPresetFilter { get; set; }

public ExtendedFiltersViewModel(IDictionary<string, Func<IFilterViewModel>> allowedFilters, SpeedFiltersViewModel speedFilters, IEnumerable<IFilterViewModel>? defaultFilters = null)
: this(allowedFilters.Select(x => new FilterProviderViewModel(x.Key, x.Value)), speedFilters, defaultFilters) { }
Expand Down
1 change: 1 addition & 0 deletions src/MyNet.UI/ViewModels/List/Filtering/FiltersViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Windows.Input;
using DynamicData;
using DynamicData.Binding;
using MyNet.DynamicData.Extensions;
Expand Down
1 change: 1 addition & 0 deletions src/MyNet.UI/ViewModels/List/Grouping/GroupingViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Windows.Input;
using DynamicData;
using DynamicData.Binding;
using DynamicData.Kernel;
Expand Down
1 change: 1 addition & 0 deletions src/MyNet.UI/ViewModels/List/IListParametersProvider.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Stéphane ANDRE. All Right Reserved.
// See the LICENSE file in the project root for more information.

using MyNet.UI.ViewModels.Display;
using MyNet.UI.ViewModels.List.Filtering;
using MyNet.UI.ViewModels.List.Grouping;
using MyNet.UI.ViewModels.List.Sorting;
Expand Down
2 changes: 1 addition & 1 deletion src/MyNet.UI/ViewModels/List/IPagingViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using System;
using System.ComponentModel;
using MyNet.UI.Commands;
using System.Windows.Input;

namespace MyNet.UI.ViewModels.List
{
Expand Down
3 changes: 2 additions & 1 deletion src/MyNet.UI/ViewModels/List/ListDialogViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// Copyright (c) Stéphane ANDRE. All Right Reserved.
// See the LICENSE file in the project root for more information.

using System.Windows.Input;
using MyNet.Observable.Attributes;
using MyNet.UI.Commands;
using MyNet.UI.ViewModels.Workspace;

namespace MyNet.UI.ViewModels.Dialogs
namespace MyNet.UI.ViewModels.List
{
[CanBeValidatedForDeclaredClassOnly(false)]
[CanSetIsModifiedAttributeForDeclaredClassOnly(false)]
Expand Down
2 changes: 2 additions & 0 deletions src/MyNet.UI/ViewModels/List/ListViewModelBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Threading.Tasks;
using System.Windows.Input;
using DynamicData;
using DynamicData.Binding;
using DynamicData.Operators;
Expand All @@ -23,6 +24,7 @@
using MyNet.UI.Dialogs;
using MyNet.UI.Dialogs.Models;
using MyNet.UI.Resources;
using MyNet.UI.ViewModels.Display;
using MyNet.UI.ViewModels.List.Filtering;
using MyNet.UI.ViewModels.List.Grouping;
using MyNet.UI.ViewModels.List.Sorting;
Expand Down
1 change: 1 addition & 0 deletions src/MyNet.UI/ViewModels/List/Paging/PagingViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows.Input;
using MyNet.Observable;
using MyNet.UI.Collections;
using MyNet.UI.Commands;
Expand Down
2 changes: 1 addition & 1 deletion src/MyNet.UI/ViewModels/List/SelectionDialogViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Input;
using DynamicData;
using MyNet.Observable.Attributes;
using MyNet.Observable.Collections.Providers;
using MyNet.UI.Commands;
using MyNet.UI.Resources;
using MyNet.UI.Selection;
using MyNet.UI.ViewModels.Dialogs;
using MyNet.Utilities.Providers;

namespace MyNet.UI.ViewModels.List
Expand Down
4 changes: 2 additions & 2 deletions src/MyNet.UI/ViewModels/List/SelectionListViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Collections.ObjectModel;
using System.Linq;
using System.Reactive.Linq;
using System.Windows.Input;
using DynamicData;
using DynamicData.Binding;
using MyNet.Observable.Attributes;
Expand All @@ -27,8 +28,7 @@ public abstract class SelectionListViewModel<T, TCollection> : WrapperListViewMo
where T : notnull
{
protected SelectionListViewModel(TCollection collection,
IListParametersProvider? parametersProvider = null,
SelectionMode? selectionMode = null) : base(collection, parametersProvider)
IListParametersProvider? parametersProvider = null) : base(collection, parametersProvider)
{
SelectCommand = CommandsManager.CreateNotNull<T>(Collection.Select, CanSelect);
SelectItemsCommand = CommandsManager.CreateNotNull<IEnumerable<T>>(Collection.Select, CanSelect);
Expand Down
2 changes: 1 addition & 1 deletion src/MyNet.UI/ViewModels/List/Sorting/ISortingViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// See the LICENSE file in the project root for more information.

using System;
using MyNet.UI.Commands;
using System.Windows.Input;

namespace MyNet.UI.ViewModels.List.Sorting
{
Expand Down
3 changes: 2 additions & 1 deletion src/MyNet.UI/ViewModels/List/Sorting/SortingViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Windows.Input;
using DynamicData;
using DynamicData.Binding;
using MyNet.DynamicData.Extensions;
Expand Down Expand Up @@ -51,7 +52,7 @@ public class SortingViewModel : EditableObject, ISortingViewModel, ICollection<I

public SortingViewModel() : this([]) { }

public SortingViewModel(string defaultProperty, ListSortDirection listSortDirection = ListSortDirection.Ascending) : this(new[] { defaultProperty }) { }
public SortingViewModel(string defaultProperty, ListSortDirection listSortDirection = ListSortDirection.Ascending) : this(new Dictionary<string, ListSortDirection> { { defaultProperty, listSortDirection } }) { }

public SortingViewModel(IList<string> defaultProperties) : this(defaultProperties.ToDictionary(x => x, _ => ListSortDirection.Ascending)) { }

Expand Down
Loading

0 comments on commit cbcf314

Please sign in to comment.