mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
Move finally works
Sort entries and groups refresh page info Stopped using breadcrumb user control - for now Some refactoring
This commit is contained in:
@@ -13,6 +13,9 @@
|
||||
<Setter Property="Foreground" Value="{ThemeResource SearchBoxForegroundThemeBrush}" />
|
||||
<Setter Property="Padding" Value="{ThemeResource SearchBoxThemePadding}"/>
|
||||
<Setter Property="IsTabStop" Value="False" />
|
||||
<Setter Property="Width" Value="350" />
|
||||
<Setter Property="Height" Value="32" />
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
<Setter Property="Typography.StylisticSet20" Value="True"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
|
@@ -27,7 +27,9 @@ using ModernKeePass.Application.Security.Commands.GeneratePassword;
|
||||
using ModernKeePass.Application.Security.Queries.EstimatePasswordComplexity;
|
||||
using ModernKeePass.Domain.Enums;
|
||||
using ModernKeePass.Application.Group.Models;
|
||||
using ModernKeePass.Common;
|
||||
using ModernKeePass.Extensions;
|
||||
using ModernKeePass.Models;
|
||||
|
||||
namespace ModernKeePass.ViewModels
|
||||
{
|
||||
@@ -45,8 +47,11 @@ namespace ModernKeePass.ViewModels
|
||||
public bool SpecialPatternSelected { get; set; }
|
||||
public bool BracketsPatternSelected { get; set; }
|
||||
public string CustomChars { get; set; } = string.Empty;
|
||||
|
||||
public string Id => SelectedItem.Id;
|
||||
|
||||
public string ParentGroupName => _parent.Title;
|
||||
|
||||
public bool IsRecycleOnDelete
|
||||
{
|
||||
get
|
||||
@@ -221,6 +226,7 @@ namespace ModernKeePass.ViewModels
|
||||
public RelayCommand RestoreCommand { get; }
|
||||
public RelayCommand DeleteCommand { get; }
|
||||
public RelayCommand GoBackCommand { get; }
|
||||
public RelayCommand GoToParentCommand { get; set; }
|
||||
|
||||
private DatabaseVm Database => _mediator.Send(new GetDatabaseQuery()).GetAwaiter().GetResult();
|
||||
|
||||
@@ -251,6 +257,7 @@ namespace ModernKeePass.ViewModels
|
||||
RestoreCommand = new RelayCommand(async () => await RestoreHistory());
|
||||
DeleteCommand = new RelayCommand(async () => await AskForDelete());
|
||||
GoBackCommand = new RelayCommand(() => _navigation.GoBack());
|
||||
GoToParentCommand = new RelayCommand(() => GoToGroup(_parent.Id));
|
||||
}
|
||||
|
||||
public async Task Initialize(string entryId)
|
||||
@@ -323,6 +330,7 @@ namespace ModernKeePass.ViewModels
|
||||
{
|
||||
await _mediator.Send(new AddEntryCommand { ParentGroupId = destination, EntryId = Id });
|
||||
await _mediator.Send(new RemoveEntryCommand { ParentGroupId = _parent.Id, EntryId = Id });
|
||||
GoToGroup(destination);
|
||||
}
|
||||
|
||||
public async Task SetFieldValue(string fieldName, object value)
|
||||
@@ -363,5 +371,10 @@ namespace ModernKeePass.ViewModels
|
||||
});
|
||||
_navigation.GoBack();
|
||||
}
|
||||
|
||||
public void GoToGroup(string groupId)
|
||||
{
|
||||
_navigation.NavigateTo(Constants.Navigation.GroupPage, new NavigationItem { Id = groupId });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -79,12 +79,12 @@ namespace ModernKeePass.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public string ParentGroupName => _parent?.Title;
|
||||
|
||||
public bool IsRecycleOnDelete => Database.IsRecycleBinEnabled && !IsInRecycleBin;
|
||||
|
||||
public bool IsInRecycleBin => _parent != null && _parent.Id == Database.RecycleBinId;
|
||||
|
||||
public IEnumerable<GroupVm> BreadCrumb { get; private set; }
|
||||
|
||||
|
||||
public RelayCommand SaveCommand { get; }
|
||||
public RelayCommand SortEntriesCommand { get; }
|
||||
public RelayCommand SortGroupsCommand { get; }
|
||||
@@ -93,9 +93,10 @@ namespace ModernKeePass.ViewModels
|
||||
public RelayCommand CreateGroupCommand { get; }
|
||||
public RelayCommand DeleteCommand { get; set; }
|
||||
public RelayCommand GoBackCommand { get; set; }
|
||||
public RelayCommand GoToParentCommand { get; set; }
|
||||
|
||||
private DatabaseVm Database => _mediator.Send(new GetDatabaseQuery()).GetAwaiter().GetResult();
|
||||
|
||||
|
||||
private readonly IMediator _mediator;
|
||||
private readonly IResourceProxy _resource;
|
||||
private readonly INavigationService _navigation;
|
||||
@@ -122,6 +123,7 @@ namespace ModernKeePass.ViewModels
|
||||
CreateGroupCommand = new RelayCommand(async () => await AddNewGroup(), () => !IsInRecycleBin && Database.RecycleBinId != Id);
|
||||
DeleteCommand = new RelayCommand(async () => await AskForDelete(),() => IsNotRoot);
|
||||
GoBackCommand = new RelayCommand(() => _navigation.GoBack());
|
||||
GoToParentCommand= new RelayCommand(() => GoToGroup(_parent.Id), () => _parent != null);
|
||||
}
|
||||
|
||||
public async Task Initialize(string groupId)
|
||||
@@ -130,7 +132,6 @@ namespace ModernKeePass.ViewModels
|
||||
if (!string.IsNullOrEmpty(_group.ParentGroupId))
|
||||
{
|
||||
_parent = await _mediator.Send(new GetGroupQuery { Id = _group.ParentGroupId });
|
||||
BreadCrumb = new List<GroupVm> { _parent };
|
||||
}
|
||||
|
||||
Entries = new ObservableCollection<EntryVm>(_group.Entries);
|
||||
@@ -146,11 +147,11 @@ namespace ModernKeePass.ViewModels
|
||||
IsNew = isNew
|
||||
});
|
||||
}
|
||||
public void GoToGroup(string entryId, bool isNew = false)
|
||||
public void GoToGroup(string groupId, bool isNew = false)
|
||||
{
|
||||
_navigation.NavigateTo(Constants.Navigation.GroupPage, new NavigationItem
|
||||
{
|
||||
Id = entryId,
|
||||
Id = groupId,
|
||||
IsNew = isNew
|
||||
});
|
||||
}
|
||||
@@ -171,6 +172,7 @@ namespace ModernKeePass.ViewModels
|
||||
{
|
||||
await _mediator.Send(new AddGroupCommand {ParentGroupId = destinationId, GroupId = Id });
|
||||
await _mediator.Send(new RemoveGroupCommand {ParentGroupId = _parent.Id, GroupId = Id });
|
||||
GoToGroup(destinationId);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<EntryVm>> Search(string queryText)
|
||||
@@ -210,6 +212,8 @@ namespace ModernKeePass.ViewModels
|
||||
private async Task SortEntriesAsync()
|
||||
{
|
||||
await _mediator.Send(new SortEntriesCommand {Group = _group});
|
||||
Entries = new ObservableCollection<EntryVm>(_group.Entries);
|
||||
Entries.CollectionChanged += Entries_CollectionChanged;
|
||||
RaisePropertyChanged(nameof(Entries));
|
||||
SaveCommand.RaiseCanExecuteChanged();
|
||||
}
|
||||
@@ -217,6 +221,7 @@ namespace ModernKeePass.ViewModels
|
||||
private async Task SortGroupsAsync()
|
||||
{
|
||||
await _mediator.Send(new SortGroupsCommand {Group = _group});
|
||||
Groups = new ObservableCollection<GroupVm>(_group.SubGroups);
|
||||
RaisePropertyChanged(nameof(Groups));
|
||||
SaveCommand.RaiseCanExecuteChanged();
|
||||
}
|
||||
|
@@ -402,14 +402,9 @@
|
||||
<Setter Property="Margin" Value="0,20,0,0"/>
|
||||
<Setter Property="FontSize" Value="18"/>
|
||||
</Style>
|
||||
<Style BasedOn="{StaticResource TextBoxWithButtonStyle}" TargetType="local:TextBoxWithButton" x:Key="EntryTextBoxWithButtonStyle">
|
||||
<Setter Property="Width" Value="350"/>
|
||||
<Setter Property="Height" Value="32"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
<TextBlock x:Uid="EntryLogin" />
|
||||
<local:TextBoxWithButton x:Uid="LoginTextBox" Text="{Binding UserName, Mode=TwoWay}" Style="{StaticResource EntryTextBoxWithButtonStyle}" ButtonSymbol="" IsEnabled="{Binding IsCurrentEntry}">
|
||||
<local:TextBoxWithButton x:Uid="LoginTextBox" Text="{Binding UserName, Mode=TwoWay}" Style="{StaticResource TextBoxWithButtonStyle}" ButtonSymbol="" IsEnabled="{Binding IsCurrentEntry}">
|
||||
<interactivity:Interaction.Behaviors>
|
||||
<core:EventTriggerBehavior EventName="ButtonClick">
|
||||
<actions:ClipboardAction Text="{Binding UserName}" />
|
||||
@@ -419,7 +414,7 @@
|
||||
</local:TextBoxWithButton>
|
||||
<TextBlock x:Uid="EntryPassword" />
|
||||
<PasswordBox HorizontalAlignment="Left" Password="{Binding Password, Mode=TwoWay}" Width="350" Height="32" IsPasswordRevealButtonEnabled="True" Visibility="{Binding IsRevealPassword, Converter={StaticResource InverseBooleanToVisibilityConverter}}" Style="{StaticResource PasswordBoxWithButtonStyle}" IsEnabled="{Binding IsCurrentEntry}" />
|
||||
<local:TextBoxWithButton x:Uid="PasswordTextBox" Text="{Binding Password, Mode=TwoWay}" Visibility="{Binding IsRevealPassword, Converter={StaticResource BooleanToVisibilityConverter}}" Style="{StaticResource EntryTextBoxWithButtonStyle}" ButtonSymbol="" IsEnabled="{Binding IsCurrentEntry}">
|
||||
<local:TextBoxWithButton x:Uid="PasswordTextBox" Text="{Binding Password, Mode=TwoWay}" Visibility="{Binding IsRevealPassword, Converter={StaticResource BooleanToVisibilityConverter}}" Style="{StaticResource TextBoxWithButtonStyle}" ButtonSymbol="" IsEnabled="{Binding IsCurrentEntry}">
|
||||
<interactivity:Interaction.Behaviors>
|
||||
<core:EventTriggerBehavior EventName="ButtonClick">
|
||||
<actions:ClipboardAction Text="{Binding Password}" />
|
||||
@@ -430,7 +425,7 @@
|
||||
<ProgressBar Value="{Binding PasswordComplexityIndicator, ConverterParameter=0\,128, Converter={StaticResource ProgressBarLegalValuesConverter}}" Maximum="128" Width="350" HorizontalAlignment="Left" Foreground="{Binding PasswordComplexityIndicator, ConverterParameter=128, Converter={StaticResource DoubleToForegroundBrushComplexityConverter}}" />
|
||||
<CheckBox x:Uid="EntryShowPassword" HorizontalAlignment="Left" Margin="-3,0,0,0" IsChecked="{Binding IsRevealPassword, Mode=TwoWay}" IsEnabled="{Binding IsRevealPasswordEnabled}" />
|
||||
<TextBlock TextWrapping="Wrap" Text="URL" FontSize="18"/>
|
||||
<local:TextBoxWithButton x:Uid="UrlTextBox" Text="{Binding Url, Mode=TwoWay}" Style="{StaticResource EntryTextBoxWithButtonStyle}" ButtonSymbol="" IsEnabled="{Binding IsCurrentEntry}">
|
||||
<local:TextBoxWithButton x:Uid="UrlTextBox" Text="{Binding Url, Mode=TwoWay}" Style="{StaticResource TextBoxWithButtonStyle}" ButtonSymbol="" IsEnabled="{Binding IsCurrentEntry}">
|
||||
<interactivity:Interaction.Behaviors>
|
||||
<core:EventTriggerBehavior EventName="ButtonClick">
|
||||
<actions:NavigateToUrlAction Url="{Binding Url}" />
|
||||
@@ -524,7 +519,12 @@
|
||||
</core:DataTriggerBehavior>
|
||||
</interactivity:Interaction.Behaviors>
|
||||
</TextBox>
|
||||
<userControls:BreadCrumbUserControl Grid.Column="1" Grid.Row="1" ItemsSource="{Binding BreadCrumb}" Margin="5,-5,0,0" />
|
||||
<HyperlinkButton Grid.Column="1" Grid.Row="1"
|
||||
FontWeight="Light" FontSize="12" Padding="0" Margin="5,-5,0,0"
|
||||
Foreground="{StaticResource MainColor}"
|
||||
Content="{Binding ParentGroupName}"
|
||||
Style="{StaticResource MainColorHyperlinkButton}"
|
||||
Command="{Binding GoToParentCommand}"/>
|
||||
</Grid>
|
||||
<userControls:TopMenuUserControl
|
||||
x:Name="TopMenu" Grid.Column="2"
|
||||
|
@@ -236,12 +236,16 @@
|
||||
</core:DataTriggerBehavior>
|
||||
</interactivity:Interaction.Behaviors>
|
||||
</TextBox>
|
||||
<userControls:BreadCrumbUserControl Grid.Column="1" Grid.Row="1" ItemsSource="{Binding BreadCrumb}" Margin="5,-5,0,0" />
|
||||
<HyperlinkButton Grid.Column="1" Grid.Row="1"
|
||||
FontWeight="Light" FontSize="12" Padding="0" Margin="5,-5,0,0"
|
||||
Foreground="{StaticResource MainColor}"
|
||||
Content="{Binding ParentGroupName}"
|
||||
Style="{StaticResource MainColorHyperlinkButton}"
|
||||
Command="{Binding GoToParentCommand}"/>
|
||||
</Grid>
|
||||
<userControls:TopMenuUserControl x:Name="TopMenu" Grid.Column="2"
|
||||
SortButtonVisibility="{Binding IsEditMode, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
IsEditButtonChecked="{Binding IsEditMode, Mode=TwoWay}"
|
||||
IsDeleteButtonEnabled="{Binding IsNotRoot}"
|
||||
SaveCommand="{Binding SaveCommand}"
|
||||
MoveCommand="{Binding MoveCommand}"
|
||||
SortEntriesCommand="{Binding SortEntriesCommand}"
|
||||
|
@@ -12,7 +12,7 @@
|
||||
<converters:NullToBooleanConverter x:Key="NullToBooleanConverter"/>
|
||||
</Page.Resources>
|
||||
|
||||
<StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" DataContext="{StaticResource ViewModel}">
|
||||
<StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<StackPanel.Resources>
|
||||
<CollectionViewSource x:Name="RecycleBinGroups" Source="{Binding Groups}" />
|
||||
<CollectionViewSource x:Name="Ciphers" Source="{Binding Ciphers}" />
|
||||
|
@@ -16,7 +16,11 @@
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.Resources>
|
||||
<DataTemplate x:Name="FirstItemTemplate">
|
||||
<HyperlinkButton Foreground="{StaticResource MainColor}" Content="{Binding Title}" Style="{StaticResource MainColorHyperlinkButton}" FontWeight="Light" FontSize="12" Padding="0">
|
||||
<HyperlinkButton
|
||||
FontWeight="Light" FontSize="12" Padding="0"
|
||||
Foreground="{StaticResource MainColor}"
|
||||
Content="{Binding Title}"
|
||||
Style="{StaticResource MainColorHyperlinkButton}">
|
||||
<interactivity:Interaction.Behaviors>
|
||||
<core:EventTriggerBehavior EventName="Click">
|
||||
<core:NavigateToPageAction Parameter="{Binding Id}" TargetPage="ModernKeePass.Views.GroupDetailPage" />
|
||||
|
@@ -56,10 +56,9 @@
|
||||
</ToolTipService.ToolTip>
|
||||
</SymbolIcon>
|
||||
<Button.Flyout>
|
||||
<Flyout>
|
||||
<Flyout Opening="MoveButtonFlyout_OnOpening">
|
||||
<StackPanel>
|
||||
<SearchBox
|
||||
x:Uid="GroupsSearch"
|
||||
<SearchBox x:Uid="GroupsSearch"
|
||||
Padding="12" Width="350"
|
||||
Margin="0,5,0,5"
|
||||
FontSize="15"
|
||||
@@ -68,7 +67,7 @@
|
||||
SearchHistoryEnabled="False"
|
||||
Style="{StaticResource MainColorSearchBox}">
|
||||
</SearchBox>
|
||||
<Button x:Uid="MoveButton" Command="{Binding MoveCommand, ElementName=UserControl}" CommandParameter="{Binding SelectedDestinationGroup}" Style="{StaticResource MainColorButton}" />
|
||||
<Button x:Name="MoveButton" x:Uid="MoveButton" Style="{StaticResource MainColorButton}" />
|
||||
</StackPanel>
|
||||
</Flyout>
|
||||
</Button.Flyout>
|
||||
@@ -100,7 +99,7 @@
|
||||
</ToolTipService.ToolTip>
|
||||
</SymbolIcon>
|
||||
</ToggleButton>
|
||||
<Button Command="{Binding DeleteCommand, ElementName=UserControl}" IsEnabled="{Binding IsDeleteButtonEnabled, ElementName=UserControl}" Click="DeleteButton_Click" Style="{StaticResource MenuButtonStyle}">
|
||||
<Button Command="{Binding DeleteCommand, ElementName=UserControl}" Style="{StaticResource MenuButtonStyle}">
|
||||
<SymbolIcon Symbol="Delete">
|
||||
<ToolTipService.ToolTip>
|
||||
<ToolTip x:Uid="TopMenuDeleteButton" />
|
||||
@@ -112,13 +111,13 @@
|
||||
<SymbolIcon Symbol="More" />
|
||||
<Button.Flyout>
|
||||
<MenuFlyout Opening="OverflowFlyout_OnOpening">
|
||||
<MenuFlyoutItem x:Uid="TopMenuSaveFlyout" Command="{Binding SaveCommand, ElementName=UserControl}" />
|
||||
<MenuFlyoutItem x:Uid="TopMenuSaveFlyout" x:Name="SaveFlyout" />
|
||||
<MenuFlyoutItem x:Uid="TopMenuMoveFlyout" x:Name="MoveFlyout" Visibility="{Binding MoveButtonVisibility, ElementName=UserControl}" />
|
||||
<MenuFlyoutItem x:Uid="TopMenuRestoreFlyout" x:Name="RestoreFlyout" Command="{Binding RestoreCommand, ElementName=UserControl}" Visibility="{Binding RestoreButtonVisibility, ElementName=UserControl}" />
|
||||
<ToggleMenuFlyoutItem x:Uid="TopMenuEditFlyout" x:Name="EditFlyout" Command="{Binding EditCommand, ElementName=UserControl}" IsChecked="{Binding IsEditButtonChecked, ElementName=UserControl, Mode=TwoWay}" Click="EditButton_Click" />
|
||||
<MenuFlyoutItem x:Uid="TopMenuDeleteFlyout" x:Name="DeleteFlyout" Command="{Binding DeleteCommand, ElementName=UserControl}" IsEnabled="{Binding IsDeleteButtonEnabled, ElementName=UserControl}" Click="DeleteButton_Click" />
|
||||
<MenuFlyoutItem x:Uid="TopMenuSortEntriesFlyout" x:Name="SortEntriesFlyout" Command="{Binding SortEntriesCommand, ElementName=UserControl}" Visibility="{Binding SortButtonVisibility, ElementName=UserControl}" />
|
||||
<MenuFlyoutItem x:Uid="TopMenuSortGroupsFlyout" x:Name="SortGroupsFlyout" Command="{Binding SortGroupsCommand, ElementName=UserControl}" Visibility="{Binding SortButtonVisibility, ElementName=UserControl}" />
|
||||
<MenuFlyoutItem x:Uid="TopMenuRestoreFlyout" x:Name="RestoreFlyout" Visibility="{Binding RestoreButtonVisibility, ElementName=UserControl}" />
|
||||
<ToggleMenuFlyoutItem x:Uid="TopMenuEditFlyout" x:Name="EditFlyout" IsChecked="{Binding IsEditButtonChecked, ElementName=UserControl, Mode=TwoWay}" Click="EditButton_Click" />
|
||||
<MenuFlyoutItem x:Uid="TopMenuDeleteFlyout" x:Name="DeleteFlyout" />
|
||||
<MenuFlyoutItem x:Uid="TopMenuSortEntriesFlyout" x:Name="SortEntriesFlyout" Visibility="{Binding SortButtonVisibility, ElementName=UserControl}" />
|
||||
<MenuFlyoutItem x:Uid="TopMenuSortGroupsFlyout" x:Name="SortGroupsFlyout" Visibility="{Binding SortButtonVisibility, ElementName=UserControl}" />
|
||||
</MenuFlyout>
|
||||
</Button.Flyout>
|
||||
</Button>
|
||||
|
@@ -134,18 +134,6 @@ namespace ModernKeePass.Views.UserControls
|
||||
typeof(Visibility),
|
||||
typeof(TopMenuUserControl),
|
||||
new PropertyMetadata(Visibility.Collapsed, (o, args) => { }));
|
||||
|
||||
public bool IsDeleteButtonEnabled
|
||||
{
|
||||
get { return (bool)GetValue(IsDeleteButtonEnabledProperty); }
|
||||
set { SetValue(IsDeleteButtonEnabledProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty IsDeleteButtonEnabledProperty =
|
||||
DependencyProperty.Register(
|
||||
nameof(IsDeleteButtonEnabled),
|
||||
typeof(bool),
|
||||
typeof(TopMenuUserControl),
|
||||
new PropertyMetadata(true, (o, args) => { }));
|
||||
|
||||
public bool IsEditButtonChecked
|
||||
{
|
||||
@@ -160,7 +148,6 @@ namespace ModernKeePass.Views.UserControls
|
||||
new PropertyMetadata(false, (o, args) => { }));
|
||||
|
||||
public event EventHandler<RoutedEventArgs> EditButtonClick;
|
||||
public event EventHandler<RoutedEventArgs> DeleteButtonClick;
|
||||
|
||||
public TopMenuUserControl()
|
||||
{
|
||||
@@ -179,27 +166,28 @@ namespace ModernKeePass.Views.UserControls
|
||||
EditButtonClick?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
private void DeleteButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DeleteButtonClick?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
private void OverflowFlyout_OnOpening(object sender, object e)
|
||||
{
|
||||
DeleteFlyout.IsEnabled = IsDeleteButtonEnabled;
|
||||
DeleteFlyout.IsEnabled = IsDeleteButtonEnabled;
|
||||
|
||||
EditFlyout.IsChecked = IsEditButtonChecked;
|
||||
|
||||
MoveFlyout.Visibility = MoveButtonVisibility;
|
||||
RestoreFlyout.Visibility = RestoreButtonVisibility;
|
||||
|
||||
SortEntriesFlyout.Visibility = SortButtonVisibility;
|
||||
SortGroupsFlyout.Visibility = SortButtonVisibility;
|
||||
|
||||
SaveFlyout.Command = SaveCommand;
|
||||
DeleteFlyout.Command = DeleteCommand;
|
||||
RestoreFlyout.Command = RestoreCommand;
|
||||
SortEntriesFlyout.Command = SortEntriesCommand;
|
||||
SortGroupsFlyout.Command = SortGroupsCommand;
|
||||
}
|
||||
|
||||
// These are somehow necessary as otherwise, the command is not bound
|
||||
private void MoveButtonFlyout_OnOpening(object sender, object e)
|
||||
{
|
||||
MoveButton.Command = MoveCommand;
|
||||
}
|
||||
|
||||
private void SortFlyout_OnOpening(object sender, object e)
|
||||
{
|
||||
SortEntriesButtonFlyout.Command = SortEntriesCommand;
|
||||
@@ -209,15 +197,21 @@ namespace ModernKeePass.Views.UserControls
|
||||
private void SearchBox_OnSuggestionsRequested(SearchBox sender, SearchBoxSuggestionsRequestedEventArgs args)
|
||||
{
|
||||
var imageUri = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appdata://Assets/ModernKeePass-SmallLogo.scale-80.png"));
|
||||
foreach (var group in Model.Groups.Where(g => g.Title.IndexOf(args.QueryText, StringComparison.OrdinalIgnoreCase) >= 0))
|
||||
var groups = Model.Groups.Where(g => g.Title.IndexOf(args.QueryText, StringComparison.OrdinalIgnoreCase) >= 0).Take(5);
|
||||
foreach (var group in groups)
|
||||
{
|
||||
args.Request.SearchSuggestionCollection.AppendResultSuggestion(group.Title, group.ParentGroupName, group.Id, imageUri, string.Empty);
|
||||
args.Request.SearchSuggestionCollection.AppendResultSuggestion(
|
||||
group.Title,
|
||||
group.ParentGroupName,
|
||||
group.Id,
|
||||
imageUri,
|
||||
string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
private void SearchBox_OnResultSuggestionChosen(SearchBox sender, SearchBoxResultSuggestionChosenEventArgs args)
|
||||
{
|
||||
Model.SelectedDestinationGroup = args.Tag;
|
||||
MoveButton.CommandParameter = args.Tag;
|
||||
MoveCommand.RaiseCanExecuteChanged();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user