mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40: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:
39
Win10App/Views/MainPageFrames/AboutPage.xaml
Normal file
39
Win10App/Views/MainPageFrames/AboutPage.xaml
Normal file
@@ -0,0 +1,39 @@
|
||||
<Page
|
||||
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"
|
||||
xmlns:viewModels="using:ModernKeePass.ViewModels"
|
||||
x:Class="ModernKeePass.Views.AboutPage"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Page.DataContext>
|
||||
<viewModels:AboutViewModel/>
|
||||
</Page.DataContext>
|
||||
|
||||
<StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Margin="10,0,0,0">
|
||||
<Run Text="{Binding Name}"/>
|
||||
<Run Text="version"/>
|
||||
<Run Text="{Binding Version}" />
|
||||
</TextBlock>
|
||||
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Margin="30,0,0,0">
|
||||
<Run x:Uid="AboutDesc" />
|
||||
</TextBlock>
|
||||
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Margin="30,0,0,0">
|
||||
<Run x:Uid="AboutHomepage" />
|
||||
<Hyperlink NavigateUri="https://wismna.github.io/ModernKeePass/" Foreground="{StaticResource MainColor}">
|
||||
<Run Text="https://wismna.github.io/ModernKeePass/"/>
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Margin="10,0,0,0">
|
||||
<Run x:Uid="AboutCreditsLabel" />
|
||||
</TextBlock>
|
||||
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Margin="30,0,0,0">
|
||||
<Run x:Uid="AboutCredits1" />
|
||||
</TextBlock>
|
||||
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Margin="30,0,0,0">
|
||||
<Run x:Uid="AboutCredits2" />
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</Page>
|
15
Win10App/Views/MainPageFrames/AboutPage.xaml.cs
Normal file
15
Win10App/Views/MainPageFrames/AboutPage.xaml.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
namespace ModernKeePass.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class AboutPage
|
||||
{
|
||||
public AboutPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
20
Win10App/Views/MainPageFrames/DonatePage.xaml
Normal file
20
Win10App/Views/MainPageFrames/DonatePage.xaml
Normal file
@@ -0,0 +1,20 @@
|
||||
<Page
|
||||
x:Class="ModernKeePass.Views.DonatePage"
|
||||
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"
|
||||
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
|
||||
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<ProgressRing x:Name="LoadingRing" IsActive="True" Width="50" Height="50" Foreground="{StaticResource MainColor}" />
|
||||
<WebView Source="https://PayPal.Me/wismna">
|
||||
<interactivity:Interaction.Behaviors>
|
||||
<core:EventTriggerBehavior EventName="DOMContentLoaded">
|
||||
<core:ChangePropertyAction TargetObject="{Binding ElementName=LoadingRing}" PropertyName="IsActive" Value="False" />
|
||||
</core:EventTriggerBehavior>
|
||||
</interactivity:Interaction.Behaviors>
|
||||
</WebView>
|
||||
</Grid>
|
||||
</Page>
|
15
Win10App/Views/MainPageFrames/DonatePage.xaml.cs
Normal file
15
Win10App/Views/MainPageFrames/DonatePage.xaml.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
namespace ModernKeePass.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class DonatePage
|
||||
{
|
||||
public DonatePage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
37
Win10App/Views/MainPageFrames/ImportExportPage.xaml
Normal file
37
Win10App/Views/MainPageFrames/ImportExportPage.xaml
Normal file
@@ -0,0 +1,37 @@
|
||||
<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}">
|
||||
<ComboBoxItem>CSV</ComboBoxItem>
|
||||
</ComboBox>
|
||||
</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
Win10App/Views/MainPageFrames/ImportExportPage.xaml.cs
Normal file
35
Win10App/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;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
47
Win10App/Views/MainPageFrames/NewDatabasePage.xaml
Normal file
47
Win10App/Views/MainPageFrames/NewDatabasePage.xaml
Normal file
@@ -0,0 +1,47 @@
|
||||
<Page
|
||||
x:Class="ModernKeePass.Views.NewDatabasePage"
|
||||
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"
|
||||
xmlns:userControls="using:ModernKeePass.Views.UserControls"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<HyperlinkButton x:Uid="NewCreateButton" Click="CreateDatabaseButton_OnClick" Foreground="{StaticResource MainColor}" Style="{StaticResource MainColorHyperlinkButton}" />
|
||||
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Margin="15,0,0,30" x:Uid="NewCreateDesc" />
|
||||
<Border HorizontalAlignment="Left" BorderThickness="1" BorderBrush="AliceBlue" Width="550" Visibility="{x:Bind ViewModel.IsFileSelected, Mode=OneWay}">
|
||||
<StackPanel Margin="25,0,25,0">
|
||||
<TextBlock Text="{x:Bind ViewModel.Name}" />
|
||||
<userControls:UpdateCredentialsUserControl x:Uid="CompositeKeyNewButton" DatabaseFilePath="{x:Bind ViewModel.DatabaseFilePath, Mode=OneWay}" CredentialsUpdated="CompositeKeyUserControl_OnValidationChecked" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<CheckBox x:Name="CheckBox" x:Uid="NewImportCheckbox" Margin="15,10,0,0" IsChecked="{x:Bind ViewModel.IsImportChecked, Mode=TwoWay}" Visibility="{x:Bind ViewModel.IsFileSelected}" />
|
||||
<Border HorizontalAlignment="Left" BorderThickness="1" BorderBrush="AliceBlue" Width="550" Visibility="{Binding IsChecked, ElementName=CheckBox}">
|
||||
<StackPanel Margin="25,0,25,0">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock x:Uid="NewImportFormat" Margin="0,15,0,10" Style="{StaticResource BodyTextBlockStyle}" />
|
||||
<ComboBox Style="{StaticResource MainColorComboBox}" Margin="15,15,0,0" SelectionChanged="ImportFormatComboBox_OnSelectionChanged">
|
||||
<ComboBoxItem>CSV</ComboBoxItem>
|
||||
</ComboBox>
|
||||
<Button Margin="5,10,0,0" Style="{StaticResource TextBlockButtonStyle}">
|
||||
<SymbolIcon Symbol="Help" RenderTransformOrigin="0.5,0.5" >
|
||||
<SymbolIcon.RenderTransform>
|
||||
<CompositeTransform ScaleX="0.7" ScaleY="0.7"/>
|
||||
</SymbolIcon.RenderTransform>
|
||||
</SymbolIcon>
|
||||
<Button.Flyout>
|
||||
<Flyout>
|
||||
<TextBlock Text="{x:Bind ViewModel.ImportFormatHelp}" TextWrapping="WrapWholeWords" MaxWidth="400" />
|
||||
</Flyout>
|
||||
</Button.Flyout>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<HyperlinkButton x:Name="ImportFileLink" x:Uid="NewImportFile" Margin="-15,0,0,0" Style="{StaticResource MainColorHyperlinkButton}" Click="ImportFileButton_OnClick" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</Page>
|
||||
|
||||
|
||||
|
101
Win10App/Views/MainPageFrames/NewDatabasePage.xaml.cs
Normal file
101
Win10App/Views/MainPageFrames/NewDatabasePage.xaml.cs
Normal file
@@ -0,0 +1,101 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Windows.Storage.AccessCache;
|
||||
using Windows.Storage.Pickers;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
using Autofac;
|
||||
using ModernKeePass.Domain.Dtos;
|
||||
using ModernKeePass.Domain.Enums;
|
||||
using ModernKeePass.Domain.Interfaces;
|
||||
using ModernKeePass.Events;
|
||||
using ModernKeePass.ViewModels;
|
||||
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
namespace ModernKeePass.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class NewDatabasePage
|
||||
{
|
||||
private Frame _mainFrame;
|
||||
private readonly IResourceService _resourceService;
|
||||
|
||||
public NewViewModel ViewModel { get; }
|
||||
|
||||
public NewDatabasePage(): this(App.Container.Resolve<IResourceService>())
|
||||
{ }
|
||||
|
||||
public NewDatabasePage(IResourceService resourceService)
|
||||
{
|
||||
InitializeComponent();
|
||||
ViewModel = new NewViewModel();
|
||||
_resourceService = resourceService;
|
||||
}
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
_mainFrame = e.Parameter as Frame;
|
||||
}
|
||||
|
||||
private async void CreateDatabaseButton_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var savePicker = new FileSavePicker
|
||||
{
|
||||
SuggestedStartLocation = PickerLocationId.DocumentsLibrary,
|
||||
SuggestedFileName = "New Database"
|
||||
};
|
||||
savePicker.FileTypeChoices.Add("KeePass 2.x database", new List<string> { ".kdbx" });
|
||||
|
||||
var file = await savePicker.PickSaveFileAsync();
|
||||
if (file == null) return;
|
||||
|
||||
var token = StorageApplicationPermissions.FutureAccessList.Add(file);
|
||||
var fileInfo = new FileInfo
|
||||
{
|
||||
Path = token,
|
||||
Name = file.DisplayName
|
||||
};
|
||||
await ViewModel.OpenFile(fileInfo);
|
||||
}
|
||||
|
||||
private void ImportFormatComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
var comboBox = sender as ComboBox;
|
||||
switch (comboBox?.SelectedIndex)
|
||||
{
|
||||
case 0:
|
||||
ViewModel.ImportFormat = ImportFormat.CSV;
|
||||
ViewModel.ImportFileExtensionFilter = ".csv";
|
||||
ViewModel.ImportFormatHelp = _resourceService.GetResourceValue("NewImportFormatHelpCSV");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private async void ImportFileButton_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var picker =
|
||||
new FileOpenPicker
|
||||
{
|
||||
ViewMode = PickerViewMode.List,
|
||||
SuggestedStartLocation = PickerLocationId.DocumentsLibrary
|
||||
};
|
||||
if (!string.IsNullOrEmpty(ViewModel.ImportFileExtensionFilter))
|
||||
picker.FileTypeFilter.Add(ViewModel.ImportFileExtensionFilter);
|
||||
|
||||
// Application now has read/write access to the picked file
|
||||
ViewModel.ImportFile = await picker.PickSingleFileAsync();
|
||||
if (ViewModel.ImportFile != null) ImportFileLink.Content = ViewModel.ImportFile.Name;
|
||||
}
|
||||
|
||||
private void CompositeKeyUserControl_OnValidationChecked(object sender, EventArgs e)
|
||||
{
|
||||
ViewModel.PopulateInitialData();
|
||||
_mainFrame.Navigate(typeof(GroupsPage));
|
||||
}
|
||||
}
|
||||
}
|
30
Win10App/Views/MainPageFrames/OpenDatabasePage.xaml
Normal file
30
Win10App/Views/MainPageFrames/OpenDatabasePage.xaml
Normal file
@@ -0,0 +1,30 @@
|
||||
<Page
|
||||
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"
|
||||
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
|
||||
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
|
||||
xmlns:userControls="using:ModernKeePass.Views.UserControls"
|
||||
x:Class="ModernKeePass.Views.OpenDatabasePage"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<HyperlinkButton x:Uid="OpenBrowseButton" Click="ButtonBase_OnClick" Foreground="{StaticResource MainColor}" Style="{StaticResource MainColorHyperlinkButton}" />
|
||||
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Margin="15,0,0,30" x:Uid="OpenBrowseDesc" />
|
||||
<!--<HyperlinkButton x:Uid="OpenUrlButton" IsEnabled="False" Foreground="{StaticResource MainColor}" Style="{StaticResource MainColorHyperlinkButton}" />
|
||||
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Margin="15,0,0,30" x:Uid="OpenUrlDesc" />-->
|
||||
<Border HorizontalAlignment="Left" BorderThickness="1" BorderBrush="AliceBlue" Width="550" Visibility="{x:Bind ViewModel.IsFileSelected, Mode=OneWay}">
|
||||
<StackPanel Margin="25,0,25,0">
|
||||
<TextBlock Text="{x:Bind ViewModel.Name, Mode=OneWay}" />
|
||||
<userControls:CredentialsUserControl x:Uid="CompositeKeyOpenButton" DatabaseFilePath="{x:Bind ViewModel.DatabaseFilePath, Mode=OneWay}">
|
||||
<interactivity:Interaction.Behaviors>
|
||||
<core:EventTriggerBehavior EventName="ValidationChecked">
|
||||
<core:NavigateToPageAction TargetPage="ModernKeePass.Views.GroupsPage" />
|
||||
</core:EventTriggerBehavior>
|
||||
</interactivity:Interaction.Behaviors>
|
||||
</userControls:CredentialsUserControl>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</Page>
|
58
Win10App/Views/MainPageFrames/OpenDatabasePage.xaml.cs
Normal file
58
Win10App/Views/MainPageFrames/OpenDatabasePage.xaml.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using Windows.Storage.Pickers;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
using ModernKeePass.ViewModels;
|
||||
using Windows.Storage.AccessCache;
|
||||
using ModernKeePass.Domain.Dtos;
|
||||
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
namespace ModernKeePass.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class OpenDatabasePage
|
||||
{
|
||||
public OpenViewModel ViewModel { get; }
|
||||
|
||||
public OpenDatabasePage()
|
||||
{
|
||||
InitializeComponent();
|
||||
ViewModel = new OpenViewModel();
|
||||
}
|
||||
|
||||
protected override async void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
if (e.Parameter is FileInfo fileInfo)
|
||||
{
|
||||
await ViewModel.OpenFile(fileInfo);
|
||||
}
|
||||
}
|
||||
|
||||
private async void ButtonBase_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var picker =
|
||||
new FileOpenPicker
|
||||
{
|
||||
ViewMode = PickerViewMode.List,
|
||||
SuggestedStartLocation = PickerLocationId.DocumentsLibrary
|
||||
};
|
||||
picker.FileTypeFilter.Add(".kdbx");
|
||||
|
||||
// Application now has read/write access to the picked file
|
||||
var file = await picker.PickSingleFileAsync();
|
||||
if (file == null) return;
|
||||
|
||||
var token = StorageApplicationPermissions.FutureAccessList.Add(file);
|
||||
var fileInfo = new FileInfo
|
||||
{
|
||||
Path = token,
|
||||
Name = file.DisplayName
|
||||
};
|
||||
await ViewModel.OpenFile(fileInfo);
|
||||
}
|
||||
}
|
||||
}
|
70
Win10App/Views/MainPageFrames/RecentDatabasesPage.xaml
Normal file
70
Win10App/Views/MainPageFrames/RecentDatabasesPage.xaml
Normal file
@@ -0,0 +1,70 @@
|
||||
<Page
|
||||
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"
|
||||
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
|
||||
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
|
||||
xmlns:userControls="using:ModernKeePass.Views.UserControls"
|
||||
xmlns:listItems="using:ModernKeePass.ViewModels.ListItems"
|
||||
x:Class="ModernKeePass.Views.RecentDatabasesPage"
|
||||
mc:Ignorable="d">
|
||||
<Page.Resources>
|
||||
<CollectionViewSource x:Name="RecentItemsSource" Source="{x:Bind ViewModel.RecentItems}" />
|
||||
</Page.Resources>
|
||||
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<HyperlinkButton Grid.Row="0"
|
||||
HorizontalAlignment="Right"
|
||||
Style="{StaticResource MainColorHyperlinkButton}"
|
||||
Foreground="{StaticResource MainColor}"
|
||||
Command="{x:Bind ViewModel.ClearAllCommand}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<SymbolIcon Symbol="Cancel" />
|
||||
<TextBlock x:Uid="RecentClear" VerticalAlignment="Center" Margin="10,0,0,0" />
|
||||
</StackPanel>
|
||||
</HyperlinkButton>
|
||||
<ListView Grid.Row="1"
|
||||
ItemsSource="{Binding Source={StaticResource RecentItemsSource}}"
|
||||
SelectedItem="{x:Bind ViewModel.SelectedItem, Mode=TwoWay}"
|
||||
ItemContainerStyle="{StaticResource ListViewLeftIndicatorItemExpanded}">
|
||||
<ListView.DataContext>
|
||||
<listItems:RecentItemViewModel />
|
||||
</ListView.DataContext>
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate x:DataType="listItems:RecentItemViewModel">
|
||||
<Grid Margin="10,0,10,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="{x:Bind Name}" Padding="5,0,0,0" />
|
||||
<!--<TextBlock Grid.Row="1" Text="{Binding Path}" Padding="5,0,0,0" FontSize="10" />-->
|
||||
<userControls:CredentialsUserControl Grid.Row="2"
|
||||
x:Name="DatabaseUserControl"
|
||||
x:Uid="CompositeKeyOpenButton"
|
||||
HorizontalAlignment="Stretch"
|
||||
MinWidth="400"
|
||||
Margin="0,10,0,0"
|
||||
Visibility="{x:Bind IsSelected}"
|
||||
DatabaseFilePath="{x:Bind Token}">
|
||||
<interactivity:Interaction.Behaviors>
|
||||
<core:EventTriggerBehavior EventName="ValidationChecked">
|
||||
<!--<core:CallMethodAction TargetObject="{Binding}" MethodName="UpdateAccessTime" />-->
|
||||
<core:NavigateToPageAction TargetPage="ModernKeePass.Views.GroupsPage" />
|
||||
</core:EventTriggerBehavior>
|
||||
</interactivity:Interaction.Behaviors>
|
||||
</userControls:CredentialsUserControl>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
</Grid>
|
||||
</Page>
|
20
Win10App/Views/MainPageFrames/RecentDatabasesPage.xaml.cs
Normal file
20
Win10App/Views/MainPageFrames/RecentDatabasesPage.xaml.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
// Pour en savoir plus sur le modèle d'élément Page vierge, consultez la page http://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
using ModernKeePass.ViewModels;
|
||||
|
||||
namespace ModernKeePass.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Une page vide peut être utilisée seule ou constituer une page de destination au sein d'un frame.
|
||||
/// </summary>
|
||||
public sealed partial class RecentDatabasesPage
|
||||
{
|
||||
private RecentViewModel ViewModel { get; }
|
||||
|
||||
public RecentDatabasesPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
ViewModel = new RecentViewModel();
|
||||
}
|
||||
}
|
||||
}
|
15
Win10App/Views/MainPageFrames/SaveDatabasePage.xaml
Normal file
15
Win10App/Views/MainPageFrames/SaveDatabasePage.xaml
Normal file
@@ -0,0 +1,15 @@
|
||||
<Page
|
||||
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"
|
||||
x:Class="ModernKeePass.Views.SaveDatabasePage"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<HyperlinkButton x:Uid="SaveButton" Click="SaveButton_OnClick" Foreground="{StaticResource MainColor}" Style="{StaticResource MainColorHyperlinkButton}" />
|
||||
<TextBlock x:Uid="SaveDesc" Style="{StaticResource BodyTextBlockStyle}" Margin="15,0,0,30" />
|
||||
<HyperlinkButton x:Uid="SaveAsButton" Click="SaveAsButton_OnClick" Foreground="{StaticResource MainColor}" Style="{StaticResource MainColorHyperlinkButton}" />
|
||||
<TextBlock x:Uid="SaveAsDesc" Style="{StaticResource BodyTextBlockStyle}" Margin="15,0,0,30" />
|
||||
</StackPanel>
|
||||
</Page>
|
57
Win10App/Views/MainPageFrames/SaveDatabasePage.xaml.cs
Normal file
57
Win10App/Views/MainPageFrames/SaveDatabasePage.xaml.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Windows.Storage.AccessCache;
|
||||
using Windows.Storage.Pickers;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
using ModernKeePass.ViewModels;
|
||||
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
namespace ModernKeePass.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class SaveDatabasePage
|
||||
{
|
||||
private Frame _mainFrame;
|
||||
public SaveViewModel ViewModel { get; }
|
||||
public SaveDatabasePage()
|
||||
{
|
||||
InitializeComponent();
|
||||
ViewModel = new SaveViewModel();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
_mainFrame = e.Parameter as Frame;
|
||||
}
|
||||
|
||||
private void SaveButton_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ViewModel.Save();
|
||||
_mainFrame.Navigate(typeof(MainPage10));
|
||||
}
|
||||
|
||||
private async void SaveAsButton_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var savePicker = new FileSavePicker
|
||||
{
|
||||
SuggestedStartLocation = PickerLocationId.DocumentsLibrary,
|
||||
SuggestedFileName = "New Database"
|
||||
};
|
||||
savePicker.FileTypeChoices.Add("KeePass 2.x database", new List<string> { ".kdbx" });
|
||||
|
||||
var file = await savePicker.PickSaveFileAsync();
|
||||
if (file == null) return;
|
||||
|
||||
var token = StorageApplicationPermissions.FutureAccessList.Add(file);
|
||||
ViewModel.Save(token);
|
||||
|
||||
_mainFrame.Navigate(typeof(MainPage10));
|
||||
}
|
||||
}
|
||||
}
|
19
Win10App/Views/MainPageFrames/WelcomePage.xaml
Normal file
19
Win10App/Views/MainPageFrames/WelcomePage.xaml
Normal file
@@ -0,0 +1,19 @@
|
||||
<Page
|
||||
x:Class="ModernKeePass.Views.WelcomePage"
|
||||
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">
|
||||
|
||||
<StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,10">
|
||||
<SymbolIcon Symbol="Back" Margin="0,7,40,0" />
|
||||
<TextBlock Style="{StaticResource SubtitleTextBlockStyle}" x:Uid="WelcomeOpen" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,6,0,10">
|
||||
<SymbolIcon Symbol="Back" Margin="0,7,40,0" />
|
||||
<TextBlock Style="{StaticResource SubtitleTextBlockStyle}" x:Uid="WelcomeNew" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Page>
|
15
Win10App/Views/MainPageFrames/WelcomePage.xaml.cs
Normal file
15
Win10App/Views/MainPageFrames/WelcomePage.xaml.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
namespace ModernKeePass.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class WelcomePage
|
||||
{
|
||||
public WelcomePage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user