Skip to content

Commit

Permalink
Remove unused service-provider parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
dme-compunet committed Nov 23, 2024
1 parent 5a3393a commit 1f1f7b1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion SukiUI.Demo/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<SukiUIDemoViewModel>(provider) as Window;
}
Expand Down
4 changes: 2 additions & 2 deletions SukiUI.Demo/Common/SukiViews.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
5 changes: 2 additions & 3 deletions SukiUI.Demo/Common/ViewLocator.cs
Original file line number Diff line number Diff line change
@@ -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<object, Control> _controlCache = [];

Expand All @@ -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);

Expand Down

0 comments on commit 1f1f7b1

Please sign in to comment.