Update groups finally implemented

Code cleanup
This commit is contained in:
Geoffroy BONNEVILLE
2020-04-16 17:16:03 +02:00
parent 9befdc321a
commit f950564000
15 changed files with 123 additions and 101 deletions

View File

@@ -239,19 +239,16 @@
<userControls:TopMenuUserControl x:Name="TopMenu" Grid.Column="2"
SortButtonVisibility="{Binding IsEditMode, Converter={StaticResource BooleanToVisibilityConverter}}"
IsEditButtonChecked="{Binding IsEditMode, Mode=TwoWay}"
IsMoveButtonEnabled="{Binding IsNotRoot}"
IsDeleteButtonEnabled="{Binding IsNotRoot}"
SaveCommand="{Binding SaveCommand}"
MoveCommand="{Binding MoveCommand}"
SortEntriesCommand="{Binding SortEntriesCommand}"
SortGroupsCommand="{Binding SortGroupsCommand}">
SortGroupsCommand="{Binding SortGroupsCommand}"
DeleteButtonClick="TopMenu_OnDeleteButtonClick">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="EditButtonClick">
<actions:SetupFocusAction TargetObject="{Binding ElementName=TitleTextBox}" />
</core:EventTriggerBehavior>
<core:EventTriggerBehavior EventName="DeleteButtonClick">
<actions:DeleteEntityAction Entity="{Binding}" Command="{Binding NavigationHelper.GoBackCommand, ElementName=PageRoot}" />
</core:EventTriggerBehavior>
<core:EventTriggerBehavior EventName="MoveButtonClick">
<core:InvokeCommandAction Command="{Binding NavigationHelper.GoBackCommand, ElementName=PageRoot}" />
<!--<actions:ToastAction x:Uid="RestoreGroupCommand" Title="{Binding Title}" />-->

View File

@@ -148,6 +148,25 @@ namespace ModernKeePass.Views
VisualStateManager.GoToState(TopMenu, e.NewSize.Width < 800 ? "Collapsed" : "Overflowed", true);
}
private async void TopMenu_OnDeleteButtonClick(object sender, RoutedEventArgs e)
{
var resource = new ResourceHelper();
var isRecycleOnDelete = Model.IsRecycleOnDelete;
var message = isRecycleOnDelete
? resource.GetResourceValue("GroupRecyclingConfirmation")
: resource.GetResourceValue("GroupDeletingConfirmation");
var text = isRecycleOnDelete ? resource.GetResourceValue("GroupRecycled") : resource.GetResourceValue("GroupDeleted");
await MessageDialogHelper.ShowActionDialog(resource.GetResourceValue("EntityDeleteTitle"), message,
resource.GetResourceValue("EntityDeleteActionButton"),
resource.GetResourceValue("EntityDeleteCancelButton"), async a =>
{
//ToastNotificationHelper.ShowMovedToast(Entity, resource.GetResourceValue("EntityDeleting"), text);
await Model.MarkForDelete(resource.GetResourceValue("RecycleBinTitle"));
NavigationHelper.GoBack();
}, null);
}
#endregion
}
}

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using ModernKeePass.Domain.Enums;
// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236
@@ -10,7 +11,7 @@ namespace ModernKeePass.Views.UserControls
{
public sealed partial class SymbolPickerUserControl
{
public IEnumerable<Symbol> Symbols { get; }
public List<Symbol> Symbols { get; }
public Symbol SelectedSymbol
{
@@ -27,7 +28,12 @@ namespace ModernKeePass.Views.UserControls
public SymbolPickerUserControl()
{
InitializeComponent();
Symbols = Enum.GetValues(typeof(Symbol)).Cast<Symbol>();
Symbols = new List<Symbol>();
var names = Enum.GetNames(typeof(Icon));
foreach (var name in names)
{
Symbols.Add((Symbol) Enum.Parse(typeof(Symbol), name));
}
}
private void ComboBox_OnLoaded(object sender, RoutedEventArgs e)