mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
1st working version in clean arch
WIP Parent group mapping issues
This commit is contained in:
@@ -4,6 +4,7 @@ using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
using ModernKeePass.Common;
|
||||
using ModernKeePass.Domain.Interfaces;
|
||||
using ModernKeePass.Interfaces;
|
||||
|
||||
namespace ModernKeePass.Views.BasePages
|
||||
|
@@ -18,9 +18,8 @@
|
||||
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
||||
<converters:InverseBooleanToVisibilityConverter x:Key="InverseBooleanToVisibilityConverter" />
|
||||
<converters:ProgressBarLegalValuesConverter x:Key="ProgressBarLegalValuesConverter" />
|
||||
<converters:DoubleToSolidColorBrushConverter x:Key="DoubleToForegroungBrushComplexityConverter" />
|
||||
<converters:DoubleToSolidColorBrushConverter x:Key="DoubleToForegroundBrushComplexityConverter" />
|
||||
<converters:ColorToBrushConverter x:Key="ColorToBrushConverter" />
|
||||
<converters:IntToSymbolConverter x:Key="IntToSymbolConverter" />
|
||||
<Style TargetType="PasswordBox" x:Name="PasswordBoxWithButtonStyle">
|
||||
<Setter Property="MinWidth" Value="{ThemeResource TextControlThemeMinWidth}" />
|
||||
<Setter Property="MinHeight" Value="{ThemeResource TextControlThemeMinHeight}" />
|
||||
@@ -429,7 +428,7 @@
|
||||
</core:EventTriggerBehavior>
|
||||
</interactivity:Interaction.Behaviors>
|
||||
</local:TextBoxWithButton>
|
||||
<ProgressBar Value="{Binding PasswordComplexityIndicator, ConverterParameter=0\,128, Converter={StaticResource ProgressBarLegalValuesConverter}}" Maximum="128" Width="350" HorizontalAlignment="Left" Foreground="{Binding PasswordComplexityIndicator, ConverterParameter=128, Converter={StaticResource DoubleToForegroungBrushComplexityConverter}}" />
|
||||
<ProgressBar Value="{Binding PasswordComplexityIndicator, ConverterParameter=0\,128, Converter={StaticResource ProgressBarLegalValuesConverter}}" Maximum="128" Width="350" HorizontalAlignment="Left" Foreground="{Binding PasswordComplexityIndicator, ConverterParameter=128, Converter={StaticResource DoubleToForegroundBrushComplexityConverter}}" />
|
||||
<CheckBox x:Uid="EntryShowPassword" HorizontalAlignment="Left" Margin="-3,0,0,0" IsChecked="{Binding IsRevealPassword, Mode=TwoWay}" IsEnabled="{Binding IsRevealPasswordEnabled}" />
|
||||
<TextBlock TextWrapping="Wrap" Text="URL" FontSize="18"/>
|
||||
<local:TextBoxWithButton x:Uid="UrlTextBox" Text="{Binding Url, Mode=TwoWay}" MaxLength="256" Style="{StaticResource EntryTextBoxWithButtonStyle}" ButtonSymbol="" IsEnabled="{Binding IsSelected}">
|
||||
@@ -498,10 +497,10 @@
|
||||
<RowDefinition Height="20" />
|
||||
</Grid.RowDefinitions>
|
||||
<Viewbox MaxHeight="30" Width="50" Grid.Column="0" Grid.Row="0" Visibility="{Binding IsEditMode, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<userControls:SymbolPickerUserControl Width="80" Height="40" SelectedSymbol="{Binding Icon, Converter={StaticResource IntToSymbolConverter}, ConverterParameter=0, Mode=TwoWay}" />
|
||||
<userControls:SymbolPickerUserControl Width="80" Height="40" SelectedSymbol="{Binding Icon, Mode=TwoWay}" />
|
||||
</Viewbox>
|
||||
<Viewbox MaxHeight="30" Width="50" Grid.Column="0" Grid.Row="0" Visibility="{Binding IsEditMode, Converter={StaticResource InverseBooleanToVisibilityConverter}}">
|
||||
<SymbolIcon Symbol="{Binding Icon, Converter={StaticResource IntToSymbolConverter}}" Width="80" Height="40" />
|
||||
<SymbolIcon Symbol="{Binding Icon}" Width="80" Height="40" />
|
||||
</Viewbox>
|
||||
<TextBox Grid.Column="1" Grid.Row="0"
|
||||
Text="{Binding Title, Mode=TwoWay}"
|
||||
@@ -525,7 +524,7 @@
|
||||
</Grid>
|
||||
<userControls:TopMenuUserControl
|
||||
x:Name="TopMenu" Grid.Column="2"
|
||||
RestoreButtonVisibility="{Binding ParentGroup.IsSelected, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
RestoreButtonVisibility="{Binding CanRestore, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
DeleteButtonVisibility="{Binding IsSelected, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
IsEditButtonChecked="{Binding IsEditMode, Mode=TwoWay}"
|
||||
SaveCommand="{Binding SaveCommand}"
|
||||
|
@@ -42,8 +42,10 @@ namespace ModernKeePass.Views
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
NavigationHelper.OnNavigatedTo(e);
|
||||
if (!(e.Parameter is EntryVm)) return;
|
||||
DataContext = (EntryVm)e.Parameter;
|
||||
/*if (!(e.Parameter is EntryVm)) return;
|
||||
DataContext = (EntryVm)e.Parameter;*/
|
||||
var args = e.Parameter as Application.Entry.Models.EntryVm;
|
||||
if (args != null) DataContext = new EntryVm(args);
|
||||
}
|
||||
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
@@ -67,7 +69,7 @@ namespace ModernKeePass.Views
|
||||
case -1:
|
||||
return;
|
||||
default:
|
||||
var entry = listView?.SelectedItem as EntryVm;
|
||||
var entry = listView?.SelectedItem as Application.Entry.Models.EntryVm;
|
||||
StackPanel.DataContext = entry;
|
||||
TopGrid.DataContext = entry;
|
||||
break;
|
||||
|
@@ -17,8 +17,6 @@
|
||||
<converters:ColorToBrushConverter x:Key="ColorToBrushConverter"/>
|
||||
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
||||
<converters:InverseBooleanToVisibilityConverter x:Key="InverseBooleanToVisibilityConverter"/>
|
||||
<converters:NullToBooleanConverter x:Key="NullToBooleanConverter"/>
|
||||
<converters:IntToSymbolConverter x:Key="IntToSymbolConverter"/>
|
||||
</Page.Resources>
|
||||
<Page.DataContext>
|
||||
<viewModels:GroupVm />
|
||||
@@ -105,13 +103,13 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Grid.Column="0" Background="{Binding BackgroundColor, ConverterParameter={StaticResource MainColor}, Converter={StaticResource ColorToBrushConverter}}">
|
||||
<Viewbox MaxHeight="50" Width="100">
|
||||
<SymbolIcon Symbol="{Binding Icon, Converter={StaticResource IntToSymbolConverter}, ConverterParameter=0}" Foreground="{StaticResource TextColor}" />
|
||||
<SymbolIcon Symbol="{Binding Icon}" Foreground="{StaticResource TextColor}" />
|
||||
</Viewbox>
|
||||
</Border>
|
||||
<StackPanel Grid.Column="1" VerticalAlignment="Top" Margin="10,10,0,0" >
|
||||
<TextBlock x:Name="NameTextBlock" Text="{Binding Title}" Style="{StaticResource TitleTextBlockStyle}" TextWrapping="NoWrap" Foreground="{Binding ForegroundColor, ConverterParameter={StaticResource TextBoxForegroundThemeBrush}, Converter={StaticResource ColorToBrushConverter}}"/>
|
||||
<TextBlock Style="{StaticResource CaptionTextBlockStyle}" TextWrapping="NoWrap" />
|
||||
<TextBlock Text="{Binding UserName}" Style="{StaticResource BodyTextBlockStyle}" Foreground="{Binding ForegroundColor, ConverterParameter={StaticResource TextBoxForegroundThemeBrush}, Converter={StaticResource ColorToBrushConverter}}" MaxHeight="60" />
|
||||
<TextBlock Text="{Binding Username}" Style="{StaticResource BodyTextBlockStyle}" Foreground="{Binding ForegroundColor, ConverterParameter={StaticResource TextBoxForegroundThemeBrush}, Converter={StaticResource ColorToBrushConverter}}" MaxHeight="60" />
|
||||
<TextBlock Text="{Binding Url}" Style="{StaticResource BodyTextBlockStyle}" Foreground="{Binding ForegroundColor, ConverterParameter={StaticResource TextBoxForegroundThemeBrush}, Converter={StaticResource ColorToBrushConverter}}" MaxHeight="60" />
|
||||
</StackPanel>
|
||||
<Button Grid.Column="2" Style="{StaticResource NoBorderButtonStyle}" Background="{StaticResource AppBarBackgroundThemeBrush}" VerticalAlignment="Bottom">
|
||||
@@ -121,7 +119,7 @@
|
||||
<MenuFlyoutItem x:Uid="EntryItemCopyLogin">
|
||||
<interactivity:Interaction.Behaviors>
|
||||
<core:EventTriggerBehavior EventName="Click">
|
||||
<actions:ClipboardAction Text="{Binding UserName}" />
|
||||
<actions:ClipboardAction Text="{Binding Username}" />
|
||||
<actions:ToastAction x:Uid="ToastCopyLogin" Title="{Binding Title}" />
|
||||
</core:EventTriggerBehavior>
|
||||
</interactivity:Interaction.Behaviors>
|
||||
@@ -207,10 +205,10 @@
|
||||
<RowDefinition Height="20" />
|
||||
</Grid.RowDefinitions>
|
||||
<Viewbox MaxHeight="30" Width="50" Grid.Column="0" Grid.Row="0" Visibility="{Binding IsEditMode, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<userControls:SymbolPickerUserControl Width="80" Height="40" SelectedSymbol="{Binding Icon, Converter={StaticResource IntToSymbolConverter}, ConverterParameter=48, Mode=TwoWay}" />
|
||||
<userControls:SymbolPickerUserControl Width="80" Height="40" SelectedSymbol="{Binding Icon, Mode=TwoWay}" />
|
||||
</Viewbox>
|
||||
<Viewbox MaxHeight="30" Width="50" Grid.Column="0" Grid.Row="0" Visibility="{Binding IsEditMode, Converter={StaticResource InverseBooleanToVisibilityConverter}}">
|
||||
<SymbolIcon Symbol="{Binding Icon, Converter={StaticResource IntToSymbolConverter}}" Width="80" Height="40" />
|
||||
<SymbolIcon Symbol="{Binding Icon}" Width="80" Height="40" />
|
||||
</Viewbox>
|
||||
<TextBox Grid.Column="1" Grid.Row="0"
|
||||
x:Name="TitleTextBox"
|
||||
|
@@ -8,6 +8,7 @@ using Windows.UI.Xaml.Navigation;
|
||||
using ModernKeePass.Common;
|
||||
using ModernKeePass.Events;
|
||||
using ModernKeePass.ViewModels;
|
||||
using EntryVm = ModernKeePass.Application.Entry.Models.EntryVm;
|
||||
|
||||
// The Group Detail Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234229
|
||||
|
||||
@@ -46,13 +47,13 @@ namespace ModernKeePass.Views
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
NavigationHelper.OnNavigatedTo(e);
|
||||
|
||||
|
||||
var args = e.Parameter as PasswordEventArgs;
|
||||
if (args != null)
|
||||
DataContext = args.RootGroup;
|
||||
DataContext = new GroupVm(args.RootGroup);
|
||||
else
|
||||
{
|
||||
var vm = e.Parameter as GroupVm;
|
||||
var vm = e.Parameter as Application.Group.Models.GroupVm;
|
||||
if (vm != null)
|
||||
DataContext = vm;
|
||||
}
|
||||
@@ -75,7 +76,7 @@ namespace ModernKeePass.Views
|
||||
case -1:
|
||||
return;
|
||||
default:
|
||||
var group = listView?.SelectedItem as GroupVm;
|
||||
var group = listView?.SelectedItem as Application.Group.Models.GroupVm;
|
||||
Frame.Navigate(typeof(GroupDetailPage), group);
|
||||
break;
|
||||
}
|
||||
|
@@ -66,12 +66,11 @@ namespace ModernKeePass.Views
|
||||
|
||||
private async void ImportFileButton_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var picker =
|
||||
new FileOpenPicker
|
||||
{
|
||||
ViewMode = PickerViewMode.List,
|
||||
SuggestedStartLocation = PickerLocationId.DocumentsLibrary
|
||||
};
|
||||
var picker = new FileOpenPicker
|
||||
{
|
||||
ViewMode = PickerViewMode.List,
|
||||
SuggestedStartLocation = PickerLocationId.DocumentsLibrary
|
||||
};
|
||||
if (!string.IsNullOrEmpty(Model.ImportFileExtensionFilter))
|
||||
picker.FileTypeFilter.Add(Model.ImportFileExtensionFilter);
|
||||
|
||||
@@ -80,10 +79,10 @@ namespace ModernKeePass.Views
|
||||
if (Model.ImportFile != null) ImportFileLink.Content = Model.ImportFile.Name;
|
||||
}
|
||||
|
||||
private void CompositeKeyUserControl_OnValidationChecked(object sender, PasswordEventArgs e)
|
||||
private async void CompositeKeyUserControl_OnValidationChecked(object sender, PasswordEventArgs e)
|
||||
{
|
||||
Model.PopulateInitialData(DatabaseService.Instance, new SettingsService(), new ImportService());
|
||||
_mainFrame.Navigate(typeof(GroupDetailPage), DatabaseService.Instance.RootGroup);
|
||||
var rootGroup = await Model.PopulateInitialData();
|
||||
_mainFrame.Navigate(typeof(GroupDetailPage), rootGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -33,12 +33,11 @@ namespace ModernKeePass.Views
|
||||
|
||||
private async void ButtonBase_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var picker =
|
||||
new FileOpenPicker
|
||||
{
|
||||
ViewMode = PickerViewMode.List,
|
||||
SuggestedStartLocation = PickerLocationId.DocumentsLibrary
|
||||
};
|
||||
var picker = new FileOpenPicker
|
||||
{
|
||||
ViewMode = PickerViewMode.List,
|
||||
SuggestedStartLocation = PickerLocationId.DocumentsLibrary
|
||||
};
|
||||
picker.FileTypeFilter.Add(".kdbx");
|
||||
|
||||
// Application now has read/write access to the picked file
|
||||
|
@@ -95,7 +95,7 @@ namespace ModernKeePass.Views.UserControls
|
||||
if (UpdateKey)
|
||||
{
|
||||
await Model.UpdateKey();
|
||||
ValidationChecked?.Invoke(this, new PasswordEventArgs(new GroupVm(Model.RootGroup, null)));
|
||||
ValidationChecked?.Invoke(this, new PasswordEventArgs(Model.RootGroup));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -175,7 +175,7 @@ namespace ModernKeePass.Views.UserControls
|
||||
ButtonLabel = resource.GetResourceValue("CompositeKeyOpening");
|
||||
if (await Dispatcher.RunTaskAsync(async () => await Model.OpenDatabase(DatabaseFile, CreateNew)))
|
||||
{
|
||||
ValidationChecked?.Invoke(this, new PasswordEventArgs(new GroupVm(Model.RootGroup, null)));
|
||||
ValidationChecked?.Invoke(this, new PasswordEventArgs(Model.RootGroup));
|
||||
}
|
||||
|
||||
ButtonLabel = oldLabel;
|
||||
|
@@ -10,7 +10,7 @@
|
||||
xmlns:converters="using:ModernKeePass.Converters"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<converters:IntToSymbolConverter x:Key="IntToSymbolConverter"/>
|
||||
<converters:IconToSymbolConverter x:Key="IconToSymbolConverter"/>
|
||||
</UserControl.Resources>
|
||||
<ListView
|
||||
ItemsSource="{Binding ItemsSource, ElementName=UserControl}"
|
||||
@@ -26,7 +26,7 @@
|
||||
<x:Double x:Key="HamburgerMenuSize">300</x:Double>
|
||||
<DataTemplate x:Name="IsSpecial">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<SymbolIcon Symbol="{Binding IconId, Converter={StaticResource IntToSymbolConverter}, ConverterParameter=48}" Margin="7,15,0,15">
|
||||
<SymbolIcon Symbol="{Binding Icon, Converter={StaticResource IconToSymbolConverter}, ConverterParameter=48}" Margin="7,15,0,15">
|
||||
<ToolTipService.ToolTip>
|
||||
<ToolTip Content="{Binding Path={Binding DisplayMemberPath, ElementName=UserControl}}" />
|
||||
</ToolTipService.ToolTip>
|
||||
@@ -36,7 +36,7 @@
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Name="IsNormal">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<SymbolIcon Symbol="{Binding IconId, Converter={StaticResource IntToSymbolConverter}, ConverterParameter=48}" Margin="7,15,0,15">
|
||||
<SymbolIcon Symbol="{Binding Icon, Converter={StaticResource IconToSymbolConverter}, ConverterParameter=48}" Margin="7,15,0,15">
|
||||
<ToolTipService.ToolTip>
|
||||
<ToolTip Content="{Binding Path={Binding DisplayMemberPath, ElementName=UserControl}}" />
|
||||
</ToolTipService.ToolTip>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using ModernKeePass.Interfaces;
|
||||
using ModernKeePass.Application.Common.Interfaces;
|
||||
|
||||
// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236
|
||||
|
||||
@@ -75,18 +75,18 @@ namespace ModernKeePass.Views.UserControls
|
||||
typeof(HamburgerMenuUserControl),
|
||||
new PropertyMetadata(Visibility.Collapsed, (o, args) => { }));
|
||||
|
||||
public IEnumerable<IVmEntity> ItemsSource
|
||||
public IEnumerable<IEntityVm> ItemsSource
|
||||
{
|
||||
get { return (IEnumerable<IVmEntity>)GetValue(ItemsSourceProperty); }
|
||||
get { return (IEnumerable<IEntityVm>)GetValue(ItemsSourceProperty); }
|
||||
set { SetValue(ItemsSourceProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ItemsSourceProperty =
|
||||
DependencyProperty.Register(
|
||||
"ItemsSource",
|
||||
typeof(IEnumerable<IVmEntity>),
|
||||
typeof(IEnumerable<IEntityVm>),
|
||||
typeof(HamburgerMenuUserControl),
|
||||
new PropertyMetadata(new List<IVmEntity>(), (o, args) => { }));
|
||||
new PropertyMetadata(new List<IEntityVm>(), (o, args) => { }));
|
||||
|
||||
public object SelectedItem
|
||||
{
|
||||
|
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using ModernKeePass.Converters;
|
||||
|
||||
// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236
|
||||
|
||||
@@ -28,8 +27,7 @@ namespace ModernKeePass.Views.UserControls
|
||||
public SymbolPickerUserControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
var converter = new IntToSymbolConverter();
|
||||
Symbols = Enum.GetValues(typeof(Symbol)).Cast<Symbol>().Where(s => (int)converter.ConvertBack(s, null, null, string.Empty) != -1);
|
||||
Symbols = Enum.GetValues(typeof(Symbol)).Cast<Symbol>();
|
||||
}
|
||||
|
||||
private void ComboBox_OnLoaded(object sender, RoutedEventArgs e)
|
||||
|
Reference in New Issue
Block a user