mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
Implementing Recent Files WIP
Code refactoring Entry coloring
This commit is contained in:

committed by
BONNEVILLE Geoffroy

parent
817f25e8a8
commit
1ca3f29da0
@@ -1,12 +1,15 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using ModernKeePass.Mappings;
|
||||
using ModernKeePassLib;
|
||||
using ModernKeePassLib.Security;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI;
|
||||
|
||||
namespace ModernKeePass.ViewModels
|
||||
{
|
||||
public class EntryVm : INotifyPropertyChanged
|
||||
public class EntryVm
|
||||
{
|
||||
public string Title
|
||||
{
|
||||
@@ -34,6 +37,10 @@ namespace ModernKeePass.ViewModels
|
||||
set { SetEntryValue(PwDefs.NotesField, value); }
|
||||
}
|
||||
|
||||
public SolidColorBrush BackgroundColor => CreateFromColor(_pwEntry.BackgroundColor, Colors.Transparent);
|
||||
|
||||
public SolidColorBrush ForegroundColor => CreateFromColor(_pwEntry.ForegroundColor, Colors.White);
|
||||
|
||||
public Symbol IconSymbol
|
||||
{
|
||||
get
|
||||
@@ -42,9 +49,7 @@ namespace ModernKeePass.ViewModels
|
||||
return result == Symbol.More ? Symbol.Permissions : result;
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
|
||||
private readonly PwEntry _pwEntry;
|
||||
|
||||
public EntryVm() { }
|
||||
@@ -62,5 +67,15 @@ namespace ModernKeePass.ViewModels
|
||||
{
|
||||
_pwEntry.Strings.Set(key, new ProtectedString(true, newValue));
|
||||
}
|
||||
|
||||
private SolidColorBrush CreateFromColor(System.Drawing.Color color, Windows.UI.Color defaultValue)
|
||||
{
|
||||
if (color == System.Drawing.Color.Empty) return new SolidColorBrush(defaultValue);
|
||||
return new SolidColorBrush(Windows.UI.Color.FromArgb(
|
||||
color.A,
|
||||
color.R,
|
||||
color.G,
|
||||
color.B));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +1,18 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using ModernKeePass.Models;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
|
||||
namespace ModernKeePass.ViewModels
|
||||
{
|
||||
public class MainVm
|
||||
public class MainVm : INotifyPropertyChanged
|
||||
{
|
||||
public ObservableCollection<MainMenuItem> MainMenuItems { get; set; }
|
||||
public IOrderedEnumerable<IGrouping<int, MainMenuItem>> MainMenuItems { get; set; }
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
public void NotifyPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
18
ModernKeePass/ViewModels/RecentVm.cs
Normal file
18
ModernKeePass/ViewModels/RecentVm.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using ModernKeePass.Models;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace ModernKeePass.ViewModels
|
||||
{
|
||||
public class RecentVm : INotifyPropertyChanged
|
||||
{
|
||||
public ObservableCollection<RecentItem> RecentItems { get; set; }
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public void NotifyPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user