mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
Added icons to main menu
Added icons to entries and groups with a mapping Created a Converter to handle pluralization Several UI enhancements
This commit is contained in:
25
ModernKeePass/Converters/PluralizationConverter.cs
Normal file
25
ModernKeePass/Converters/PluralizationConverter.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Windows.UI.Xaml.Data;
|
||||
|
||||
namespace ModernKeePass.Converters
|
||||
{
|
||||
public class PluralizationConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
var pluralizationOptionString = parameter as string;
|
||||
var pluralizationOptions = pluralizationOptionString?.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (pluralizationOptions == null || pluralizationOptions.Length != 2) return string.Empty;
|
||||
var count = value is int ? (int) value : 0;
|
||||
var text = count == 1 ? pluralizationOptions[0] : pluralizationOptions[1];
|
||||
return $"{count} {text}";
|
||||
}
|
||||
|
||||
// No need to implement this
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@@ -26,13 +26,17 @@
|
||||
<controls:ListViewWithDisable Grid.Column="0"
|
||||
x:Name="MenuListView"
|
||||
SelectionChanged="ListView_SelectionChanged"
|
||||
ItemsSource="{Binding Source={StaticResource MenuItemsSource}}">
|
||||
ItemsSource="{Binding Source={StaticResource MenuItemsSource}}"
|
||||
IsSynchronizedWithCurrentItem="False">
|
||||
<ListView.Header>
|
||||
<TextBlock Text="ModernKeePass" FontWeight="Bold" FontSize="36" Margin="20" />
|
||||
</ListView.Header>
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate >
|
||||
<TextBlock Text="{Binding Title}" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<SymbolIcon Symbol="{Binding SymbolIcon}" />
|
||||
<TextBlock Text="{Binding Title}" Margin="10,5,0,0" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
<ListView.ItemContainerStyle>
|
||||
|
@@ -26,26 +26,22 @@ namespace ModernKeePass
|
||||
base.OnNavigatedTo(e);
|
||||
var mainMenuItems = new ObservableCollection<MainMenuItem>
|
||||
{
|
||||
new MainMenuItem {Title = "Open", PageType = typeof(OpenDatabasePage), Destination = MenuFrame, Parameter = Frame},
|
||||
new MainMenuItem {Title = "New" /*, PageType = typeof(NewDatabasePage)*/, Destination = MenuFrame},
|
||||
new MainMenuItem {Title = "Save" , PageType = typeof(SaveDatabasePage), Destination = MenuFrame, Parameter = Frame},
|
||||
new MainMenuItem {Title = "Recent" /*, PageType = typeof(RecentDatabasesPage)*/, Destination = MenuFrame}
|
||||
new MainMenuItem {Title = "Open", PageType = typeof(OpenDatabasePage), Destination = MenuFrame, Parameter = Frame, SymbolIcon = Symbol.Page2},
|
||||
new MainMenuItem {Title = "New" /*, PageType = typeof(NewDatabasePage)*/, Destination = MenuFrame, SymbolIcon = Symbol.Add},
|
||||
new MainMenuItem {Title = "Save" , PageType = typeof(SaveDatabasePage), Destination = MenuFrame, Parameter = Frame, SymbolIcon = Symbol.Save},
|
||||
new MainMenuItem {Title = "Recent" /*, PageType = typeof(RecentDatabasesPage)*/, Destination = MenuFrame, SymbolIcon = Symbol.Copy}
|
||||
};
|
||||
var app = (App)Application.Current;
|
||||
if (app.Database != null && app.Database.IsOpen)
|
||||
mainMenuItems.Add(new MainMenuItem { Title = app.Database.Name, PageType = typeof(GroupDetailPage), Destination = Frame, Parameter = app.Database.RootGroup, Group = 1});
|
||||
mainMenuItems.Add(new MainMenuItem { Title = app.Database.Name, PageType = typeof(GroupDetailPage), Destination = Frame, Parameter = app.Database.RootGroup, Group = 1, SymbolIcon = Symbol.ProtectedDocument});
|
||||
var result = from item in mainMenuItems group item by item.Group into grp orderby grp.Key select grp;
|
||||
MenuItemsSource.Source = result;
|
||||
//DataContext = new MainVm {MainMenuItems = mainMenuItems};
|
||||
|
||||
MenuListView.SelectedIndex = -1;
|
||||
}
|
||||
|
||||
private void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
var listView = sender as ListView;
|
||||
if (listView == null) return;
|
||||
if (listView.SelectedIndex == -1) return;
|
||||
var selectedItem = listView.SelectedItem as MainMenuItem;
|
||||
selectedItem?.Destination.Navigate(selectedItem.PageType, selectedItem.Parameter);
|
||||
}
|
||||
|
82
ModernKeePass/Mappings/PwIconToSegoeMapping.cs
Normal file
82
ModernKeePass/Mappings/PwIconToSegoeMapping.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using ModernKeePassLib;
|
||||
|
||||
namespace ModernKeePass.Mappings
|
||||
{
|
||||
public static class PwIconToSegoeMapping
|
||||
{
|
||||
public static Symbol GetSymbolFromIcon(PwIcon icon)
|
||||
{
|
||||
switch (icon)
|
||||
{
|
||||
case PwIcon.Key: return Symbol.Permissions;
|
||||
case PwIcon.World: return Symbol.World;
|
||||
case PwIcon.Warning: return Symbol.Important;
|
||||
case PwIcon.WorldComputer:
|
||||
case PwIcon.DriveWindows:
|
||||
case PwIcon.NetworkServer: return Symbol.MapDrive;
|
||||
//case PwIcon.MarkedDirectory: return Symbol.;
|
||||
case PwIcon.UserCommunication: return Symbol.ContactInfo;
|
||||
//case PwIcon.Parts: return Symbol.;
|
||||
case PwIcon.Notepad: return Symbol.Document;
|
||||
//case PwIcon.WorldScoket: return Symbol.;
|
||||
case PwIcon.Identity: return Symbol.Contact2;
|
||||
//case PwIcon.PaperReady: return Symbol.;
|
||||
case PwIcon.Digicam: return Symbol.Camera;
|
||||
case PwIcon.IRCommunication: return Symbol.View;
|
||||
case PwIcon.Energy: return Symbol.ZeroBars;
|
||||
case PwIcon.Scanner: return Symbol.Scan;
|
||||
case PwIcon.CDRom: return Symbol.Rotate;
|
||||
case PwIcon.Monitor: return Symbol.Caption;
|
||||
case PwIcon.EMailBox:
|
||||
case PwIcon.EMail: return Symbol.Mail;
|
||||
case PwIcon.Configuration: return Symbol.Setting;
|
||||
case PwIcon.ClipboardReady: return Symbol.Paste;
|
||||
case PwIcon.PaperNew: return Symbol.Page2;
|
||||
//case PwIcon.Screen: return Symbol.Document;
|
||||
case PwIcon.EnergyCareful: return Symbol.FourBars;
|
||||
case PwIcon.Disk: return Symbol.Save;
|
||||
//case PwIcon.Drive: return Symbol.;
|
||||
//case PwIcon.PaperQ: return Symbol.;
|
||||
//case PwIcon.TerminalEncrypted: return Symbol.;
|
||||
//case PwIcon.Console: return Symbol.;
|
||||
//case PwIcon.Printer: return Symbol.;
|
||||
case PwIcon.ProgramIcons: return Symbol.GoToStart;
|
||||
//case PwIcon.Run: return Symbol.;
|
||||
case PwIcon.Settings:
|
||||
case PwIcon.Tool: return Symbol.Repair;
|
||||
//case PwIcon.Archive: return Symbol.;
|
||||
case PwIcon.Count: return Symbol.MapDrive;
|
||||
case PwIcon.Clock: return Symbol.Clock;
|
||||
case PwIcon.EMailSearch: return Symbol.Find;
|
||||
case PwIcon.PaperFlag: return Symbol.Flag;
|
||||
//case PwIcon.Memory: return Symbol.;
|
||||
case PwIcon.TrashBin: return Symbol.Delete;
|
||||
case PwIcon.Expired: return Symbol.Cancel;
|
||||
case PwIcon.Info: return Symbol.Help;
|
||||
//case PwIcon.Package: return Symbol.;
|
||||
case PwIcon.Folder:
|
||||
case PwIcon.FolderOpen:
|
||||
case PwIcon.FolderPackage: return Symbol.Folder;
|
||||
//case PwIcon.LockOpen: return Symbol.;
|
||||
case PwIcon.PaperLocked: return Symbol.ProtectedDocument;
|
||||
case PwIcon.Checked: return Symbol.Accept;
|
||||
case PwIcon.Pen: return Symbol.Edit;
|
||||
case PwIcon.Thumbnail: return Symbol.BrowsePhotos;
|
||||
case PwIcon.Book: return Symbol.Library;
|
||||
case PwIcon.List: return Symbol.List;
|
||||
case PwIcon.UserKey: return Symbol.ContactPresence;
|
||||
case PwIcon.Home: return Symbol.Home;
|
||||
case PwIcon.Star: return Symbol.OutlineStar;
|
||||
//case PwIcon.Tux: return Symbol.;
|
||||
//case PwIcon.Feather: return Symbol.;
|
||||
//case PwIcon.Apple: return Symbol.;
|
||||
//case PwIcon.Wiki: return Symbol.;
|
||||
//case PwIcon.Money: return Symbol.;
|
||||
case PwIcon.Certificate: return Symbol.PreviewLink;
|
||||
case PwIcon.BlackBerry: return Symbol.CellPhone;
|
||||
default: return Symbol.More;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -18,6 +18,7 @@ namespace ModernKeePass.Models
|
||||
public object Parameter { get; set; }
|
||||
public Frame Destination { get; set; }
|
||||
public int Group { get; set; } = 0;
|
||||
public Symbol SymbolIcon { get; set; }
|
||||
public bool IsEnabled => PageType != null;
|
||||
|
||||
public override string ToString()
|
||||
|
@@ -116,10 +116,12 @@
|
||||
<Compile Include="Common\RelayCommand.cs" />
|
||||
<Compile Include="Common\SuspensionManager.cs" />
|
||||
<Compile Include="Controls\ListViewWithDisable.cs" />
|
||||
<Compile Include="Converters\PluralizationConverter.cs" />
|
||||
<Compile Include="Interfaces\IIsEnabled.cs" />
|
||||
<Compile Include="MainPage.xaml.cs">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Mappings\PwIconToSegoeMapping.cs" />
|
||||
<Compile Include="Models\MainMenuItem.cs" />
|
||||
<Compile Include="Pages\EntryDetailPage.xaml.cs">
|
||||
<DependentUpon>EntryDetailPage.xaml</DependentUpon>
|
||||
|
@@ -25,29 +25,23 @@
|
||||
<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>
|
||||
<StackPanel Grid.Row="1" Margin="20,0,0,0" >
|
||||
<StackPanel.Resources>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Margin" Value="0,20,0,0"/>
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
<TextBlock x:Name="userTextBlock" TextWrapping="Wrap" Text="User name or login" FontSize="18"/>
|
||||
<TextBox x:Name="userTextBox" HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Binding UserName, Mode=TwoWay}" Width="350" />
|
||||
<TextBlock x:Name="passwordTextBlock" TextWrapping="Wrap" Text="Password" FontSize="18"/>
|
||||
<PasswordBox x:Name="passwordBox" HorizontalAlignment="Left" Password="{Binding Password, Mode=TwoWay}" Width="350" IsPasswordRevealButtonEnabled="True" />
|
||||
<TextBox x:Name="passwordTextBox" HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Binding Password, Mode=TwoWay}" Width="350" Visibility="Collapsed"/>
|
||||
<CheckBox x:Name="checkBox" HorizontalAlignment="Left" Margin="-3,0,0,0" Content="Show password" Checked="checkBox_Checked" Unchecked="checkBox_Unchecked" />
|
||||
<TextBlock x:Name="urlTextBlock" TextWrapping="Wrap" Text="URL" FontSize="18"/>
|
||||
<TextBox x:Name="urlTextBox" HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Binding Url, Mode=TwoWay}" Width="350" MaxLength="256" />
|
||||
<TextBlock x:Name="notesTextBlock" TextWrapping="Wrap" Text="Notes" FontSize="18"/>
|
||||
<TextBox x:Name="notesTextBox" HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Binding Notes, Mode=TwoWay}" Width="350" Height="200" AcceptsReturn="True" IsSpellCheckEnabled="True" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- Bouton Précédent et titre de la page -->
|
||||
<Grid>
|
||||
|
@@ -6,14 +6,27 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ViewModels="using:ModernKeePass.ViewModels"
|
||||
xmlns:Converters="using:ModernKeePass.Converters"
|
||||
x:Name="pageRoot"
|
||||
x:Class="ModernKeePass.Pages.GroupDetailPage"
|
||||
mc:Ignorable="d" >
|
||||
<Page.Resources>
|
||||
<Converters:PluralizationConverter x:Key="PluralizationConverter"/>
|
||||
</Page.Resources>
|
||||
<Page.DataContext>
|
||||
<ViewModels:GroupVm />
|
||||
</Page.DataContext>
|
||||
|
||||
|
||||
<Grid>
|
||||
|
||||
<Grid.Resources>
|
||||
<CollectionViewSource
|
||||
x:Name="groupsViewSource"
|
||||
Source="{Binding Groups}"/>
|
||||
<CollectionViewSource
|
||||
x:Name="entriesViewSource"
|
||||
Source="{Binding Entries}"/>
|
||||
</Grid.Resources>
|
||||
<Grid.ChildrenTransitions>
|
||||
<TransitionCollection>
|
||||
<EntranceThemeTransition/>
|
||||
@@ -24,14 +37,6 @@
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.Resources>
|
||||
<CollectionViewSource
|
||||
x:Name="groupsViewSource"
|
||||
Source="{Binding Groups}"/>
|
||||
<CollectionViewSource
|
||||
x:Name="entriesViewSource"
|
||||
Source="{Binding Entries}"/>
|
||||
</Grid.Resources>
|
||||
<!-- Horizontal scrolling grid -->
|
||||
<GridView
|
||||
x:Name="groupsGridView"
|
||||
@@ -44,41 +49,49 @@
|
||||
ItemsSource="{Binding Source={StaticResource groupsViewSource}}"
|
||||
IsSwipeEnabled="false"
|
||||
SelectionChanged="groupsGridView_SelectionChanged"
|
||||
SelectedIndex="-1" >
|
||||
IsSynchronizedWithCurrentItem="False" >
|
||||
<GridView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Height="110" Width="480" Margin="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Background="{ThemeResource ListViewItemPlaceholderBackgroundThemeBrush}" Width="110" Height="110">
|
||||
<Image Stretch="UniformToFill" AutomationProperties.Name="{Binding Title}"/>
|
||||
</Border>
|
||||
<StackPanel Grid.Column="1" VerticalAlignment="Top" Margin="10,0,0,0">
|
||||
<TextBlock Text="{Binding Name}" Style="{StaticResource TitleTextBlockStyle}" TextWrapping="NoWrap"/>
|
||||
<TextBlock Style="{StaticResource CaptionTextBlockStyle}" TextWrapping="NoWrap"/>
|
||||
<TextBlock Text="{Binding EntryCount}" Style="{StaticResource BodyTextBlockStyle}" MaxHeight="60"/>
|
||||
<TextBlock Text="{Binding GroupCount}" Style="{StaticResource BodyTextBlockStyle}" MaxHeight="60"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Border BorderThickness="2" BorderBrush="DimGray" Background="{ThemeResource ListViewItemPlaceholderBackgroundThemeBrush}" Margin="0,10,0,0" >
|
||||
<Grid Height="110" Width="480" >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<SymbolIcon Grid.Column="0" Symbol="{Binding IconSymbol}" Width="100" Height="100" />
|
||||
<StackPanel Grid.Column="1" VerticalAlignment="Top" Margin="10,0,0,0">
|
||||
<TextBlock Text="{Binding Name}" Style="{StaticResource TitleTextBlockStyle}" TextWrapping="NoWrap"/>
|
||||
<TextBlock Style="{StaticResource CaptionTextBlockStyle}" TextWrapping="NoWrap"/>
|
||||
<TextBlock Text="{Binding EntryCount, ConverterParameter=entry\,entries, Converter={StaticResource PluralizationConverter}}" Style="{StaticResource BodyTextBlockStyle}" MaxHeight="60"/>
|
||||
<TextBlock Text="{Binding GroupCount, ConverterParameter=group\,groups, Converter={StaticResource PluralizationConverter}}" Style="{StaticResource BodyTextBlockStyle}" MaxHeight="60"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</GridView.ItemTemplate>
|
||||
<GridView.Header>
|
||||
<StackPanel Width="480" Margin="0,4,14,0">
|
||||
<ListView x:Name="entriesListView" Height="auto" ItemsSource="{Binding Source={StaticResource entriesViewSource}}" Margin="10,0,0,0" SelectionChanged="entriesListView_SelectionChanged">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="{Binding Title}" Style="{StaticResource TitleTextBlockStyle}" TextWrapping="NoWrap" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
</StackPanel>
|
||||
<ListView
|
||||
x:Name="entriesListView"
|
||||
Height="auto"
|
||||
Width="480"
|
||||
ItemsSource="{Binding Source={StaticResource entriesViewSource}}"
|
||||
Margin="10,0,0,0"
|
||||
SelectionChanged="entriesListView_SelectionChanged"
|
||||
IsSynchronizedWithCurrentItem="False" >
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<SymbolIcon Symbol="{Binding IconSymbol}" Margin="0,5,0,0"/>
|
||||
<TextBlock Text="{Binding Title}" Style="{StaticResource TitleTextBlockStyle}" TextWrapping="NoWrap" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="30,0,0,0"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
<ListView.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="Entries" FontSize="20" Margin="0,20,0,20" />
|
||||
</DataTemplate>
|
||||
</ListView.HeaderTemplate>
|
||||
</ListView>
|
||||
</GridView.Header>
|
||||
<GridView.ItemContainerStyle>
|
||||
<Style TargetType="FrameworkElement">
|
||||
@@ -99,7 +112,7 @@
|
||||
AutomationProperties.Name="Back"
|
||||
AutomationProperties.AutomationId="BackButton"
|
||||
AutomationProperties.ItemType="Navigation Button"/>
|
||||
<TextBlock x:Name="pageTitle" Text="{Binding Path=Name}" Style="{StaticResource HeaderTextBlockStyle}" Grid.Column="1"
|
||||
<TextBlock x:Name="pageTitle" Text="{Binding Name}" Style="{StaticResource HeaderTextBlockStyle}" Grid.Column="1"
|
||||
IsHitTestVisible="false" TextWrapping="NoWrap" VerticalAlignment="Bottom" Margin="0,0,30,40"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
@@ -62,8 +62,6 @@ namespace ModernKeePass.Pages
|
||||
|
||||
if (!(e.Parameter is GroupVm)) return;
|
||||
DataContext = (GroupVm) e.Parameter;
|
||||
groupsGridView.SelectedIndex = -1;
|
||||
entriesListView.SelectedIndex = -1;
|
||||
}
|
||||
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
|
@@ -32,7 +32,7 @@
|
||||
<HyperlinkButton Grid.Row="1" Grid.ColumnSpan="2" Content="From Url..." IsEnabled="False" />
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" HorizontalAlignment="Left" Visibility="{Binding SelectedVisibility}" TextWrapping="Wrap" Text="{Binding Name}" VerticalAlignment="Center" Height="auto" Width="auto" FontSize="16" Margin="10,7,0,6" />
|
||||
<TextBlock Grid.Row="3" Grid.Column="0" HorizontalAlignment="Left" Visibility="{Binding SelectedVisibility}" TextWrapping="Wrap" Text="Password" VerticalAlignment="Center" Height="auto" Width="auto" FontSize="16" Margin="10,7,0,6" />
|
||||
<PasswordBox Grid.Row="3" Grid.Column="1" x:Name="PasswordBox" Visibility="{Binding SelectedVisibility}" Width="500" IsPasswordRevealButtonEnabled="True" Margin="0,0,10,0"/>
|
||||
<PasswordBox Grid.Row="3" Grid.Column="1" x:Name="PasswordBox" Visibility="{Binding SelectedVisibility}" Width="500" IsPasswordRevealButtonEnabled="True" Margin="0,0,10,0" KeyDown="PasswordBox_KeyDown"/>
|
||||
<TextBlock Grid.Row="4" Grid.Column="1" x:Name="StatusTextBlock" Visibility="{Binding SelectedVisibility}" Height="auto" Width="auto" Foreground="#FF9E1B1B" FontSize="16" />
|
||||
<Button Grid.Row="5" Grid.Column="1" Content="OK" Visibility="{Binding SelectedVisibility}" HorizontalAlignment="Right" VerticalAlignment="Top" Click="OpenButton_OnClick" Margin="0,0,7,0" Width="auto"/>
|
||||
</Grid>
|
||||
|
@@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using Windows.Storage.Pickers;
|
||||
using Windows.System;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
using ModernKeePass.Common;
|
||||
using ModernKeePass.ViewModels;
|
||||
@@ -49,6 +51,7 @@ namespace ModernKeePass.Pages
|
||||
databaseVm.Name = file.Name;
|
||||
databaseVm.NotifyPropertyChanged("SelectedVisibility");
|
||||
databaseVm.NotifyPropertyChanged("Name");
|
||||
PasswordBox.Focus(FocusState.Programmatic);
|
||||
}
|
||||
|
||||
private void OpenButton_OnClick(object sender, RoutedEventArgs e)
|
||||
@@ -57,5 +60,10 @@ namespace ModernKeePass.Pages
|
||||
StatusTextBlock.Text = app.Database.Open(PasswordBox.Password);
|
||||
if (string.IsNullOrEmpty(StatusTextBlock.Text)) _mainFrame.Navigate(typeof(GroupDetailPage), app.Database.RootGroup);
|
||||
}
|
||||
|
||||
private void PasswordBox_KeyDown(object sender, KeyRoutedEventArgs e)
|
||||
{
|
||||
if (e.Key == VirtualKey.Enter) OpenButton_OnClick(null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -22,7 +22,6 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<HyperlinkButton Grid.Row="0" x:Name="SaveButton" Content="Save and close" Click="SaveButton_OnClick" VerticalAlignment="Top" IsEnabled="{Binding IsOpen}" />
|
||||
<HyperlinkButton Grid.Row="1" x:Name="SaveAsButton" Content="Save as..." VerticalAlignment="Top" IsEnabled="{Binding IsOpen}" />
|
||||
|
||||
<HyperlinkButton Grid.Row="1" x:Name="SaveAsButton" Content="Save as..." VerticalAlignment="Top" IsEnabled="False" />
|
||||
</Grid>
|
||||
</Page>
|
||||
|
@@ -1,4 +1,6 @@
|
||||
using System.ComponentModel;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using ModernKeePass.Mappings;
|
||||
using ModernKeePassLib;
|
||||
using ModernKeePassLib.Security;
|
||||
|
||||
@@ -32,6 +34,15 @@ namespace ModernKeePass.ViewModels
|
||||
set { SetEntryValue(PwDefs.NotesField, value); }
|
||||
}
|
||||
|
||||
public Symbol IconSymbol
|
||||
{
|
||||
get
|
||||
{
|
||||
var result = PwIconToSegoeMapping.GetSymbolFromIcon(_pwEntry.IconId);
|
||||
return result == Symbol.More ? Symbol.Permissions : result;
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
private readonly PwEntry _pwEntry;
|
||||
|
@@ -1,6 +1,8 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using ModernKeePass.Mappings;
|
||||
using ModernKeePassLib;
|
||||
|
||||
namespace ModernKeePass.ViewModels
|
||||
@@ -13,17 +15,16 @@ namespace ModernKeePass.ViewModels
|
||||
public ObservableCollection<GroupVm> Groups { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
public string EntryCount {
|
||||
get
|
||||
{
|
||||
return $"{Entries?.Count} entries.";
|
||||
}
|
||||
}
|
||||
public string GroupCount
|
||||
public int EntryCount => Entries.Count;
|
||||
|
||||
public int GroupCount => Groups.Count;
|
||||
|
||||
public Symbol IconSymbol
|
||||
{
|
||||
get
|
||||
{
|
||||
return $"{Groups?.Count} groups.";
|
||||
var result = PwIconToSegoeMapping.GetSymbolFromIcon(_pwGroup.IconId);
|
||||
return result == Symbol.More ? Symbol.Folder : result;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user