First functionnal read-only version!

Entry page now shows password information
This commit is contained in:
bg45
2017-09-17 10:00:03 -04:00
parent 95b7dda1f6
commit b260de7d39
7 changed files with 193 additions and 6 deletions

Binary file not shown.

View File

@@ -114,6 +114,9 @@
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\EntryDetailPage.xaml.cs">
<DependentUpon>EntryDetailPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\GroupDetailPage.xaml.cs">
<DependentUpon>GroupDetailPage.xaml</DependentUpon>
</Compile>
@@ -144,6 +147,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Pages\EntryDetailPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\GroupDetailPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

View File

@@ -0,0 +1,68 @@
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:ModernKeePass.Pages"
xmlns:common="using:ModernKeePass.Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ViewModels="using:ModernKeePass.ViewModels"
x:Name="pageRoot"
x:Class="ModernKeePass.Pages.EntryDetailPage"
mc:Ignorable="d">
<Page.DataContext>
<ViewModels:EntryVm/>
</Page.DataContext>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.ChildrenTransitions>
<TransitionCollection>
<EntranceThemeTransition/>
</TransitionCollection>
</Grid.ChildrenTransitions>
<Grid.RowDefinitions>
<RowDefinition Height="140"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="1" x:Name="contentRegion">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock x:Name="userTextBlock" Grid.Row="0" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="User name or login" VerticalAlignment="Top" FontSize="18"/>
<TextBox x:Name="userTextBox" Grid.Row="1" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="{Binding UserName, Mode=TwoWay}" VerticalAlignment="Top" Width="250" AllowDrop="True"/>
<TextBlock x:Name="passwordTextBlock" Grid.Row="2" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="Password" VerticalAlignment="Top" FontSize="18"/>
<PasswordBox x:Name="passwordBox" Grid.Row="3" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Password="{Binding Password, Mode=TwoWay}" IsPasswordRevealButtonEnabled="True" Width="250" AllowDrop="True"/>
<TextBox x:Name="passwordTextBox" Grid.Row="3" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="{Binding Password, Mode=TwoWay}" VerticalAlignment="Top" Width="250" FontSize="14,667" MaxLength="256" AllowDrop="True" Visibility="Collapsed"/>
<CheckBox x:Name="checkBox" Grid.Row="4" Content="Show password" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Checked="checkBox_Checked" Unchecked="checkBox_Unchecked"/>
<TextBlock x:Name="urlTextBlock" Grid.Row="5" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="URL" VerticalAlignment="Top" FontSize="18"/>
<TextBox x:Name="urlTextBox" Grid.Row="6" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="{Binding URL, Mode=TwoWay}" VerticalAlignment="Top" Width="250" FontSize="14,667" MaxLength="256" AllowDrop="True"/>
<TextBlock x:Name="notesTextBlock" Grid.Row="7" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="Notes" VerticalAlignment="Top" FontSize="18"/>
<TextBox x:Name="notesTextBox" Grid.Row="8" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="{Binding Notes, Mode=TwoWay}" VerticalAlignment="Top" Width="250" Height="32" IsSpellCheckEnabled="True" AllowDrop="True"/>
</Grid>
<!-- Bouton Précédent et titre de la page -->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button x:Name="backButton" Margin="39,59,39,0" Command="{Binding NavigationHelper.GoBackCommand, ElementName=pageRoot}"
Style="{StaticResource NavigationBackButtonNormalStyle}"
VerticalAlignment="Top"
AutomationProperties.Name="Back"
AutomationProperties.AutomationId="BackButton"
AutomationProperties.ItemType="Navigation Button"/>
<TextBlock x:Name="pageTitle" Text="{Binding Title}" Style="{StaticResource HeaderTextBlockStyle}" Grid.Column="1"
IsHitTestVisible="false" TextWrapping="NoWrap" VerticalAlignment="Bottom" Margin="0,0,30,40"/>
</Grid>
</Grid>
</Page>

View File

@@ -0,0 +1,109 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using ModernKeePass.Common;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using ModernKeePass.ViewModels;
// Pour en savoir plus sur le modèle d'élément Page Détail de l'élément, consultez la page http://go.microsoft.com/fwlink/?LinkId=234232
namespace ModernKeePass.Pages
{
/// <summary>
/// Page affichant les détails d'un élément au sein d'un groupe, offrant la possibilité de
/// consulter les autres éléments qui appartiennent au même groupe.
/// </summary>
public sealed partial class EntryDetailPage : Page
{
private NavigationHelper navigationHelper;
/// <summary>
/// NavigationHelper est utilisé sur chaque page pour faciliter la navigation et
/// gestion de la durée de vie des processus
/// </summary>
public NavigationHelper NavigationHelper
{
get { return this.navigationHelper; }
}
public EntryDetailPage()
{
this.InitializeComponent();
this.navigationHelper = new NavigationHelper(this);
this.navigationHelper.LoadState += navigationHelper_LoadState;
}
/// <summary>
/// Remplit la page à l'aide du contenu passé lors de la navigation. Tout état enregistré est également
/// fourni lorsqu'une page est recréée à partir d'une session antérieure.
/// </summary>
/// <param name="sender">
/// Source de l'événement ; en général <see cref="Common.NavigationHelper"/>
/// </param>
/// <param name="e">Données d'événement qui fournissent le paramètre de navigation transmis à
/// <see cref="Frame.Navigate(Type, Object)"/> lors de la requête initiale de cette page et
/// un dictionnaire d'état conservé par cette page durant une session
/// antérieure. L'état n'aura pas la valeur Null lors de la première visite de la page.</param>
private void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
{
object navigationParameter;
if (e.PageState != null && e.PageState.ContainsKey("SelectedItem"))
{
navigationParameter = e.PageState["SelectedItem"];
}
// TODO: affectez un groupe pouvant être lié à this.DefaultViewModel["Group"]
// TODO: affectez une collection d'éléments pouvant être liés à this.DefaultViewModel["Items"]
// TODO: assignez l'élément sélectionné à .flipView.SelectedItem
}
#region Inscription de NavigationHelper
/// Les méthodes fournies dans cette section sont utilisées simplement pour permettre
/// NavigationHelper pour répondre aux méthodes de navigation de la page.
///
/// La logique spécifique à la page doit être placée dans les gestionnaires d'événements pour
/// <see cref="Common.NavigationHelper.LoadState"/>
/// et <see cref="Common.NavigationHelper.SaveState"/>.
/// Le paramètre de navigation est disponible dans la méthode LoadState
/// en plus de l'état de page conservé durant une session antérieure.
protected override void OnNavigatedTo(NavigationEventArgs e)
{
navigationHelper.OnNavigatedTo(e);
if (e.Parameter is EntryVm)
{
DataContext = e.Parameter as EntryVm;
}
}
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
navigationHelper.OnNavigatedFrom(e);
}
#endregion
private void checkBox_Checked(object sender, RoutedEventArgs e)
{
passwordBox.Visibility = Visibility.Collapsed;
passwordTextBox.Visibility = Visibility.Visible;
}
private void checkBox_Unchecked(object sender, RoutedEventArgs e)
{
passwordBox.Visibility = Visibility.Visible;
passwordTextBox.Visibility = Visibility.Collapsed;
}
}
}

View File

@@ -65,7 +65,7 @@
</GridView.ItemTemplate>
<GridView.Header>
<StackPanel Width="480" Margin="0,4,14,0">
<ListView x:Name="entriesListView" Height="100" ItemsSource="{Binding Source={StaticResource entriesViewSource}}" Margin="10,0,0,0" ItemClick="entriesListView_ItemClick">
<ListView x:Name="entriesListView" Height="100" ItemsSource="{Binding Source={StaticResource entriesViewSource}}" Margin="10,0,0,0" SelectionChanged="entriesListView_SelectionChanged">
<ListView.ItemTemplate>
<DataTemplate>
<Grid>

View File

@@ -14,9 +14,7 @@ namespace ModernKeePass.Pages
public sealed partial class GroupDetailPage : Page
{
private NavigationHelper navigationHelper;
public GroupVm ViewModel { get; set; }
/// <summary>
/// NavigationHelper is used on each page to aid in navigation and
/// process lifetime management
@@ -68,6 +66,7 @@ namespace ModernKeePass.Pages
{
DataContext = e.Parameter as GroupVm;
groupsGridView.SelectedIndex = -1;
entriesListView.SelectedIndex = -1;
}
}
@@ -83,10 +82,12 @@ namespace ModernKeePass.Pages
var gridView = sender as GridView;
Frame.Navigate(typeof(GroupDetailPage), gridView.SelectedItem as GroupVm);
}
private void entriesListView_ItemClick(object sender, ItemClickEventArgs e)
private void entriesListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
var listView = sender as ListView;
Frame.Navigate(typeof(EntryDetailPage), listView.SelectedItem as EntryVm);
}
}
}

View File

@@ -7,6 +7,7 @@ namespace ModernKeePass.ViewModels
{
public string Title { get; private set; }
public string UserName { get; private set; }
public string Password { get; private set; }
public string URL { get; private set; }
public string Notes { get; private set; }
@@ -15,6 +16,7 @@ namespace ModernKeePass.ViewModels
{
Title = entry.Strings.GetSafe(PwDefs.TitleField).ReadString();
UserName = entry.Strings.GetSafe(PwDefs.UserNameField).ReadString();
Password = entry.Strings.GetSafe(PwDefs.PasswordField).ReadString();
URL = entry.Strings.GetSafe(PwDefs.UrlField).ReadString();
Notes = entry.Strings.GetSafe(PwDefs.NotesField).ReadString();
}