Username is now correctly persisted

Set credentials validation works as intended
Getting settings has default values
Add parent group in Move searchbox
Moving entries work as intended
Removed unreferenced code files
This commit is contained in:
Geoffroy BONNEVILLE
2020-04-30 19:40:48 +02:00
parent e5353478f4
commit 8de493f987
18 changed files with 53 additions and 399 deletions

View File

@@ -51,7 +51,7 @@
<SolidColorBrush x:Key="HyperlinkPointerOverForegroundThemeBrush" Color="{ThemeResource MainColorLight}" />
<SolidColorBrush x:Key="SearchBoxForegroundThemeBrush" Color="{ThemeResource TextColorDark}" />
<SolidColorBrush x:Key="SearchBoxPointerOverBorderThemeBrush" Color="{ThemeResource MainColorLight}" />
<!--<SolidColorBrush x:Key="SearchBoxPointerOverBorderThemeBrush" Color="{ThemeResource MainColorLight}" />-->
<SolidColorBrush x:Key="SearchBoxPointerOverTextThemeBrush" Color="{ThemeResource MainColorLight}" />
<SolidColorBrush x:Key="SearchBoxFocusedBorderThemeBrush" Color="{ThemeResource MainColor}" />
<SolidColorBrush x:Key="SearchBoxButtonBackgroundThemeBrush" Color="{ThemeResource MainColor}" />

View File

@@ -107,7 +107,12 @@ namespace ModernKeePass.ViewModels
public string UserName
{
get { return SelectedItem.Username; }
set { SelectedItem.Username = value; }
set
{
SelectedItem.Username = value;
SetFieldValue(nameof(UserName), value).Wait();
RaisePropertyChanged(nameof(UserName));
}
}
public string Password
@@ -129,6 +134,7 @@ namespace ModernKeePass.ViewModels
{
SelectedItem.Url = value;
SetFieldValue(nameof(Url), value).Wait();
RaisePropertyChanged(nameof(Url));
}
}
@@ -253,7 +259,7 @@ namespace ModernKeePass.ViewModels
SaveCommand = new RelayCommand(async () => await SaveChanges(), () => Database.IsDirty);
GeneratePasswordCommand = new RelayCommand(async () => await GeneratePassword());
MoveCommand = new RelayCommand<string>(async destination => await Move(destination), destination => _parent != null && string.IsNullOrEmpty(destination) && destination != _parent.Id);
MoveCommand = new RelayCommand<string>(async destination => await Move(destination), destination => _parent != null && !string.IsNullOrEmpty(destination) && destination != _parent.Id);
RestoreCommand = new RelayCommand(async () => await RestoreHistory());
DeleteCommand = new RelayCommand(async () => await AskForDelete());
GoBackCommand = new RelayCommand(() => _navigation.GoBack());

View File

@@ -3,7 +3,6 @@ using System.Collections.Generic;
using Windows.Storage.AccessCache;
using Windows.Storage.Pickers;
using Windows.UI.Xaml;
using ModernKeePass.Domain.Dtos;
using ModernKeePass.ViewModels;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
@@ -29,19 +28,14 @@ namespace ModernKeePass.Views
SuggestedStartLocation = PickerLocationId.DocumentsLibrary,
SuggestedFileName = "New Database"
};
savePicker.FileTypeChoices.Add("KeePass 2.x database", new List<string> { ".kdbx" });
savePicker.FileTypeChoices.Add("KeePass 2.x database", new List<string> {".kdbx"});
var file = await savePicker.PickSaveFileAsync().AsTask();
if (file == null) return;
var token = StorageApplicationPermissions.FutureAccessList.Add(file, file.Name);
var fileInfo = new FileInfo
{
Id = token,
Path = file.Path,
Name = file.DisplayName
};
Model.OpenFile(fileInfo);
Model.Token = StorageApplicationPermissions.FutureAccessList.Add(file, file.Name);
Model.Name = file.Name;
Model.Path = file.Path;
}
}
}

View File

@@ -28,7 +28,9 @@ namespace ModernKeePass.Views
var file = e.Parameter as FileInfo;
if (file != null)
{
Model.OpenFile(file);
Model.Path = file.Path;
Model.Name = file.Name;
Model.Token = file.Id;
}
}
@@ -46,14 +48,9 @@ namespace ModernKeePass.Views
if (file == null) return;
// TODO: use service
var token = StorageApplicationPermissions.MostRecentlyUsedList.Add(file, file.Path);
var fileInfo = new FileInfo
{
Path = file.Path,
Name = file.DisplayName,
Id = token
};
Model.OpenFile(fileInfo);
Model.Token = StorageApplicationPermissions.MostRecentlyUsedList.Add(file, file.Path);
Model.Path = file.Path;
Model.Name = file.Name;
}
}
}

View File

@@ -117,19 +117,6 @@
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Initial">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PasswordBox" Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TextBoxBorderThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ConfirmPasswordBox" Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TextBoxBorderThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HyperlinkButton" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource HyperlinkForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<interactivity:Interaction.Behaviors>
@@ -145,9 +132,6 @@
<core:DataTriggerBehavior Binding="{Binding IsKeyFileValid}" Value="True">
<core:GoToStateAction StateName="KeyFileValid"/>
</core:DataTriggerBehavior>
<core:DataTriggerBehavior Binding="{Binding IsValid}" Value="True">
<core:GoToStateAction StateName="Initial"/>
</core:DataTriggerBehavior>
</interactivity:Interaction.Behaviors>
</Grid>
</UserControl>

View File

@@ -44,9 +44,8 @@ namespace ModernKeePass.Views.UserControls
var file = await picker.PickSingleFileAsync();
if (file == null) return;
var token = StorageApplicationPermissions.FutureAccessList.Add(file, file.Name);
Model.KeyFilePath = token;
Model.KeyFileText = file.DisplayName;
Model.KeyFilePath = StorageApplicationPermissions.FutureAccessList.Add(file, file.Name);
Model.KeyFileText = file.Name;
}
private async void CreateKeyFileButton_Click(object sender, RoutedEventArgs e)
@@ -61,9 +60,8 @@ namespace ModernKeePass.Views.UserControls
var file = await savePicker.PickSaveFileAsync();
if (file == null) return;
var token = StorageApplicationPermissions.FutureAccessList.Add(file, file.Name);
Model.KeyFilePath = token;
Model.KeyFileText = file.DisplayName;
Model.KeyFilePath = StorageApplicationPermissions.FutureAccessList.Add(file, file.Name);
Model.KeyFileText = file.Name;
await Model.GenerateKeyFile();
}
}

View File

@@ -202,7 +202,7 @@ namespace ModernKeePass.Views.UserControls
{
args.Request.SearchSuggestionCollection.AppendResultSuggestion(
group.Title,
group.ParentGroupName,
group.ParentGroupName ?? string.Empty,
group.Id,
imageUri,
string.Empty);