Revert everything back. Mission failed.
This commit is contained in:
30
Wino.Mail/Services/ApplicationResourceManager.cs
Normal file
30
Wino.Mail/Services/ApplicationResourceManager.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Linq;
|
||||
using Wino.Core.Domain.Interfaces;
|
||||
|
||||
#if NET8_0
|
||||
using Microsoft.UI.Xaml;
|
||||
#else
|
||||
using Windows.UI.Xaml;
|
||||
#endif
|
||||
namespace Wino.Services
|
||||
{
|
||||
public class ApplicationResourceManager : IApplicationResourceManager<ResourceDictionary>
|
||||
{
|
||||
public void AddResource(ResourceDictionary resource)
|
||||
=> App.Current.Resources.MergedDictionaries.Add(resource);
|
||||
public void RemoveResource(ResourceDictionary resource)
|
||||
=> App.Current.Resources.MergedDictionaries.Remove(resource);
|
||||
|
||||
public bool ContainsResourceKey(string resourceKey)
|
||||
=> App.Current.Resources.ContainsKey(resourceKey);
|
||||
|
||||
public ResourceDictionary GetLastResource()
|
||||
=> App.Current.Resources.MergedDictionaries.LastOrDefault();
|
||||
|
||||
public void ReplaceResource(string resourceKey, object resource)
|
||||
=> App.Current.Resources[resourceKey] = resource;
|
||||
|
||||
public TReturn GetResource<TReturn>(string resourceKey)
|
||||
=> (TReturn)App.Current.Resources[resourceKey];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user