mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00

Set credentials validation works as intended Getting settings has default values Add parent group in Move searchbox Moving entries work as intended Removed unreferenced code files
33 lines
951 B
C#
33 lines
951 B
C#
using System;
|
|
using Windows.Foundation.Collections;
|
|
using Windows.Storage;
|
|
using ModernKeePass.Application.Common.Interfaces;
|
|
|
|
namespace ModernKeePass.Infrastructure.UWP
|
|
{
|
|
public class UwpSettingsClient : ISettingsProxy
|
|
{
|
|
private readonly IPropertySet _values = ApplicationData.Current.LocalSettings.Values;
|
|
|
|
public T GetSetting<T>(string property, T defaultValue = default(T))
|
|
{
|
|
try
|
|
{
|
|
var value = (T)Convert.ChangeType(_values[property], typeof(T));
|
|
return value == null ? defaultValue : value;
|
|
}
|
|
catch (InvalidCastException)
|
|
{
|
|
return defaultValue;
|
|
}
|
|
}
|
|
|
|
public void PutSetting<T>(string property, T value)
|
|
{
|
|
if (_values.ContainsKey(property))
|
|
_values[property] = value;
|
|
else _values.Add(property, value);
|
|
}
|
|
}
|
|
}
|