Entries and groups icons are now handled with int

Static mapping is changed to a converter
This commit is contained in:
BONNEVILLE Geoffroy
2018-06-14 10:20:00 +02:00
parent cc65c56042
commit 8a5db88225
7 changed files with 28 additions and 29 deletions

View File

@@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using Windows.UI.Xaml.Controls;
using ModernKeePass.Interfaces;
using ModernKeePass.Mappings;
using ModernKeePass.Services;
using ModernKeePassLib;
using ModernKeePassLib.Cryptography.PasswordGenerator;
@@ -79,14 +77,12 @@ namespace ModernKeePass.ViewModels
set { SetEntryValue(PwDefs.NotesField, value); }
}
public Symbol IconSymbol
public int IconId
{
get
{
if (_pwEntry == null) return Symbol.Add;
if (HasExpired) return Symbol.Priority;
var result = PwIconToSegoeMapping.GetSymbolFromIcon(_pwEntry.IconId);
return result == Symbol.More ? Symbol.Permissions : result;
if (_pwEntry?.IconId != null) return (int) _pwEntry?.IconId;
return -1;
}
}

View File

@@ -3,11 +3,8 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using Windows.UI.Xaml.Controls;
using ModernKeePass.Common;
using ModernKeePass.Interfaces;
using ModernKeePass.Mappings;
using ModernKeePass.Services;
using ModernKeePassLib;
@@ -71,14 +68,14 @@ namespace ModernKeePass.ViewModels
set { _pwGroup.Name = value; }
}
public Symbol IconSymbol
public int IconId
{
get
{
var result = PwIconToSegoeMapping.GetSymbolFromIcon(_pwGroup.IconId);
return result == Symbol.More ? Symbol.Folder : result;
if (_pwGroup?.IconId != null) return (int) _pwGroup?.IconId;
return -1;
}
set { _pwGroup.IconId = PwIconToSegoeMapping.GetIconFromSymbol(value); }
set { _pwGroup.IconId = (PwIcon)value; }
}
public bool IsEditMode