mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 23:50:18 -04:00
Drag drop finally works
WIP item background New Donate page stub Renamed some classes as services
This commit is contained in:
@@ -22,7 +22,7 @@ namespace ModernKeePass.ViewModels
|
||||
set
|
||||
{
|
||||
_database.RecycleBinEnabled = value;
|
||||
OnPropertyChanged();
|
||||
OnPropertyChanged("HasRecycleBin");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,47 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Windows.Storage;
|
||||
using ModernKeePassLib.Cryptography.KeyDerivation;
|
||||
using System.Collections.Generic;
|
||||
using ModernKeePass.Services;
|
||||
|
||||
namespace ModernKeePass.ViewModels
|
||||
{
|
||||
public class SettingsNewVm
|
||||
{
|
||||
private readonly ApplicationDataContainer _localSettings = ApplicationData.Current.LocalSettings;
|
||||
|
||||
public bool IsCreateSample
|
||||
{
|
||||
get { return GetSetting<bool>("Sample"); }
|
||||
set { PutSetting("Sample", value); }
|
||||
get { return SettingsService.GetSetting<bool>("Sample"); }
|
||||
set { SettingsService.PutSetting("Sample", value); }
|
||||
}
|
||||
|
||||
public IEnumerable<string> KeyDerivations => KdfPool.Engines.Select(e => e.Name);
|
||||
public IEnumerable<string> FileFormats => new []{"2", "4"};
|
||||
|
||||
public string KeyDerivationName
|
||||
public string FileFormatVersion
|
||||
{
|
||||
get { return GetSetting<string>("KeyDerivation"); }
|
||||
set { PutSetting("KeyDerivation", value); }
|
||||
}
|
||||
|
||||
// TODO: Move this to a common class
|
||||
private T GetSetting<T>(string property)
|
||||
{
|
||||
try
|
||||
{
|
||||
return (T)Convert.ChangeType(_localSettings.Values[property], typeof(T));
|
||||
}
|
||||
catch (InvalidCastException)
|
||||
{
|
||||
return default(T);
|
||||
}
|
||||
}
|
||||
|
||||
private void PutSetting<T>(string property, T value)
|
||||
{
|
||||
if (_localSettings.Values.ContainsKey(property))
|
||||
_localSettings.Values[property] = value;
|
||||
else _localSettings.Values.Add(property, value);
|
||||
get { return SettingsService.GetSetting<string>("DefaultFileFormat"); }
|
||||
set { SettingsService.PutSetting("DefaultFileFormat", value); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user