mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
Created Import/Export page (stub)
Changed some dependency properties from Interfaces to implementations Used CanExecute on Commands
This commit is contained in:
@@ -529,7 +529,6 @@
|
||||
RestoreButtonVisibility="{Binding ParentGroup.IsSelected, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
DeleteButtonVisibility="{Binding IsSelected, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
IsEditButtonChecked="{Binding IsEditMode, Mode=TwoWay}"
|
||||
IsRestoreButtonEnabled="{Binding PreviousGroup, Converter={StaticResource NullToBooleanConverter}}"
|
||||
SaveCommand="{Binding SaveCommand}"
|
||||
RestoreCommand="{Binding UndoDeleteCommand}">
|
||||
<interactivity:Interaction.Behaviors>
|
||||
@@ -540,7 +539,8 @@
|
||||
<actions:DeleteEntityAction Entity="{Binding}" Command="{Binding NavigationHelper.GoBackCommand, ElementName=PageRoot}" />
|
||||
</core:EventTriggerBehavior>
|
||||
<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>
|
||||
</interactivity:Interaction.Behaviors>
|
||||
</userControls:TopMenuUserControl>
|
||||
|
@@ -239,7 +239,6 @@
|
||||
SortButtonVisibility="{Binding IsEditMode, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
IsEditButtonChecked="{Binding IsEditMode, Mode=TwoWay}"
|
||||
IsDeleteButtonEnabled="{Binding IsNotRoot}"
|
||||
IsRestoreButtonEnabled="{Binding PreviousGroup, Converter={StaticResource NullToBooleanConverter}}"
|
||||
SaveCommand="{Binding SaveCommand}"
|
||||
RestoreCommand="{Binding UndoDeleteCommand}"
|
||||
SortEntriesCommand="{Binding SortEntriesCommand}"
|
||||
@@ -252,7 +251,8 @@
|
||||
<actions:DeleteEntityAction Entity="{Binding}" Command="{Binding NavigationHelper.GoBackCommand, ElementName=PageRoot}" />
|
||||
</core:EventTriggerBehavior>
|
||||
<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>
|
||||
</interactivity:Interaction.Behaviors>
|
||||
</userControls:TopMenuUserControl>
|
||||
|
35
ModernKeePass/Views/MainPageFrames/ImportExportPage.xaml
Normal file
35
ModernKeePass/Views/MainPageFrames/ImportExportPage.xaml
Normal 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>
|
35
ModernKeePass/Views/MainPageFrames/ImportExportPage.xaml.cs
Normal file
35
ModernKeePass/Views/MainPageFrames/ImportExportPage.xaml.cs
Normal 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;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@@ -18,7 +18,7 @@
|
||||
</UserControl.Resources>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<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">
|
||||
<ToolTipService.ToolTip>
|
||||
<ToolTip x:Uid="TopMenuRestoreButton" />
|
||||
@@ -64,7 +64,7 @@
|
||||
<SymbolIcon Symbol="More" />
|
||||
<Button.Flyout>
|
||||
<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}" />
|
||||
<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}" />
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
using Windows.UI.Xaml;
|
||||
using ModernKeePass.Common;
|
||||
|
||||
// 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 ICommand SaveCommand
|
||||
public RelayCommand SaveCommand
|
||||
{
|
||||
get { return (ICommand)GetValue(SaveCommandProperty); }
|
||||
get { return (RelayCommand)GetValue(SaveCommandProperty); }
|
||||
set { SetValue(SaveCommandProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty SaveCommandProperty =
|
||||
DependencyProperty.Register(
|
||||
"SaveCommand",
|
||||
typeof(ICommand),
|
||||
typeof(RelayCommand),
|
||||
typeof(TopMenuUserControl),
|
||||
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); }
|
||||
}
|
||||
public static readonly DependencyProperty EditCommandProperty =
|
||||
DependencyProperty.Register(
|
||||
"EditCommand",
|
||||
typeof(ICommand),
|
||||
typeof(RelayCommand),
|
||||
typeof(TopMenuUserControl),
|
||||
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); }
|
||||
}
|
||||
public static readonly DependencyProperty DeleteCommandProperty =
|
||||
DependencyProperty.Register(
|
||||
"DeleteCommand",
|
||||
typeof(ICommand),
|
||||
typeof(RelayCommand),
|
||||
typeof(TopMenuUserControl),
|
||||
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); }
|
||||
}
|
||||
public static readonly DependencyProperty RestoreCommandProperty =
|
||||
DependencyProperty.Register(
|
||||
"RestoreCommand",
|
||||
typeof(ICommand),
|
||||
typeof(RelayCommand),
|
||||
typeof(TopMenuUserControl),
|
||||
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); }
|
||||
}
|
||||
public static readonly DependencyProperty SortEntriesCommandProperty =
|
||||
DependencyProperty.Register(
|
||||
"SortEntriesCommand",
|
||||
typeof(ICommand),
|
||||
typeof(RelayCommand),
|
||||
typeof(TopMenuUserControl),
|
||||
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); }
|
||||
}
|
||||
public static readonly DependencyProperty SortGroupsCommandProperty =
|
||||
DependencyProperty.Register(
|
||||
"SortGroupsCommand",
|
||||
typeof(ICommand),
|
||||
typeof(RelayCommand),
|
||||
typeof(TopMenuUserControl),
|
||||
new PropertyMetadata(null, (o, args) => { }));
|
||||
|
||||
@@ -138,7 +138,7 @@ namespace ModernKeePass.Views.UserControls
|
||||
"SortButtonVisibility",
|
||||
typeof(Visibility),
|
||||
typeof(TopMenuUserControl),
|
||||
new PropertyMetadata(Visibility.Collapsed, (o, args) => { }));
|
||||
new PropertyMetadata(Visibility.Visible, (o, args) => { }));
|
||||
|
||||
public bool IsDeleteButtonEnabled
|
||||
{
|
||||
@@ -163,18 +163,6 @@ namespace ModernKeePass.Views.UserControls
|
||||
typeof(bool),
|
||||
typeof(TopMenuUserControl),
|
||||
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> DeleteButtonClick;
|
||||
@@ -213,8 +201,7 @@ namespace ModernKeePass.Views.UserControls
|
||||
DeleteFlyout.Visibility = DeleteButtonVisibility;
|
||||
|
||||
EditFlyout.IsChecked = IsEditButtonChecked;
|
||||
|
||||
RestoreFlyout.IsEnabled = IsRestoreButtonEnabled;
|
||||
|
||||
RestoreFlyout.Visibility = RestoreButtonVisibility;
|
||||
|
||||
SortEntriesFlyout.Visibility = SortButtonVisibility;
|
||||
|
Reference in New Issue
Block a user