Skip to content

Commit

Permalink
feat: .net core 5.0 (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
FantasticFiasco authored Nov 19, 2020
1 parent 79033e4 commit 6d4a6eb
Show file tree
Hide file tree
Showing 20 changed files with 50 additions and 45 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This project adheres to [Semantic Versioning](http://semver.org/) and is followi
### :zap: Added

- Support for .NET Core 3.1
- Support for .NET Core 5.0

### :syringe: Changed

Expand Down
4 changes: 4 additions & 0 deletions MvvmDialogs.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<group targetFramework=".NETFramework4.6.2" />
<group targetFramework=".NETFramework4.7.2" />
<group targetFramework=".NETCoreApp3.1" />
<group targetFramework="net5.0-windows7.0" />
<group targetFramework="UAP10.0" />
</dependencies>
</metadata>
Expand Down Expand Up @@ -50,6 +51,9 @@
<file src="src\net\bin\Release\netcoreapp3.1\MvvmDialogs.dll" target="lib\netcoreapp3.1\MvvmDialogs.dll" />
<file src="src\net\bin\Release\netcoreapp3.1\MvvmDialogs.xml" target="lib\netcoreapp3.1\MvvmDialogs.xml" />
<file src="src\net\bin\Release\netcoreapp3.1\MvvmDialogs.pdb" target="lib\netcoreapp3.1\MvvmDialogs.pdb" />
<file src="src\net\bin\Release\net5.0-windows\MvvmDialogs.dll" target="lib\net5.0-windows7.0\MvvmDialogs.dll" />
<file src="src\net\bin\Release\net5.0-windows\MvvmDialogs.xml" target="lib\net5.0-windows7.0\MvvmDialogs.xml" />
<file src="src\net\bin\Release\net5.0-windows\MvvmDialogs.pdb" target="lib\net5.0-windows7.0\MvvmDialogs.pdb" />

<!-- UWP -->
<file src="src\universal\bin\Release\MvvmDialogs.dll" target="lib\uap10.0\MvvmDialogs.dll" />
Expand Down
6 changes: 0 additions & 6 deletions global.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFrameworks>netcoreapp3.1;net5.0-windows</TargetFrameworks>
<UseWPF>true</UseWPF>
<RootNamespace>Demo.ActivateNonModalDialog</RootNamespace>
<AssemblyName>Demo.ActivateNonModalDialog</AssemblyName>
Expand All @@ -17,4 +17,4 @@
<PackageReference Include="MvvmLightLibsStd10" Version="5.4.1.1" />
</ItemGroup>

</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFrameworks>netcoreapp3.1;net5.0-windows</TargetFrameworks>
<UseWPF>true</UseWPF>
<RootNamespace>Demo.CloseNonModalDialog</RootNamespace>
<AssemblyName>Demo.CloseNonModalDialog</AssemblyName>
Expand All @@ -17,4 +17,4 @@
<PackageReference Include="MvvmLightLibsStd10" Version="5.4.1.1" />
</ItemGroup>

</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFrameworks>netcoreapp3.1;net5.0-windows</TargetFrameworks>
<UseWPF>true</UseWPF>
<RootNamespace>Demo.CustomFolderBrowserDialog</RootNamespace>
<AssemblyName>Demo.CustomFolderBrowserDialog</AssemblyName>
Expand All @@ -18,4 +18,4 @@
<PackageReference Include="Ookii.Dialogs.Wpf" Version="3.0.1" />
</ItemGroup>

</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFrameworks>netcoreapp3.1;net5.0-windows</TargetFrameworks>
<UseWPF>true</UseWPF>
<RootNamespace>Demo.CustomMessageBox</RootNamespace>
<AssemblyName>Demo.CustomMessageBox</AssemblyName>
Expand All @@ -18,4 +18,4 @@
<PackageReference Include="Ookii.Dialogs.Wpf" Version="3.0.1" />
</ItemGroup>

</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFrameworks>netcoreapp3.1;net5.0-windows</TargetFrameworks>
<UseWPF>true</UseWPF>
<RootNamespace>Demo.CustomOpenFileDialog</RootNamespace>
<AssemblyName>Demo.CustomOpenFileDialog</AssemblyName>
Expand All @@ -24,4 +24,4 @@
</None>
</ItemGroup>

</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFrameworks>netcoreapp3.1;net5.0-windows</TargetFrameworks>
<UseWPF>true</UseWPF>
<RootNamespace>Demo.CustomSaveFileDialog</RootNamespace>
<AssemblyName>Demo.CustomSaveFileDialog</AssemblyName>
Expand All @@ -18,4 +18,4 @@
<PackageReference Include="MvvmLightLibsStd10" Version="5.4.1.1" />
</ItemGroup>

</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFrameworks>netcoreapp3.1;net5.0-windows</TargetFrameworks>
<UseWPF>true</UseWPF>
<RootNamespace>Demo.FolderBrowserDialog</RootNamespace>
<AssemblyName>Demo.FolderBrowserDialog</AssemblyName>
Expand All @@ -16,4 +16,4 @@
<PackageReference Include="MvvmLightLibsStd10" Version="5.4.1.1" />
</ItemGroup>

</Project>
</Project>
4 changes: 2 additions & 2 deletions samples/net-core/Demo.MessageBox/Demo.MessageBox.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFrameworks>netcoreapp3.1;net5.0-windows</TargetFrameworks>
<UseWPF>true</UseWPF>
<RootNamespace>Demo.MessageBox</RootNamespace>
<AssemblyName>Demo.MessageBox</AssemblyName>
Expand All @@ -16,4 +16,4 @@
<PackageReference Include="MvvmLightLibsStd10" Version="5.4.1.1" />
</ItemGroup>

</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFrameworks>netcoreapp3.1;net5.0-windows</TargetFrameworks>
<UseWPF>true</UseWPF>
<RootNamespace>Demo.ModalCustomDialog</RootNamespace>
<AssemblyName>Demo.ModalCustomDialog</AssemblyName>
Expand All @@ -16,4 +16,4 @@
<PackageReference Include="MvvmLightLibsStd10" Version="5.4.1.1" />
</ItemGroup>

</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFrameworks>netcoreapp3.1;net5.0-windows</TargetFrameworks>
<UseWPF>true</UseWPF>
<RootNamespace>Demo.ModalDialog</RootNamespace>
<AssemblyName>Demo.ModalDialog</AssemblyName>
Expand All @@ -16,4 +16,4 @@
<PackageReference Include="MvvmLightLibsStd10" Version="5.4.1.1" />
</ItemGroup>

</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFrameworks>netcoreapp3.1;net5.0-windows</TargetFrameworks>
<UseWPF>true</UseWPF>
<RootNamespace>Demo.NonModalCustomDialog</RootNamespace>
<AssemblyName>Demo.NonModalCustomDialog</AssemblyName>
Expand All @@ -17,4 +17,4 @@
<PackageReference Include="MvvmLightLibsStd10" Version="5.4.1.1" />
</ItemGroup>

</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFrameworks>netcoreapp3.1;net5.0-windows</TargetFrameworks>
<UseWPF>true</UseWPF>
<RootNamespace>Demo.NonModalDialog</RootNamespace>
<AssemblyName>Demo.NonModalDialog</AssemblyName>
Expand All @@ -17,4 +17,4 @@
<PackageReference Include="MvvmLightLibsStd10" Version="5.4.1.1" />
</ItemGroup>

</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFrameworks>netcoreapp3.1;net5.0-windows</TargetFrameworks>
<UseWPF>true</UseWPF>
<RootNamespace>Demo.OpenFileDialog</RootNamespace>
<AssemblyName>Demo.OpenFileDialog</AssemblyName>
Expand All @@ -22,4 +22,4 @@
</None>
</ItemGroup>

</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFrameworks>netcoreapp3.1;net5.0-windows</TargetFrameworks>
<UseWPF>true</UseWPF>
<RootNamespace>Demo.SaveFileDialog</RootNamespace>
<AssemblyName>Demo.SaveFileDialog</AssemblyName>
Expand All @@ -16,4 +16,4 @@
<PackageReference Include="MvvmLightLibsStd10" Version="5.4.1.1" />
</ItemGroup>

</Project>
</Project>
20 changes: 12 additions & 8 deletions src/net/DialogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,16 @@ public bool Activate(INotifyPropertyChanged viewModel)
{
if (viewModel == null) throw new ArgumentNullException(nameof(viewModel));

return (
from Window? window in Application.Current.Windows
where window != null
where viewModel.Equals(window.DataContext)
select window.Activate()
).FirstOrDefault();
Window? windowToActivate =
(
from Window? window in Application.Current.Windows
where window != null
where viewModel.Equals(window.DataContext)
select window
)
.FirstOrDefault();

return windowToActivate?.Activate() ?? false;
}

/// <inheritdoc />
Expand Down Expand Up @@ -305,7 +309,7 @@ private static PropertyChangedEventHandler RegisterDialogResult(
IWindow dialog,
IModalDialogViewModel viewModel)
{
void Handler(object sender, PropertyChangedEventArgs e)
void Handler(object? sender, PropertyChangedEventArgs e)
{
if (e.PropertyName != DialogResultPropertyName || dialog.DialogResult == viewModel.DialogResult)
return;
Expand All @@ -329,7 +333,7 @@ private static void UnregisterDialogResult(
/// </summary>
private static Window FindOwnerWindow(INotifyPropertyChanged viewModel)
{
IView view = DialogServiceViews.Views.SingleOrDefault(
IView? view = DialogServiceViews.Views.SingleOrDefault(
registeredView =>
registeredView.Source.IsLoaded &&
ReferenceEquals(registeredView.DataContext, viewModel));
Expand Down
4 changes: 3 additions & 1 deletion src/net/FrameworkDialogs/FileDialogSettings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.Collections.Generic;
#if !PRE_NET40
using System.Collections.Generic;
#endif
using System.Windows.Forms;

namespace MvvmDialogs.FrameworkDialogs
Expand Down
2 changes: 1 addition & 1 deletion src/net/MvvmDialogs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Lets have the .NET Framework version listed first, otherwise we will get build warnings in Visual Studio.
See https://github.com/dotnet/project-system/issues/1162 for more information.
-->
<TargetFrameworks>net472;net462;net452;net45;net40;net35;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net472;net462;net452;net45;net40;net35;netcoreapp3.1;net5.0-windows</TargetFrameworks>
<AssemblyTitle>MVVM Dialogs</AssemblyTitle>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
<SignAssembly>true</SignAssembly>
Expand Down

0 comments on commit 6d4a6eb

Please sign in to comment.