diff --git a/Directory.packages.props b/Directory.packages.props index 8b7f1cda1e..10df93d42f 100644 --- a/Directory.packages.props +++ b/Directory.packages.props @@ -2,27 +2,27 @@ - - - - - - - + + + + + + + - - - + + + - - + + - + \ No newline at end of file diff --git a/MahMaterialDragablzMashUp/AnotherCommandImplementation.cs b/MahMaterialDragablzMashUp/AnotherCommandImplementation.cs index d2db4977c9..002f3a0984 100644 --- a/MahMaterialDragablzMashUp/AnotherCommandImplementation.cs +++ b/MahMaterialDragablzMashUp/AnotherCommandImplementation.cs @@ -8,15 +8,15 @@ namespace MahMaterialDragablzMashUp /// public class AnotherCommandImplementation : ICommand { - private readonly Action _execute; - private readonly Func _canExecute; + private readonly Action _execute; + private readonly Func _canExecute; - public AnotherCommandImplementation(Action execute) + public AnotherCommandImplementation(Action execute) : this(execute, null) { } - public AnotherCommandImplementation(Action execute, Func? canExecute) + public AnotherCommandImplementation(Action execute, Func? canExecute) { if (execute is null) throw new ArgumentNullException(nameof(execute)); @@ -24,11 +24,11 @@ public AnotherCommandImplementation(Action execute, Func? _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 { diff --git a/MahMaterialDragablzMashUp/MahAppsDragablzDemo.csproj b/MahMaterialDragablzMashUp/MahAppsDragablzDemo.csproj index a523e8a2fd..23e373c28e 100644 --- a/MahMaterialDragablzMashUp/MahAppsDragablzDemo.csproj +++ b/MahMaterialDragablzMashUp/MahAppsDragablzDemo.csproj @@ -1,8 +1,8 @@ - + WinExe - net472;netcoreapp3.1 + net472;netcoreapp3.1;net6.0-windows true ..\ true diff --git a/MahMaterialDragablzMashUp/PaletteSelectorViewModel.cs b/MahMaterialDragablzMashUp/PaletteSelectorViewModel.cs index 6f161b3bd8..883f0ae259 100644 --- a/MahMaterialDragablzMashUp/PaletteSelectorViewModel.cs +++ b/MahMaterialDragablzMashUp/PaletteSelectorViewModel.cs @@ -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 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 diff --git a/MainDemo.Wpf/Domain/AnotherCommandImplementation.cs b/MainDemo.Wpf/Domain/AnotherCommandImplementation.cs index 1e1923f4f6..ff9f55134e 100644 --- a/MainDemo.Wpf/Domain/AnotherCommandImplementation.cs +++ b/MainDemo.Wpf/Domain/AnotherCommandImplementation.cs @@ -8,14 +8,14 @@ namespace MaterialDesignDemo.Domain /// public class AnotherCommandImplementation : ICommand { - private readonly Action _execute; - private readonly Func _canExecute; + private readonly Action _execute; + private readonly Func _canExecute; - public AnotherCommandImplementation(Action execute) + public AnotherCommandImplementation(Action execute) : this(execute, null) { } - public AnotherCommandImplementation(Action execute, Func? canExecute) + public AnotherCommandImplementation(Action execute, Func? canExecute) { if (execute is null) throw new ArgumentNullException(nameof(execute)); @@ -23,11 +23,11 @@ public AnotherCommandImplementation(Action execute, Func? _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 { diff --git a/MainDemo.Wpf/Domain/ColorToolViewModel.cs b/MainDemo.Wpf/Domain/ColorToolViewModel.cs index 554270a190..5a38c30444 100644 --- a/MainDemo.Wpf/Domain/ColorToolViewModel.cs +++ b/MainDemo.Wpf/Domain/ColorToolViewModel.cs @@ -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)); @@ -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) { @@ -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) diff --git a/MainDemo.Wpf/Domain/DialogsViewModel.cs b/MainDemo.Wpf/Domain/DialogsViewModel.cs index 75ce14a7a5..66ff09045c 100644 --- a/MainDemo.Wpf/Domain/DialogsViewModel.cs +++ b/MainDemo.Wpf/Domain/DialogsViewModel.cs @@ -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 @@ -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 @@ -100,15 +100,15 @@ public object? Sample4Content 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(); diff --git a/MainDemo.Wpf/Domain/DocumentationLink.cs b/MainDemo.Wpf/Domain/DocumentationLink.cs index 5d4de4fb01..9117d4c8fd 100644 --- a/MainDemo.Wpf/Domain/DocumentationLink.cs +++ b/MainDemo.Wpf/Domain/DocumentationLink.cs @@ -85,7 +85,7 @@ public static DocumentationLink DemoPageLink(string? label, string? @ public ICommand Open { get; } - private void Execute(object o) + private void Execute(object? _) { Link.OpenInBrowser(Url); } diff --git a/MainDemo.Wpf/Domain/IconPackViewModel.cs b/MainDemo.Wpf/Domain/IconPackViewModel.cs index 5a964586f3..a107f066af 100644 --- a/MainDemo.Wpf/Domain/IconPackViewModel.cs +++ b/MainDemo.Wpf/Domain/IconPackViewModel.cs @@ -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)) @@ -108,7 +108,7 @@ private async void Search(object obj) } } - private void CopyToClipboard(object obj) + private void CopyToClipboard(object? obj) { var toBeCopied = $""; Clipboard.SetDataObject(toBeCopied); @@ -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 { diff --git a/MainDemo.Wpf/Domain/Link.cs b/MainDemo.Wpf/Domain/Link.cs index 8503b16edd..b1b90f8095 100644 --- a/MainDemo.Wpf/Domain/Link.cs +++ b/MainDemo.Wpf/Domain/Link.cs @@ -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)) { diff --git a/MainDemo.Wpf/Domain/PaletteSelectorViewModel.cs b/MainDemo.Wpf/Domain/PaletteSelectorViewModel.cs index 6cb07f65f3..1e17d10cfd 100644 --- a/MainDemo.Wpf/Domain/PaletteSelectorViewModel.cs +++ b/MainDemo.Wpf/Domain/PaletteSelectorViewModel.cs @@ -15,12 +15,12 @@ public PaletteSelectorViewModel() public IEnumerable 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) { diff --git a/MainDemo.Wpf/MaterialDesignDemo.csproj b/MainDemo.Wpf/MaterialDesignDemo.csproj index 2ec5931c9a..e75b384937 100644 --- a/MainDemo.Wpf/MaterialDesignDemo.csproj +++ b/MainDemo.Wpf/MaterialDesignDemo.csproj @@ -1,8 +1,8 @@ - + WinExe - net472;netcoreapp3.1 + net472;netcoreapp3.1;net6.0-windows true true favicon.ico diff --git a/MaterialDesign3.Demo.Wpf/Domain/AnotherCommandImplementation.cs b/MaterialDesign3.Demo.Wpf/Domain/AnotherCommandImplementation.cs index ffe844af64..d190b93e19 100644 --- a/MaterialDesign3.Demo.Wpf/Domain/AnotherCommandImplementation.cs +++ b/MaterialDesign3.Demo.Wpf/Domain/AnotherCommandImplementation.cs @@ -8,14 +8,14 @@ namespace MaterialDesign3Demo.Domain /// public class AnotherCommandImplementation : ICommand { - private readonly Action _execute; - private readonly Func _canExecute; + private readonly Action _execute; + private readonly Func _canExecute; - public AnotherCommandImplementation(Action execute) + public AnotherCommandImplementation(Action execute) : this(execute, null) { } - public AnotherCommandImplementation(Action execute, Func? canExecute) + public AnotherCommandImplementation(Action execute, Func? canExecute) { if (execute is null) throw new ArgumentNullException(nameof(execute)); @@ -23,11 +23,11 @@ public AnotherCommandImplementation(Action execute, Func? _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 { diff --git a/MaterialDesign3.Demo.Wpf/Domain/ColorToolViewModel.cs b/MaterialDesign3.Demo.Wpf/Domain/ColorToolViewModel.cs index 54e62c5fd3..8a7f84dded 100644 --- a/MaterialDesign3.Demo.Wpf/Domain/ColorToolViewModel.cs +++ b/MaterialDesign3.Demo.Wpf/Domain/ColorToolViewModel.cs @@ -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)); @@ -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) { @@ -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) diff --git a/MaterialDesign3.Demo.Wpf/Domain/DialogsViewModel.cs b/MaterialDesign3.Demo.Wpf/Domain/DialogsViewModel.cs index 92413b5af2..9cc8724a8e 100644 --- a/MaterialDesign3.Demo.Wpf/Domain/DialogsViewModel.cs +++ b/MaterialDesign3.Demo.Wpf/Domain/DialogsViewModel.cs @@ -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 @@ -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 @@ -100,15 +100,15 @@ public object? Sample4Content 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(); diff --git a/MaterialDesign3.Demo.Wpf/Domain/DocumentationLink.cs b/MaterialDesign3.Demo.Wpf/Domain/DocumentationLink.cs index c8341befdc..06d6a16b7c 100644 --- a/MaterialDesign3.Demo.Wpf/Domain/DocumentationLink.cs +++ b/MaterialDesign3.Demo.Wpf/Domain/DocumentationLink.cs @@ -85,7 +85,7 @@ public static DocumentationLink DemoPageLink(string? label, string? @ public ICommand Open { get; } - private void Execute(object o) + private void Execute(object? _) { Link.OpenInBrowser(Url); } diff --git a/MaterialDesign3.Demo.Wpf/Domain/IconPackViewModel.cs b/MaterialDesign3.Demo.Wpf/Domain/IconPackViewModel.cs index 03be2290be..9229731fe9 100644 --- a/MaterialDesign3.Demo.Wpf/Domain/IconPackViewModel.cs +++ b/MaterialDesign3.Demo.Wpf/Domain/IconPackViewModel.cs @@ -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)) @@ -108,7 +108,7 @@ private async void Search(object obj) } } - private void CopyToClipboard(object obj) + private void CopyToClipboard(object? obj) { var toBeCopied = $""; Clipboard.SetDataObject(toBeCopied); @@ -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 { diff --git a/MaterialDesign3.Demo.Wpf/Domain/Link.cs b/MaterialDesign3.Demo.Wpf/Domain/Link.cs index 6aab38bc2e..85d889a0d3 100644 --- a/MaterialDesign3.Demo.Wpf/Domain/Link.cs +++ b/MaterialDesign3.Demo.Wpf/Domain/Link.cs @@ -5,8 +5,9 @@ namespace MaterialDesign3Demo.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)) { diff --git a/MaterialDesign3.Demo.Wpf/Domain/PaletteSelectorViewModel.cs b/MaterialDesign3.Demo.Wpf/Domain/PaletteSelectorViewModel.cs index b6fec39b08..cf66152349 100644 --- a/MaterialDesign3.Demo.Wpf/Domain/PaletteSelectorViewModel.cs +++ b/MaterialDesign3.Demo.Wpf/Domain/PaletteSelectorViewModel.cs @@ -15,12 +15,12 @@ public PaletteSelectorViewModel() public IEnumerable 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) { diff --git a/MaterialDesign3.Demo.Wpf/MaterialDesign3Demo.csproj b/MaterialDesign3.Demo.Wpf/MaterialDesign3Demo.csproj index c791b5d035..fdf309f0fe 100644 --- a/MaterialDesign3.Demo.Wpf/MaterialDesign3Demo.csproj +++ b/MaterialDesign3.Demo.Wpf/MaterialDesign3Demo.csproj @@ -1,8 +1,8 @@ - + WinExe - net472;netcoreapp3.1 + net472;netcoreapp3.1;net6.0-windows true true favicon.ico diff --git a/MaterialDesignThemes.MahApps/MaterialDesignThemes.MahApps.csproj b/MaterialDesignThemes.MahApps/MaterialDesignThemes.MahApps.csproj index e5cb60f765..0d4c802676 100644 --- a/MaterialDesignThemes.MahApps/MaterialDesignThemes.MahApps.csproj +++ b/MaterialDesignThemes.MahApps/MaterialDesignThemes.MahApps.csproj @@ -1,7 +1,7 @@  - + - net452;netcoreapp3.1 + net452;netcoreapp3.1;net6.0-windows true 1.0.1 MaterialDesignThemes.MahApps diff --git a/MaterialDesignThemes.UITests/MaterialDesignThemes.UITests.csproj b/MaterialDesignThemes.UITests/MaterialDesignThemes.UITests.csproj index 0149b31199..3f7f77c9f5 100644 --- a/MaterialDesignThemes.UITests/MaterialDesignThemes.UITests.csproj +++ b/MaterialDesignThemes.UITests/MaterialDesignThemes.UITests.csproj @@ -1,6 +1,6 @@  - net5.0-windows + net6.0-windows false false true diff --git a/global.json b/global.json index 1da1913082..899e6b3a36 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "3.1", - "rollForward": "latestMajor" + "version": "6.0", + "rollForward": "latestMinor" } } diff --git a/mdresgen/Program.cs b/mdresgen/Program.cs index f6f1d62c3f..5a140cb218 100644 --- a/mdresgen/Program.cs +++ b/mdresgen/Program.cs @@ -47,7 +47,7 @@ static async Task Main(string[] args) var xDocument = XDocument.Load(BaseSnippetLocation); var xmlRoot = xDocument.Root ?? throw new InvalidDataException("The input document does not contain a root"); - var palette = JsonConvert.DeserializeObject(File.ReadAllText(MdPaletteJsonLocation)); + var palette = JsonConvert.DeserializeObject(File.ReadAllText(MdPaletteJsonLocation))!; if (args.Length == 0) GenerateXaml(xmlRoot);