From 1f1f7b17d9133773f8da718ada6bbd94d256b58d Mon Sep 17 00:00:00 2001 From: dme-compunet <117437050+dme-compunet@users.noreply.github.com> Date: Sat, 23 Nov 2024 23:01:27 +0200 Subject: [PATCH] Remove unused service-provider parameter --- SukiUI.Demo/App.axaml.cs | 2 +- SukiUI.Demo/Common/SukiViews.cs | 4 ++-- SukiUI.Demo/Common/ViewLocator.cs | 5 ++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/SukiUI.Demo/App.axaml.cs b/SukiUI.Demo/App.axaml.cs index e8c51d15a..4d6805b85 100644 --- a/SukiUI.Demo/App.axaml.cs +++ b/SukiUI.Demo/App.axaml.cs @@ -40,7 +40,7 @@ public override void OnFrameworkInitializationCompleted() var views = ConfigureViews(services); var provider = ConfigureServices(services); - DataTemplates.Add(new ViewLocator(views, provider)); + DataTemplates.Add(new ViewLocator(views)); desktop.MainWindow = views.CreateView(provider) as Window; } diff --git a/SukiUI.Demo/Common/SukiViews.cs b/SukiUI.Demo/Common/SukiViews.cs index eab333362..b56bbaf8d 100644 --- a/SukiUI.Demo/Common/SukiViews.cs +++ b/SukiUI.Demo/Common/SukiViews.cs @@ -40,10 +40,10 @@ public bool TryCreateView(IServiceProvider provider, Type viewModelType, [NotNul { var viewModel = provider.GetRequiredService(viewModelType); - return TryCreateView(provider, viewModel, out view); + return TryCreateView(viewModel, out view); } - public bool TryCreateView(IServiceProvider provider, object? viewModel, [NotNullWhen(true)] out Control? view) + public bool TryCreateView(object? viewModel, [NotNullWhen(true)] out Control? view) { view = null; diff --git a/SukiUI.Demo/Common/ViewLocator.cs b/SukiUI.Demo/Common/ViewLocator.cs index ce0c6610c..47adb52d7 100644 --- a/SukiUI.Demo/Common/ViewLocator.cs +++ b/SukiUI.Demo/Common/ViewLocator.cs @@ -1,12 +1,11 @@ using Avalonia.Controls; using Avalonia.Controls.Templates; using CommunityToolkit.Mvvm.ComponentModel; -using Microsoft.Extensions.DependencyInjection; using System.Collections.Generic; namespace SukiUI.Demo.Common; -public class ViewLocator(SukiViews views, ServiceProvider provider) : IDataTemplate +public class ViewLocator(SukiViews views) : IDataTemplate { private readonly Dictionary _controlCache = []; @@ -22,7 +21,7 @@ public Control Build(object? param) return control; } - if (views.TryCreateView(provider, param, out var view)) + if (views.TryCreateView(param, out var view)) { _controlCache.Add(param, view);