mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 23:50:18 -04:00
WIP Windows 10
Dependencies finally installed Removal of useless code Big cleanup in XAML styles (override colors the correct way)
This commit is contained in:
57
Win10App/ViewModels/GroupsVm.cs
Normal file
57
Win10App/ViewModels/GroupsVm.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using Autofac;
|
||||
using ModernKeePass.Domain.AOP;
|
||||
using ModernKeePass.Domain.Entities;
|
||||
using ModernKeePass.Domain.Enums;
|
||||
using ModernKeePass.Domain.Interfaces;
|
||||
using ModernKeePass.ViewModels.ListItems;
|
||||
|
||||
namespace ModernKeePass.ViewModels
|
||||
{
|
||||
public class GroupsVm : NotifyPropertyChangedBase
|
||||
{
|
||||
private string _title;
|
||||
private string _newGroupName;
|
||||
|
||||
public string Title
|
||||
{
|
||||
get => _title;
|
||||
set
|
||||
{
|
||||
_title = value;
|
||||
OnPropertyChanged(nameof(Title));
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: check why binding not working
|
||||
public string NewGroupName
|
||||
{
|
||||
get => _newGroupName;
|
||||
set
|
||||
{
|
||||
_newGroupName = value;
|
||||
OnPropertyChanged(nameof(NewGroupName));
|
||||
}
|
||||
}
|
||||
|
||||
public GroupItemVm RootItemVm { get; set; }
|
||||
|
||||
public GroupsVm(): this(App.Container.Resolve<IDatabaseService>().RootGroupEntity)
|
||||
{ }
|
||||
|
||||
public GroupsVm(GroupEntity groupEntity)
|
||||
{
|
||||
Title = groupEntity.Name;
|
||||
RootItemVm = new GroupItemVm(groupEntity, null);
|
||||
}
|
||||
|
||||
public void AddNewGroup(string groupName = "")
|
||||
{
|
||||
var group = new GroupEntity
|
||||
{
|
||||
Name = groupName,
|
||||
Icon = Icon.Folder,
|
||||
};
|
||||
RootItemVm.Children.Add(new GroupItemVm(group, RootItemVm));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user