Created Import/Export page (stub)

Changed some dependency properties from Interfaces to implementations
Used CanExecute on Commands
This commit is contained in:
BONNEVILLE Geoffroy
2018-08-02 17:40:30 +02:00
parent b2dd028fc7
commit 6f96e698ec
13 changed files with 127 additions and 94 deletions

View File

@@ -1,46 +0,0 @@
using System.Windows.Input;
using Windows.UI.Xaml;
using Microsoft.Xaml.Interactivity;
using ModernKeePass.Common;
using ModernKeePass.Interfaces;
using ModernKeePass.Services;
using ModernKeePass.ViewModels;
namespace ModernKeePass.Actions
{
public class RestoreEntityAction : DependencyObject, IAction
{
public IPwEntity Entity
{
get { return (IPwEntity)GetValue(EntityProperty); }
set { SetValue(EntityProperty, value); }
}
public static readonly DependencyProperty EntityProperty =
DependencyProperty.Register("Entity", typeof(IPwEntity), typeof(RestoreEntityAction),
new PropertyMetadata(null));
public ICommand Command
{
get { return (ICommand)GetValue(CommandProperty); }
set { SetValue(CommandProperty, value); }
}
public static readonly DependencyProperty CommandProperty =
DependencyProperty.Register("Command", typeof(ICommand), typeof(RestoreEntityAction),
new PropertyMetadata(null));
public object Execute(object sender, object parameter)
{
var resource = new ResourcesService();
var type = Entity is GroupVm ? "Group" : "Entry";
ToastNotificationHelper.ShowMovedToast(Entity, resource.GetResourceValue("EntityRestoredTitle"),
resource.GetResourceValue($"{type}Restored"));
Command.Execute(null);
return null;
}
}
}

View File

@@ -1,6 +1,4 @@
using System; using System;
using System.Linq;
using System.Reflection;
using Windows.UI.Xaml; using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls;

View File

@@ -110,7 +110,6 @@
<Compile Include="Actions\ClipboardAction.cs" /> <Compile Include="Actions\ClipboardAction.cs" />
<Compile Include="Actions\DeleteEntityAction.cs" /> <Compile Include="Actions\DeleteEntityAction.cs" />
<Compile Include="Actions\NavigateToUrlAction.cs" /> <Compile Include="Actions\NavigateToUrlAction.cs" />
<Compile Include="Actions\RestoreEntityAction.cs" />
<Compile Include="Actions\SetupFocusAction.cs" /> <Compile Include="Actions\SetupFocusAction.cs" />
<Compile Include="Actions\ToastAction.cs" /> <Compile Include="Actions\ToastAction.cs" />
<Compile Include="App.xaml.cs"> <Compile Include="App.xaml.cs">
@@ -149,6 +148,9 @@
<Compile Include="Interfaces\IHasSelectableObject.cs" /> <Compile Include="Interfaces\IHasSelectableObject.cs" />
<Compile Include="Interfaces\ISelectableModel.cs" /> <Compile Include="Interfaces\ISelectableModel.cs" />
<Compile Include="Views\BasePages\LayoutAwarePageBase.cs" /> <Compile Include="Views\BasePages\LayoutAwarePageBase.cs" />
<Compile Include="Views\MainPageFrames\ImportExportPage.xaml.cs">
<DependentUpon>ImportExportPage.xaml</DependentUpon>
</Compile>
<Compile Include="Views\SettingsPageFrames\SettingsDatabasePage.xaml.cs"> <Compile Include="Views\SettingsPageFrames\SettingsDatabasePage.xaml.cs">
<DependentUpon>SettingsDatabasePage.xaml</DependentUpon> <DependentUpon>SettingsDatabasePage.xaml</DependentUpon>
</Compile> </Compile>
@@ -267,6 +269,10 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Page> </Page>
<Page Include="Views\MainPageFrames\ImportExportPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\SettingsPageFrames\SettingsSavePage.xaml"> <Page Include="Views\SettingsPageFrames\SettingsSavePage.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>

View File

@@ -477,4 +477,10 @@
<data name="UrlTextBox.ButtonTooltip" xml:space="preserve"> <data name="UrlTextBox.ButtonTooltip" xml:space="preserve">
<value>Navigate to URL</value> <value>Navigate to URL</value>
</data> </data>
<data name="RestoreEntryCommand.Message" xml:space="preserve">
<value>Entry restored to its original position</value>
</data>
<data name="RestoreGroupCommand.Message" xml:space="preserve">
<value>Group restored to its original position</value>
</data>
</root> </root>

View File

@@ -477,4 +477,10 @@
<data name="UrlTextBox.ButtonTooltip" xml:space="preserve"> <data name="UrlTextBox.ButtonTooltip" xml:space="preserve">
<value>Naviguer vers l'URL</value> <value>Naviguer vers l'URL</value>
</data> </data>
<data name="RestoreEntryCommand.Message" xml:space="preserve">
<value>Entrée replacée à son emplacement d'origine</value>
</data>
<data name="RestoreGroupCommand.Message" xml:space="preserve">
<value>Groupe replacée à son emplacement d'origine</value>
</data>
</root> </root>

View File

@@ -228,7 +228,7 @@ namespace ModernKeePass.ViewModels
SaveCommand = new RelayCommand(() => _database.Save()); SaveCommand = new RelayCommand(() => _database.Save());
GeneratePasswordCommand = new RelayCommand(GeneratePassword); GeneratePasswordCommand = new RelayCommand(GeneratePassword);
UndoDeleteCommand = new RelayCommand(() => Move(PreviousGroup)); UndoDeleteCommand = new RelayCommand(() => Move(PreviousGroup), () => PreviousGroup != null);
} }
public void GeneratePassword() public void GeneratePassword()

View File

@@ -84,7 +84,12 @@ namespace ModernKeePass.ViewModels
public bool IsEditMode public bool IsEditMode
{ {
get { return _isEditMode; } get { return _isEditMode; }
set { SetProperty(ref _isEditMode, value); } set
{
SetProperty(ref _isEditMode, value);
((RelayCommand)SortEntriesCommand).RaiseCanExecuteChanged();
((RelayCommand)SortGroupsCommand).RaiseCanExecuteChanged();
}
} }
public bool IsMenuClosed public bool IsMenuClosed
@@ -136,10 +141,10 @@ namespace ModernKeePass.ViewModels
SaveCommand = new RelayCommand(() => _database.Save()); SaveCommand = new RelayCommand(() => _database.Save());
SortEntriesCommand = new RelayCommand(async () => SortEntriesCommand = new RelayCommand(async () =>
await SortEntriesAsync().ConfigureAwait(false)); await SortEntriesAsync().ConfigureAwait(false), () => IsEditMode);
SortGroupsCommand = new RelayCommand(async () => SortGroupsCommand = new RelayCommand(async () =>
await SortGroupsAsync().ConfigureAwait(false)); await SortGroupsAsync().ConfigureAwait(false), () => IsEditMode);
UndoDeleteCommand = new RelayCommand(() => Move(PreviousGroup)); UndoDeleteCommand = new RelayCommand(() => Move(PreviousGroup), () => PreviousGroup != null);
if (recycleBinId != null && _pwGroup.Uuid.Equals(recycleBinId)) _database.RecycleBin = this; if (recycleBinId != null && _pwGroup.Uuid.Equals(recycleBinId)) _database.RecycleBin = this;
Entries = new ObservableCollection<EntryVm>(pwGroup.Entries.Select(e => new EntryVm(e, this))); Entries = new ObservableCollection<EntryVm>(pwGroup.Entries.Select(e => new EntryVm(e, this)));
@@ -186,6 +191,7 @@ namespace ModernKeePass.ViewModels
if (_database.RecycleBinEnabled && _database.RecycleBin?.IdUuid == null) if (_database.RecycleBinEnabled && _database.RecycleBin?.IdUuid == null)
_database.CreateRecycleBin(recycleBinTitle); _database.CreateRecycleBin(recycleBinTitle);
Move(_database.RecycleBinEnabled && !IsSelected ? _database.RecycleBin : null); Move(_database.RecycleBinEnabled && !IsSelected ? _database.RecycleBin : null);
((RelayCommand)UndoDeleteCommand).RaiseCanExecuteChanged();
} }
public void UndoDelete() public void UndoDelete()

View File

@@ -529,7 +529,6 @@
RestoreButtonVisibility="{Binding ParentGroup.IsSelected, Converter={StaticResource BooleanToVisibilityConverter}}" RestoreButtonVisibility="{Binding ParentGroup.IsSelected, Converter={StaticResource BooleanToVisibilityConverter}}"
DeleteButtonVisibility="{Binding IsSelected, Converter={StaticResource BooleanToVisibilityConverter}}" DeleteButtonVisibility="{Binding IsSelected, Converter={StaticResource BooleanToVisibilityConverter}}"
IsEditButtonChecked="{Binding IsEditMode, Mode=TwoWay}" IsEditButtonChecked="{Binding IsEditMode, Mode=TwoWay}"
IsRestoreButtonEnabled="{Binding PreviousGroup, Converter={StaticResource NullToBooleanConverter}}"
SaveCommand="{Binding SaveCommand}" SaveCommand="{Binding SaveCommand}"
RestoreCommand="{Binding UndoDeleteCommand}"> RestoreCommand="{Binding UndoDeleteCommand}">
<interactivity:Interaction.Behaviors> <interactivity:Interaction.Behaviors>
@@ -540,7 +539,8 @@
<actions:DeleteEntityAction Entity="{Binding}" Command="{Binding NavigationHelper.GoBackCommand, ElementName=PageRoot}" /> <actions:DeleteEntityAction Entity="{Binding}" Command="{Binding NavigationHelper.GoBackCommand, ElementName=PageRoot}" />
</core:EventTriggerBehavior> </core:EventTriggerBehavior>
<core:EventTriggerBehavior EventName="RestoreButtonClick"> <core:EventTriggerBehavior EventName="RestoreButtonClick">
<actions:RestoreEntityAction Entity="{Binding}" Command="{Binding NavigationHelper.GoBackCommand, ElementName=PageRoot}" /> <core:InvokeCommandAction Command="{Binding NavigationHelper.GoBackCommand, ElementName=PageRoot}" />
<actions:ToastAction x:Uid="RestoreEntryCommand" Title="{Binding Name}" />
</core:EventTriggerBehavior> </core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors> </interactivity:Interaction.Behaviors>
</userControls:TopMenuUserControl> </userControls:TopMenuUserControl>

View File

@@ -239,7 +239,6 @@
SortButtonVisibility="{Binding IsEditMode, Converter={StaticResource BooleanToVisibilityConverter}}" SortButtonVisibility="{Binding IsEditMode, Converter={StaticResource BooleanToVisibilityConverter}}"
IsEditButtonChecked="{Binding IsEditMode, Mode=TwoWay}" IsEditButtonChecked="{Binding IsEditMode, Mode=TwoWay}"
IsDeleteButtonEnabled="{Binding IsNotRoot}" IsDeleteButtonEnabled="{Binding IsNotRoot}"
IsRestoreButtonEnabled="{Binding PreviousGroup, Converter={StaticResource NullToBooleanConverter}}"
SaveCommand="{Binding SaveCommand}" SaveCommand="{Binding SaveCommand}"
RestoreCommand="{Binding UndoDeleteCommand}" RestoreCommand="{Binding UndoDeleteCommand}"
SortEntriesCommand="{Binding SortEntriesCommand}" SortEntriesCommand="{Binding SortEntriesCommand}"
@@ -252,7 +251,8 @@
<actions:DeleteEntityAction Entity="{Binding}" Command="{Binding NavigationHelper.GoBackCommand, ElementName=PageRoot}" /> <actions:DeleteEntityAction Entity="{Binding}" Command="{Binding NavigationHelper.GoBackCommand, ElementName=PageRoot}" />
</core:EventTriggerBehavior> </core:EventTriggerBehavior>
<core:EventTriggerBehavior EventName="RestoreButtonClick"> <core:EventTriggerBehavior EventName="RestoreButtonClick">
<actions:RestoreEntityAction Entity="{Binding}" Command="{Binding NavigationHelper.GoBackCommand, ElementName=PageRoot}" /> <core:InvokeCommandAction Command="{Binding NavigationHelper.GoBackCommand, ElementName=PageRoot}" />
<actions:ToastAction x:Uid="RestoreGroupCommand" Title="{Binding Name}" />
</core:EventTriggerBehavior> </core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors> </interactivity:Interaction.Behaviors>
</userControls:TopMenuUserControl> </userControls:TopMenuUserControl>

View File

@@ -0,0 +1,35 @@
<Page
x:Class="ModernKeePass.Views.ImportExportPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="200" />
<ColumnDefinition Width="200" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Text="Import" Style="{StaticResource SubheaderTextBlockStyle}" />
<HyperlinkButton Grid.Column="0" Grid.Row="1" Content="Select file..." Style="{StaticResource MainColorHyperlinkButton}" Click="ImportFileButton_OnClick" />
<StackPanel Grid.Column="1" Grid.Row="1" >
<TextBlock Text="Format" Style="{StaticResource BodyTextBlockStyle}" Margin="0,0,0,10" />
<ComboBox Style="{StaticResource MainColorComboBox}" />
</StackPanel>
<StackPanel Grid.Column="2" Grid.Row="1" >
<TextBlock Text="Import into..." Style="{StaticResource BodyTextBlockStyle}" Margin="0,0,0,10" />
<RadioButton GroupName="ImportDestination" Content="New database" />
<RadioButton GroupName="ImportDestination" Content="Currently opened database" />
</StackPanel>
<Button Grid.Column="3" Grid.Row="1" Content="Import" Style="{StaticResource MainColorButton}" />
</Grid>
</Page>

View File

@@ -0,0 +1,35 @@
using System;
using Windows.Storage.Pickers;
using Windows.UI.Xaml;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace ModernKeePass.Views
{
/// <summary>
/// The import/export page.
/// </summary>
public sealed partial class ImportExportPage
{
public ImportExportPage()
{
InitializeComponent();
}
private async void ImportFileButton_OnClick(object sender, RoutedEventArgs e)
{
var picker =
new FileOpenPicker
{
ViewMode = PickerViewMode.List,
SuggestedStartLocation = PickerLocationId.DocumentsLibrary
};
picker.FileTypeFilter.Add(".csv");
// Application now has read/write access to the picked file
var file = await picker.PickSingleFileAsync();
if (file == null) return;
}
}
}

View File

@@ -18,7 +18,7 @@
</UserControl.Resources> </UserControl.Resources>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<StackPanel Orientation="Horizontal" Visibility="{Binding OverflowButtonsVisibility, ElementName=UserControl}"> <StackPanel Orientation="Horizontal" Visibility="{Binding OverflowButtonsVisibility, ElementName=UserControl}">
<Button Command="{Binding RestoreCommand, ElementName=UserControl}" Visibility="{Binding RestoreButtonVisibility, ElementName=UserControl}" IsEnabled="{Binding IsRestoreButtonEnabled,ElementName=UserControl}" Click="RestoreButton_Click" Style="{StaticResource MenuButtonStyle}"> <Button Command="{Binding RestoreCommand, ElementName=UserControl}" Visibility="{Binding RestoreButtonVisibility, ElementName=UserControl}" Click="RestoreButton_Click" Style="{StaticResource MenuButtonStyle}">
<SymbolIcon Symbol="Undo"> <SymbolIcon Symbol="Undo">
<ToolTipService.ToolTip> <ToolTipService.ToolTip>
<ToolTip x:Uid="TopMenuRestoreButton" /> <ToolTip x:Uid="TopMenuRestoreButton" />
@@ -64,7 +64,7 @@
<SymbolIcon Symbol="More" /> <SymbolIcon Symbol="More" />
<Button.Flyout> <Button.Flyout>
<MenuFlyout Opening="OverflowFlyout_OnOpening"> <MenuFlyout Opening="OverflowFlyout_OnOpening">
<MenuFlyoutItem x:Uid="TopMenuRestoreFlyout" x:Name="RestoreFlyout" Command="{Binding RestoreCommand, ElementName=UserControl}" IsEnabled="{Binding IsRestoreButtonEnabled,ElementName=UserControl}" Click="RestoreButton_Click" Visibility="{Binding RestoreButtonVisibility, ElementName=UserControl}" /> <MenuFlyoutItem x:Uid="TopMenuRestoreFlyout" x:Name="RestoreFlyout" Command="{Binding RestoreCommand, ElementName=UserControl}" Click="RestoreButton_Click" Visibility="{Binding RestoreButtonVisibility, ElementName=UserControl}" />
<MenuFlyoutItem x:Uid="TopMenuSaveFlyout" Command="{Binding SaveCommand, ElementName=UserControl}" /> <MenuFlyoutItem x:Uid="TopMenuSaveFlyout" Command="{Binding SaveCommand, ElementName=UserControl}" />
<ToggleMenuFlyoutItem x:Uid="TopMenuEditFlyout" x:Name="EditFlyout" Command="{Binding EditCommand, ElementName=UserControl}" IsChecked="{Binding IsEditButtonChecked, ElementName=UserControl, Mode=TwoWay}" Click="EditButton_Click" /> <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}" Click="DeleteButton_Click" Visibility="{Binding DeleteButtonVisibility, ElementName=UserControl}" IsEnabled="{Binding IsDeleteButtonEnabled, ElementName=UserControl}" /> <MenuFlyoutItem x:Uid="TopMenuDeleteFlyout" x:Name="DeleteFlyout" Command="{Binding DeleteCommand, ElementName=UserControl}" Click="DeleteButton_Click" Visibility="{Binding DeleteButtonVisibility, ElementName=UserControl}" IsEnabled="{Binding IsDeleteButtonEnabled, ElementName=UserControl}" />

View File

@@ -1,6 +1,6 @@
using System; using System;
using System.Windows.Input;
using Windows.UI.Xaml; using Windows.UI.Xaml;
using ModernKeePass.Common;
// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236 // The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236
@@ -8,75 +8,75 @@ namespace ModernKeePass.Views.UserControls
{ {
public sealed partial class TopMenuUserControl public sealed partial class TopMenuUserControl
{ {
public ICommand SaveCommand public RelayCommand SaveCommand
{ {
get { return (ICommand)GetValue(SaveCommandProperty); } get { return (RelayCommand)GetValue(SaveCommandProperty); }
set { SetValue(SaveCommandProperty, value); } set { SetValue(SaveCommandProperty, value); }
} }
public static readonly DependencyProperty SaveCommandProperty = public static readonly DependencyProperty SaveCommandProperty =
DependencyProperty.Register( DependencyProperty.Register(
"SaveCommand", "SaveCommand",
typeof(ICommand), typeof(RelayCommand),
typeof(TopMenuUserControl), typeof(TopMenuUserControl),
new PropertyMetadata(null, (o, args) => { })); new PropertyMetadata(null, (o, args) => { }));
public ICommand EditCommand public RelayCommand EditCommand
{ {
get { return (ICommand)GetValue(EditCommandProperty); } get { return (RelayCommand)GetValue(EditCommandProperty); }
set { SetValue(EditCommandProperty, value); } set { SetValue(EditCommandProperty, value); }
} }
public static readonly DependencyProperty EditCommandProperty = public static readonly DependencyProperty EditCommandProperty =
DependencyProperty.Register( DependencyProperty.Register(
"EditCommand", "EditCommand",
typeof(ICommand), typeof(RelayCommand),
typeof(TopMenuUserControl), typeof(TopMenuUserControl),
new PropertyMetadata(null, (o, args) => { })); new PropertyMetadata(null, (o, args) => { }));
public ICommand DeleteCommand public RelayCommand DeleteCommand
{ {
get { return (ICommand)GetValue(DeleteCommandProperty); } get { return (RelayCommand)GetValue(DeleteCommandProperty); }
set { SetValue(DeleteCommandProperty, value); } set { SetValue(DeleteCommandProperty, value); }
} }
public static readonly DependencyProperty DeleteCommandProperty = public static readonly DependencyProperty DeleteCommandProperty =
DependencyProperty.Register( DependencyProperty.Register(
"DeleteCommand", "DeleteCommand",
typeof(ICommand), typeof(RelayCommand),
typeof(TopMenuUserControl), typeof(TopMenuUserControl),
new PropertyMetadata(null, (o, args) => { })); new PropertyMetadata(null, (o, args) => { }));
public ICommand RestoreCommand public RelayCommand RestoreCommand
{ {
get { return (ICommand)GetValue(RestoreCommandProperty); } get { return (RelayCommand)GetValue(RestoreCommandProperty); }
set { SetValue(RestoreCommandProperty, value); } set { SetValue(RestoreCommandProperty, value); }
} }
public static readonly DependencyProperty RestoreCommandProperty = public static readonly DependencyProperty RestoreCommandProperty =
DependencyProperty.Register( DependencyProperty.Register(
"RestoreCommand", "RestoreCommand",
typeof(ICommand), typeof(RelayCommand),
typeof(TopMenuUserControl), typeof(TopMenuUserControl),
new PropertyMetadata(null, (o, args) => { })); new PropertyMetadata(null, (o, args) => { }));
public ICommand SortEntriesCommand public RelayCommand SortEntriesCommand
{ {
get { return (ICommand)GetValue(SortEntriesCommandProperty); } get { return (RelayCommand)GetValue(SortEntriesCommandProperty); }
set { SetValue(SortEntriesCommandProperty, value); } set { SetValue(SortEntriesCommandProperty, value); }
} }
public static readonly DependencyProperty SortEntriesCommandProperty = public static readonly DependencyProperty SortEntriesCommandProperty =
DependencyProperty.Register( DependencyProperty.Register(
"SortEntriesCommand", "SortEntriesCommand",
typeof(ICommand), typeof(RelayCommand),
typeof(TopMenuUserControl), typeof(TopMenuUserControl),
new PropertyMetadata(null, (o, args) => { })); new PropertyMetadata(null, (o, args) => { }));
public ICommand SortGroupsCommand public RelayCommand SortGroupsCommand
{ {
get { return (ICommand)GetValue(SortGroupsCommandProperty); } get { return (RelayCommand)GetValue(SortGroupsCommandProperty); }
set { SetValue(SortGroupsCommandProperty, value); } set { SetValue(SortGroupsCommandProperty, value); }
} }
public static readonly DependencyProperty SortGroupsCommandProperty = public static readonly DependencyProperty SortGroupsCommandProperty =
DependencyProperty.Register( DependencyProperty.Register(
"SortGroupsCommand", "SortGroupsCommand",
typeof(ICommand), typeof(RelayCommand),
typeof(TopMenuUserControl), typeof(TopMenuUserControl),
new PropertyMetadata(null, (o, args) => { })); new PropertyMetadata(null, (o, args) => { }));
@@ -138,7 +138,7 @@ namespace ModernKeePass.Views.UserControls
"SortButtonVisibility", "SortButtonVisibility",
typeof(Visibility), typeof(Visibility),
typeof(TopMenuUserControl), typeof(TopMenuUserControl),
new PropertyMetadata(Visibility.Collapsed, (o, args) => { })); new PropertyMetadata(Visibility.Visible, (o, args) => { }));
public bool IsDeleteButtonEnabled public bool IsDeleteButtonEnabled
{ {
@@ -163,18 +163,6 @@ namespace ModernKeePass.Views.UserControls
typeof(bool), typeof(bool),
typeof(TopMenuUserControl), typeof(TopMenuUserControl),
new PropertyMetadata(false, (o, args) => { })); new PropertyMetadata(false, (o, args) => { }));
public bool IsRestoreButtonEnabled
{
get { return (bool)GetValue(IsRestoreButtonEnabledProperty); }
set { SetValue(IsRestoreButtonEnabledProperty, value); }
}
public static readonly DependencyProperty IsRestoreButtonEnabledProperty =
DependencyProperty.Register(
"IsRestoreButtonEnabled",
typeof(bool),
typeof(TopMenuUserControl),
new PropertyMetadata(false, (o, args) => { }));
public event EventHandler<RoutedEventArgs> EditButtonClick; public event EventHandler<RoutedEventArgs> EditButtonClick;
public event EventHandler<RoutedEventArgs> DeleteButtonClick; public event EventHandler<RoutedEventArgs> DeleteButtonClick;
@@ -213,8 +201,7 @@ namespace ModernKeePass.Views.UserControls
DeleteFlyout.Visibility = DeleteButtonVisibility; DeleteFlyout.Visibility = DeleteButtonVisibility;
EditFlyout.IsChecked = IsEditButtonChecked; EditFlyout.IsChecked = IsEditButtonChecked;
RestoreFlyout.IsEnabled = IsRestoreButtonEnabled;
RestoreFlyout.Visibility = RestoreButtonVisibility; RestoreFlyout.Visibility = RestoreButtonVisibility;
SortEntriesFlyout.Visibility = SortButtonVisibility; SortEntriesFlyout.Visibility = SortButtonVisibility;