Skip to content

Commit

Permalink
add Net6 to all projects (#2632)
Browse files Browse the repository at this point in the history
* Target dot net 6 for all projects

* Update nuget packages to latest version

* Fixing nullability warnings

* Bumping up global.jon

Updating XAMLTest to latest

Co-authored-by: Kevin Bost <kitokeboo@gmail.com>
  • Loading branch information
ahmed-abdelrazek and Keboo committed Apr 3, 2022
1 parent 8af6429 commit 39a9ca5
Show file tree
Hide file tree
Showing 24 changed files with 87 additions and 85 deletions.
26 changes: 13 additions & 13 deletions Directory.packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@
<ItemGroup>
<PackageVersion Include="BluwolfIcons" Version="1.0.1" />
<PackageVersion Include="Dragablz" Version="0.0.3.223" />
<PackageVersion Include="Humanizer" Version="2.11.10" />
<PackageVersion Include="MahApps.Metro" Version="2.3.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.2" PrivateAssets="all" />
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="3.11.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="3.11.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.11.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="3.11.0" />
<PackageVersion Include="Humanizer" Version="2.14.1" />
<PackageVersion Include="MahApps.Metro" Version="2.4.9" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3" PrivateAssets="all" />
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="4.1.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.1.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.1.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.1.0" />
<PackageVersion Include="Microsoft.Composition" Version="1.0.31" />
<PackageVersion Include="Microsoft.CSharp" Version="4.7.0" />
<PackageVersion Include="Microsoft.NETCore.Platforms" Version="5.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageVersion Include="Microsoft.Toolkit.MVVM" Version="7.0.2" />
<PackageVersion Include="Newtonsoft.Json" Version="12.0.3" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageVersion Include="Microsoft.Toolkit.MVVM" Version="7.1.2" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.1" />
<PackageVersion Include="Shouldly" Version="4.0.3" />
<PackageVersion Include="ShowMeTheXAML" Version="2.0.0" />
<PackageVersion Include="ShowMeTheXAML.AvalonEdit" Version="2.0.0" />
<PackageVersion Include="ShowMeTheXAML.MSBuild" Version="2.0.0" />
<PackageVersion Include="VirtualizingWrapPanel" Version="1.5.4" />
<PackageVersion Include="XAMLTest" Version="1.0.0-ci221" />
<PackageVersion Include="VirtualizingWrapPanel" Version="1.5.7" />
<PackageVersion Include="XAMLTest" Version="1.0.0-ci233" />
<PackageVersion Include="xunit" Version="2.4.1" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.3" />
<PackageVersion Include="Xunit.StaFact" Version="1.0.37" />
<PackageVersion Include="Xunit.StaFact" Version="1.1.11" />
</ItemGroup>
</Project>
14 changes: 7 additions & 7 deletions MahMaterialDragablzMashUp/AnotherCommandImplementation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@ namespace MahMaterialDragablzMashUp
/// </summary>
public class AnotherCommandImplementation : ICommand
{
private readonly Action<object> _execute;
private readonly Func<object, bool> _canExecute;
private readonly Action<object?> _execute;
private readonly Func<object?, bool> _canExecute;

public AnotherCommandImplementation(Action<object> execute)
public AnotherCommandImplementation(Action<object?> execute)
: this(execute, null)
{
}

public AnotherCommandImplementation(Action<object> execute, Func<object, bool>? canExecute)
public AnotherCommandImplementation(Action<object?> execute, Func<object?, bool>? canExecute)
{
if (execute is null) throw new ArgumentNullException(nameof(execute));

_execute = execute;
_canExecute = canExecute ?? (x => true);
}

public bool CanExecute(object parameter) => _canExecute(parameter);
public bool CanExecute(object? parameter) => _canExecute(parameter);

public void Execute(object parameter) => _execute(parameter);
public void Execute(object? parameter) => _execute(parameter);

public event EventHandler CanExecuteChanged
public event EventHandler? CanExecuteChanged
{
add
{
Expand Down
4 changes: 2 additions & 2 deletions MahMaterialDragablzMashUp/MahAppsDragablzDemo.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net472;netcoreapp3.1;net6.0-windows</TargetFrameworks>
<UseWPF>true</UseWPF>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
Expand Down
6 changes: 3 additions & 3 deletions MahMaterialDragablzMashUp/PaletteSelectorViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ public PaletteSelectorViewModel()
IsDarkTheme = theme.GetBaseTheme() == BaseTheme.Dark;
}

public ICommand ToggleStyleCommand { get; } = new AnotherCommandImplementation(o => ApplyStyle((bool)o));
public ICommand ToggleStyleCommand { get; } = new AnotherCommandImplementation(o => ApplyStyle((bool)o!));

public IEnumerable<Swatch> Swatches { get; }

public ICommand ApplyPrimaryCommand { get; } = new AnotherCommandImplementation(o => ApplyPrimary((Swatch)o));
public ICommand ApplyPrimaryCommand { get; } = new AnotherCommandImplementation(o => ApplyPrimary((Swatch)o!));

public ICommand ApplyAccentCommand { get; } = new AnotherCommandImplementation(o => ApplyAccent((Swatch)o));
public ICommand ApplyAccentCommand { get; } = new AnotherCommandImplementation(o => ApplyAccent((Swatch)o!));

private bool _isDarkTheme;
public bool IsDarkTheme
Expand Down
14 changes: 7 additions & 7 deletions MainDemo.Wpf/Domain/AnotherCommandImplementation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@ namespace MaterialDesignDemo.Domain
/// </summary>
public class AnotherCommandImplementation : ICommand
{
private readonly Action<object> _execute;
private readonly Func<object, bool> _canExecute;
private readonly Action<object?> _execute;
private readonly Func<object?, bool> _canExecute;

public AnotherCommandImplementation(Action<object> execute)
public AnotherCommandImplementation(Action<object?> execute)
: this(execute, null)
{ }

public AnotherCommandImplementation(Action<object> execute, Func<object, bool>? canExecute)
public AnotherCommandImplementation(Action<object?> execute, Func<object?, bool>? canExecute)
{
if (execute is null) throw new ArgumentNullException(nameof(execute));

_execute = execute;
_canExecute = canExecute ?? (x => true);
}

public bool CanExecute(object parameter) => _canExecute(parameter);
public bool CanExecute(object? parameter) => _canExecute(parameter);

public void Execute(object parameter) => _execute(parameter);
public void Execute(object? parameter) => _execute(parameter);

public event EventHandler CanExecuteChanged
public event EventHandler? CanExecuteChanged
{
add
{
Expand Down
10 changes: 5 additions & 5 deletions MainDemo.Wpf/Domain/ColorToolViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private void ApplyBase(bool isDark)

public ColorToolViewModel()
{
ToggleBaseCommand = new AnotherCommandImplementation(o => ApplyBase((bool)o));
ToggleBaseCommand = new AnotherCommandImplementation(o => ApplyBase((bool)o!));
ChangeHueCommand = new AnotherCommandImplementation(ChangeHue);
ChangeCustomHueCommand = new AnotherCommandImplementation(ChangeCustomColor);
ChangeToPrimaryCommand = new AnotherCommandImplementation(o => ChangeScheme(ColorScheme.Primary));
Expand All @@ -94,9 +94,9 @@ public ColorToolViewModel()
SelectedColor = _primaryColor;
}

private void ChangeCustomColor(object obj)
private void ChangeCustomColor(object? obj)
{
var color = (Color)obj;
var color = (Color)obj!;

if (ActiveScheme == ColorScheme.Primary)
{
Expand Down Expand Up @@ -149,9 +149,9 @@ private void ChangeScheme(ColorScheme scheme)

private Color? _secondaryForegroundColor;

private void ChangeHue(object obj)
private void ChangeHue(object? obj)
{
var hue = (Color)obj;
var hue = (Color)obj!;

SelectedColor = hue;
if (ActiveScheme == ColorScheme.Primary)
Expand Down
10 changes: 5 additions & 5 deletions MainDemo.Wpf/Domain/DialogsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public DialogsViewModel()

public ICommand RunExtendedDialogCommand => new AnotherCommandImplementation(ExecuteRunExtendedDialog);

private async void ExecuteRunDialog(object o)
private async void ExecuteRunDialog(object? _)
{
//let's set up a little MVVM, cos that's what the cool kids are doing:
var view = new SampleDialog
Expand All @@ -40,7 +40,7 @@ private async void ExecuteRunDialog(object o)
private void ClosingEventHandler(object sender, DialogClosingEventArgs eventArgs)
=> Debug.WriteLine("You can intercept the closing event, and cancel here.");

private async void ExecuteRunExtendedDialog(object o)
private async void ExecuteRunExtendedDialog(object? _)
{
//let's set up a little MVVM, cos that's what the cool kids are doing:
var view = new SampleDialog
Expand Down Expand Up @@ -100,15 +100,15 @@ public bool IsSample4DialogOpen
set => SetProperty(ref _sample4Content, value);
}

private void OpenSample4Dialog(object obj)
private void OpenSample4Dialog(object? _)
{
Sample4Content = new Sample4Dialog();
IsSample4DialogOpen = true;
}

private void CancelSample4Dialog(object obj) => IsSample4DialogOpen = false;
private void CancelSample4Dialog(object? _) => IsSample4DialogOpen = false;

private void AcceptSample4Dialog(object obj)
private void AcceptSample4Dialog(object? _)
{
//pretend to do something for 3 seconds, then close
Sample4Content = new SampleProgressDialog();
Expand Down
2 changes: 1 addition & 1 deletion MainDemo.Wpf/Domain/DocumentationLink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static DocumentationLink DemoPageLink<TDemoPage>(string? label, string? @

public ICommand Open { get; }

private void Execute(object o)
private void Execute(object? _)
{
Link.OpenInBrowser(Url);
}
Expand Down
8 changes: 4 additions & 4 deletions MainDemo.Wpf/Domain/IconPackViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ public PackIconKind PackIconKind
set => SetProperty(ref _packIconKind, value);
}

private void OpenDotCom(object obj)
private void OpenDotCom(object? _)
=> Link.OpenInBrowser("https://materialdesignicons.com/");

private async void Search(object obj)
private async void Search(object? obj)
{
var text = obj as string;
if (string.IsNullOrWhiteSpace(text))
Expand All @@ -108,7 +108,7 @@ private async void Search(object obj)
}
}

private void CopyToClipboard(object obj)
private void CopyToClipboard(object? obj)
{
var toBeCopied = $"<materialDesign:PackIcon Kind=\"{obj}\" />";
Clipboard.SetDataObject(toBeCopied);
Expand Down Expand Up @@ -140,7 +140,7 @@ public Color GeneratedIconForeground
private ICommand? _saveIconCommand;
public ICommand SaveIconCommand => _saveIconCommand ??= new AnotherCommandImplementation(OnSaveIcon);

private void OnSaveIcon(object _)
private void OnSaveIcon(object? _)
{
var saveDialog = new SaveFileDialog
{
Expand Down
3 changes: 2 additions & 1 deletion MainDemo.Wpf/Domain/Link.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ namespace MaterialDesignDemo.Domain
{
public static class Link
{
public static void OpenInBrowser(string url)
public static void OpenInBrowser(string? url)
{
if (url is null) return;
//https://github.com/dotnet/corefx/issues/10361
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
Expand Down
4 changes: 2 additions & 2 deletions MainDemo.Wpf/Domain/PaletteSelectorViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ public PaletteSelectorViewModel()

public IEnumerable<Swatch> Swatches { get; }

public ICommand ApplyPrimaryCommand { get; } = new AnotherCommandImplementation(o => ApplyPrimary((Swatch)o));
public ICommand ApplyPrimaryCommand { get; } = new AnotherCommandImplementation(o => ApplyPrimary((Swatch)o!));

private static void ApplyPrimary(Swatch swatch)
=> ModifyTheme(theme => theme.SetPrimaryColor(swatch.ExemplarHue.Color));

public ICommand ApplyAccentCommand { get; } = new AnotherCommandImplementation(o => ApplyAccent((Swatch)o));
public ICommand ApplyAccentCommand { get; } = new AnotherCommandImplementation(o => ApplyAccent((Swatch)o!));

private static void ApplyAccent(Swatch swatch)
{
Expand Down
4 changes: 2 additions & 2 deletions MainDemo.Wpf/MaterialDesignDemo.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net472;netcoreapp3.1;net6.0-windows</TargetFrameworks>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Prefer32Bit>true</Prefer32Bit>
<ApplicationIcon>favicon.ico</ApplicationIcon>
Expand Down
14 changes: 7 additions & 7 deletions MaterialDesign3.Demo.Wpf/Domain/AnotherCommandImplementation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@ namespace MaterialDesign3Demo.Domain
/// </summary>
public class AnotherCommandImplementation : ICommand
{
private readonly Action<object> _execute;
private readonly Func<object, bool> _canExecute;
private readonly Action<object?> _execute;
private readonly Func<object?, bool> _canExecute;

public AnotherCommandImplementation(Action<object> execute)
public AnotherCommandImplementation(Action<object?> execute)
: this(execute, null)
{ }

public AnotherCommandImplementation(Action<object> execute, Func<object, bool>? canExecute)
public AnotherCommandImplementation(Action<object?> execute, Func<object?, bool>? canExecute)
{
if (execute is null) throw new ArgumentNullException(nameof(execute));

_execute = execute;
_canExecute = canExecute ?? (x => true);
}

public bool CanExecute(object parameter) => _canExecute(parameter);
public bool CanExecute(object? parameter) => _canExecute(parameter);

public void Execute(object parameter) => _execute(parameter);
public void Execute(object? parameter) => _execute(parameter);

public event EventHandler CanExecuteChanged
public event EventHandler? CanExecuteChanged
{
add
{
Expand Down
10 changes: 5 additions & 5 deletions MaterialDesign3.Demo.Wpf/Domain/ColorToolViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private void ApplyBase(bool isDark)

public ColorToolViewModel()
{
ToggleBaseCommand = new AnotherCommandImplementation(o => ApplyBase((bool)o));
ToggleBaseCommand = new AnotherCommandImplementation(o => ApplyBase((bool)o!));
ChangeHueCommand = new AnotherCommandImplementation(ChangeHue);
ChangeCustomHueCommand = new AnotherCommandImplementation(ChangeCustomColor);
ChangeToPrimaryCommand = new AnotherCommandImplementation(o => ChangeScheme(ColorScheme.Primary));
Expand All @@ -94,9 +94,9 @@ public ColorToolViewModel()
SelectedColor = _primaryColor;
}

private void ChangeCustomColor(object obj)
private void ChangeCustomColor(object? obj)
{
var color = (Color)obj;
var color = (Color)obj!;

if (ActiveScheme == ColorScheme.Primary)
{
Expand Down Expand Up @@ -149,9 +149,9 @@ private void ChangeScheme(ColorScheme scheme)

private Color? _secondaryForegroundColor;

private void ChangeHue(object obj)
private void ChangeHue(object? obj)
{
var hue = (Color)obj;
var hue = (Color)obj!;

SelectedColor = hue;
if (ActiveScheme == ColorScheme.Primary)
Expand Down
10 changes: 5 additions & 5 deletions MaterialDesign3.Demo.Wpf/Domain/DialogsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public DialogsViewModel()

public ICommand RunExtendedDialogCommand => new AnotherCommandImplementation(ExecuteRunExtendedDialog);

private async void ExecuteRunDialog(object o)
private async void ExecuteRunDialog(object? _)
{
//let's set up a little MVVM, cos that's what the cool kids are doing:
var view = new SampleDialog
Expand All @@ -40,7 +40,7 @@ private async void ExecuteRunDialog(object o)
private void ClosingEventHandler(object sender, DialogClosingEventArgs eventArgs)
=> Debug.WriteLine("You can intercept the closing event, and cancel here.");

private async void ExecuteRunExtendedDialog(object o)
private async void ExecuteRunExtendedDialog(object? _)
{
//let's set up a little MVVM, cos that's what the cool kids are doing:
var view = new SampleDialog
Expand Down Expand Up @@ -100,15 +100,15 @@ public bool IsSample4DialogOpen
set => SetProperty(ref _sample4Content, value);
}

private void OpenSample4Dialog(object obj)
private void OpenSample4Dialog(object? _)
{
Sample4Content = new Sample4Dialog();
IsSample4DialogOpen = true;
}

private void CancelSample4Dialog(object obj) => IsSample4DialogOpen = false;
private void CancelSample4Dialog(object? _) => IsSample4DialogOpen = false;

private void AcceptSample4Dialog(object obj)
private void AcceptSample4Dialog(object? _)
{
//pretend to do something for 3 seconds, then close
Sample4Content = new SampleProgressDialog();
Expand Down
2 changes: 1 addition & 1 deletion MaterialDesign3.Demo.Wpf/Domain/DocumentationLink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static DocumentationLink DemoPageLink<TDemoPage>(string? label, string? @

public ICommand Open { get; }

private void Execute(object o)
private void Execute(object? _)
{
Link.OpenInBrowser(Url);
}
Expand Down
Loading

0 comments on commit 39a9ca5

Please sign in to comment.