Files
VDownload/VDownload.Services/VDownload.Services.UI/VDownload.Services.UI.DictionaryResources/DictionaryResourcesService.cs
Mateusz Skoczek e3ec5c3a48 twitch vod downloading done
ffmpeg essentials

fix

Project reorganized

git lfs

ffmpeg removed

ffmpeg added
2024-02-22 02:25:13 +01:00

42 lines
825 B
C#

using Microsoft.UI.Xaml;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VDownload.Services.UI.DictionaryResources
{
public interface IDictionaryResourcesService
{
T Get<T>(string key);
}
public class DictionaryResourcesService : IDictionaryResourcesService
{
#region CONSTRUCTORS
public DictionaryResourcesService() { }
#endregion
#region PUBLIC METHODS
public T Get<T>(string key)
{
Application.Current.Resources.TryGetValue(key, out object value);
if (value is not null && value is T cast)
{
return cast;
}
throw new KeyNotFoundException();
}
#endregion
}
}