mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
Changed implementation of sample data
Creating a new entry does not create an useless history value WIP import data
This commit is contained in:
13
ModernKeePass/ImportFormats/CsvImportFormat.cs
Normal file
13
ModernKeePass/ImportFormats/CsvImportFormat.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Windows.Storage;
|
||||
using ModernKeePass.Interfaces;
|
||||
|
||||
namespace ModernKeePass.ImportFormats
|
||||
{
|
||||
public class CsvImportFormat: IFormat
|
||||
{
|
||||
public IPwEntity Import(IStorageFile source)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
13
ModernKeePass/ImportFormats/NullImportFormat.cs
Normal file
13
ModernKeePass/ImportFormats/NullImportFormat.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Windows.Storage;
|
||||
using ModernKeePass.Interfaces;
|
||||
|
||||
namespace ModernKeePass.ImportFormats
|
||||
{
|
||||
public class NullImportFormat: IFormat
|
||||
{
|
||||
public IPwEntity Import(IStorageFile source)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@@ -117,6 +117,8 @@
|
||||
</Compile>
|
||||
<Compile Include="Converters\IntToSymbolConverter.cs" />
|
||||
<Compile Include="Exceptions\NavigationException.cs" />
|
||||
<Compile Include="ImportFormats\CsvImportFormat.cs" />
|
||||
<Compile Include="ImportFormats\NullImportFormat.cs" />
|
||||
<Compile Include="Interfaces\IFormat.cs" />
|
||||
<Compile Include="Interfaces\IImportService.cs" />
|
||||
<Compile Include="Interfaces\IProxyInvocationHandler.cs" />
|
||||
|
@@ -204,7 +204,7 @@ namespace ModernKeePass.ViewModels
|
||||
private readonly IDatabaseService _database;
|
||||
private readonly IResourceService _resource;
|
||||
private bool _isEditMode;
|
||||
private bool _isDirty;
|
||||
private bool _isDirty = true;
|
||||
private bool _isRevealPassword;
|
||||
private double _passwordLength = 25;
|
||||
private bool _isVisible = true;
|
||||
|
@@ -1,5 +1,7 @@
|
||||
using Windows.Storage;
|
||||
using System;
|
||||
using Windows.Storage;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using ModernKeePass.Converters;
|
||||
using ModernKeePass.Interfaces;
|
||||
using ModernKeePassLib;
|
||||
|
||||
@@ -23,14 +25,16 @@ namespace ModernKeePass.ViewModels
|
||||
|
||||
private void CreateSampleData(IDatabaseService database)
|
||||
{
|
||||
var converter = new IntToSymbolConverter();
|
||||
|
||||
var bankingGroup = database.RootGroup.AddNewGroup("Banking");
|
||||
bankingGroup.IconId = (int) Symbol.Calculator;
|
||||
bankingGroup.IconId = (int)converter.ConvertBack(Symbol.Calculator, null, null, string.Empty);
|
||||
|
||||
var emailGroup = database.RootGroup.AddNewGroup("Email");
|
||||
emailGroup.IconId = (int) Symbol.Mail;
|
||||
emailGroup.IconId = (int)converter.ConvertBack(Symbol.Mail, null, null, string.Empty);
|
||||
|
||||
var internetGroup = database.RootGroup.AddNewGroup("Internet");
|
||||
internetGroup.IconId = (int) Symbol.World;
|
||||
internetGroup.IconId = (int)converter.ConvertBack(Symbol.World, null, null, string.Empty);
|
||||
|
||||
var sample1 = database.RootGroup.AddNewEntry();
|
||||
sample1.Name = "Sample Entry";
|
||||
|
@@ -32,7 +32,7 @@
|
||||
<HyperlinkButton Content="Select file..." Style="{StaticResource MainColorHyperlinkButton}" Click="ImportFileButton_OnClick" />
|
||||
<StackPanel>
|
||||
<TextBlock Text="Format" Style="{StaticResource BodyTextBlockStyle}" Margin="0,0,0,10" />
|
||||
<ComboBox Style="{StaticResource MainColorComboBox}" SelectedItem="{Binding ImportFormat}">
|
||||
<ComboBox Style="{StaticResource MainColorComboBox}" SelectionChanged="Selector_OnSelectionChanged">
|
||||
<ComboBoxItem>CSV</ComboBoxItem>
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
|
@@ -2,7 +2,10 @@
|
||||
using System.Collections.Generic;
|
||||
using Windows.Storage.Pickers;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
using ModernKeePass.Events;
|
||||
using ModernKeePass.ImportFormats;
|
||||
using ModernKeePass.Services;
|
||||
using ModernKeePass.ViewModels;
|
||||
|
||||
@@ -15,12 +18,20 @@ namespace ModernKeePass.Views
|
||||
/// </summary>
|
||||
public sealed partial class NewDatabasePage
|
||||
{
|
||||
private Frame _mainFrame;
|
||||
|
||||
public NewVm Model => (NewVm)DataContext;
|
||||
|
||||
public NewDatabasePage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
_mainFrame = e.Parameter as Frame;
|
||||
}
|
||||
|
||||
private async void ButtonBase_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
@@ -52,8 +63,23 @@ namespace ModernKeePass.Views
|
||||
|
||||
private void CompositeKeyUserControl_OnValidationChecked(object sender, PasswordEventArgs e)
|
||||
{
|
||||
Model.PopulateInitialData(DatabaseService.Instance, new SettingsService());
|
||||
Frame.Navigate(typeof(GroupDetailPage));
|
||||
Model.PopulateInitialData(DatabaseService.Instance, new SettingsService(), new ImportService());
|
||||
|
||||
_mainFrame.Navigate(typeof(GroupDetailPage));
|
||||
}
|
||||
|
||||
private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
var comboBox = sender as ComboBox;
|
||||
switch (comboBox?.SelectedIndex)
|
||||
{
|
||||
case 0:
|
||||
Model.ImportFormat = new CsvImportFormat();
|
||||
break;
|
||||
default:
|
||||
Model.ImportFormat = new NullImportFormat();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user