mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
Build hierarchy instead of using Automapper
Add entities before removing them
This commit is contained in:
@@ -372,7 +372,7 @@
|
||||
</Style>
|
||||
</Page.Resources>
|
||||
<Page.DataContext>
|
||||
<viewModels:EntryVm />
|
||||
<viewModels:EntryDetailVm />
|
||||
</Page.DataContext>
|
||||
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<Grid.ChildrenTransitions>
|
||||
@@ -410,7 +410,7 @@
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
<TextBlock x:Uid="EntryLogin" />
|
||||
<local:TextBoxWithButton x:Uid="LoginTextBox" Text="{Binding UserName, Mode=TwoWay}" Style="{StaticResource EntryTextBoxWithButtonStyle}" ButtonSymbol="" IsEnabled="{Binding IsSelected}">
|
||||
<local:TextBoxWithButton x:Uid="LoginTextBox" Text="{Binding UserName, Mode=TwoWay}" LostFocus="Username_OnLostFocus" Style="{StaticResource EntryTextBoxWithButtonStyle}" ButtonSymbol="" IsEnabled="{Binding IsSelected}">
|
||||
<interactivity:Interaction.Behaviors>
|
||||
<core:EventTriggerBehavior EventName="ButtonClick">
|
||||
<actions:ClipboardAction Text="{Binding UserName}" />
|
||||
|
@@ -14,7 +14,7 @@ namespace ModernKeePass.Views
|
||||
/// </summary>
|
||||
public sealed partial class EntryDetailPage
|
||||
{
|
||||
public EntryVm Model => (EntryVm) DataContext;
|
||||
public EntryDetailVm Model => (EntryDetailVm) DataContext;
|
||||
|
||||
/// <summary>
|
||||
/// NavigationHelper est utilisé sur chaque page pour faciliter la navigation et
|
||||
@@ -45,7 +45,7 @@ namespace ModernKeePass.Views
|
||||
/*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);
|
||||
if (args != null) DataContext = new EntryDetailVm(args);
|
||||
}
|
||||
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
@@ -75,5 +75,10 @@ namespace ModernKeePass.Views
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private async void Username_OnLostFocus(object sender, RoutedEventArgs e)
|
||||
{
|
||||
await Model.SetFieldValue(nameof(Model.UserName), ((TextBox) sender).Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
<converters:InverseBooleanToVisibilityConverter x:Key="InverseBooleanToVisibilityConverter"/>
|
||||
</Page.Resources>
|
||||
<Page.DataContext>
|
||||
<viewModels:GroupVm />
|
||||
<viewModels:GroupDetailVm />
|
||||
</Page.DataContext>
|
||||
<Grid>
|
||||
<Grid.Resources>
|
||||
|
@@ -25,7 +25,7 @@ namespace ModernKeePass.Views
|
||||
/// process lifetime management
|
||||
/// </summary>
|
||||
public NavigationHelper NavigationHelper { get; }
|
||||
public GroupVm Model => (GroupVm)DataContext;
|
||||
public GroupDetailVm Model => (GroupDetailVm)DataContext;
|
||||
|
||||
public GroupDetailPage()
|
||||
{
|
||||
@@ -50,12 +50,12 @@ namespace ModernKeePass.Views
|
||||
|
||||
var args = e.Parameter as PasswordEventArgs;
|
||||
if (args != null)
|
||||
DataContext = new GroupVm(args.RootGroup);
|
||||
DataContext = new GroupDetailVm(args.RootGroup);
|
||||
else
|
||||
{
|
||||
var vm = e.Parameter as Application.Group.Models.GroupVm;
|
||||
if (vm != null)
|
||||
DataContext = new GroupVm(vm);
|
||||
DataContext = new GroupDetailVm(vm);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user