mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
Create a shared project with all Win App common files (8.1 and 10)
Finally use the dependency injected Resource Service
This commit is contained in:
@@ -28,6 +28,7 @@ namespace ModernKeePass.Infrastructure
|
||||
services.AddScoped(typeof(IFileProxy), typeof(StorageFileClient));
|
||||
services.AddTransient(typeof(ISettingsProxy), typeof(UwpSettingsClient));
|
||||
services.AddTransient(typeof(IRecentProxy), typeof(UwpRecentFilesClient));
|
||||
services.AddTransient(typeof(IResourceProxy), typeof(UwpResourceClient));
|
||||
return services;
|
||||
}
|
||||
}
|
||||
|
@@ -6,10 +6,11 @@ namespace ModernKeePass.Infrastructure.UWP
|
||||
public class UwpResourceClient: IResourceProxy
|
||||
{
|
||||
private const string ResourceFileName = "CodeBehind";
|
||||
private readonly ResourceLoader _resourceLoader = ResourceLoader.GetForCurrentView();
|
||||
private ResourceLoader _resourceLoader;
|
||||
|
||||
public string GetResourceValue(string key)
|
||||
{
|
||||
if (_resourceLoader == null) _resourceLoader = ResourceLoader.GetForCurrentView();
|
||||
var resource = _resourceLoader.GetString($"/{ResourceFileName}/{key}");
|
||||
return resource;
|
||||
}
|
||||
|
Reference in New Issue
Block a user