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>
|
||||||
<Compile Include="Converters\IntToSymbolConverter.cs" />
|
<Compile Include="Converters\IntToSymbolConverter.cs" />
|
||||||
<Compile Include="Exceptions\NavigationException.cs" />
|
<Compile Include="Exceptions\NavigationException.cs" />
|
||||||
|
<Compile Include="ImportFormats\CsvImportFormat.cs" />
|
||||||
|
<Compile Include="ImportFormats\NullImportFormat.cs" />
|
||||||
<Compile Include="Interfaces\IFormat.cs" />
|
<Compile Include="Interfaces\IFormat.cs" />
|
||||||
<Compile Include="Interfaces\IImportService.cs" />
|
<Compile Include="Interfaces\IImportService.cs" />
|
||||||
<Compile Include="Interfaces\IProxyInvocationHandler.cs" />
|
<Compile Include="Interfaces\IProxyInvocationHandler.cs" />
|
||||||
|
@@ -204,7 +204,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
private readonly IDatabaseService _database;
|
private readonly IDatabaseService _database;
|
||||||
private readonly IResourceService _resource;
|
private readonly IResourceService _resource;
|
||||||
private bool _isEditMode;
|
private bool _isEditMode;
|
||||||
private bool _isDirty;
|
private bool _isDirty = true;
|
||||||
private bool _isRevealPassword;
|
private bool _isRevealPassword;
|
||||||
private double _passwordLength = 25;
|
private double _passwordLength = 25;
|
||||||
private bool _isVisible = true;
|
private bool _isVisible = true;
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
using Windows.Storage;
|
using System;
|
||||||
|
using Windows.Storage;
|
||||||
using Windows.UI.Xaml.Controls;
|
using Windows.UI.Xaml.Controls;
|
||||||
|
using ModernKeePass.Converters;
|
||||||
using ModernKeePass.Interfaces;
|
using ModernKeePass.Interfaces;
|
||||||
using ModernKeePassLib;
|
using ModernKeePassLib;
|
||||||
|
|
||||||
@@ -23,14 +25,16 @@ namespace ModernKeePass.ViewModels
|
|||||||
|
|
||||||
private void CreateSampleData(IDatabaseService database)
|
private void CreateSampleData(IDatabaseService database)
|
||||||
{
|
{
|
||||||
|
var converter = new IntToSymbolConverter();
|
||||||
|
|
||||||
var bankingGroup = database.RootGroup.AddNewGroup("Banking");
|
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");
|
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");
|
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();
|
var sample1 = database.RootGroup.AddNewEntry();
|
||||||
sample1.Name = "Sample Entry";
|
sample1.Name = "Sample Entry";
|
||||||
|
@@ -32,7 +32,7 @@
|
|||||||
<HyperlinkButton Content="Select file..." Style="{StaticResource MainColorHyperlinkButton}" Click="ImportFileButton_OnClick" />
|
<HyperlinkButton Content="Select file..." Style="{StaticResource MainColorHyperlinkButton}" Click="ImportFileButton_OnClick" />
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock Text="Format" Style="{StaticResource BodyTextBlockStyle}" Margin="0,0,0,10" />
|
<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>
|
<ComboBoxItem>CSV</ComboBoxItem>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
@@ -2,7 +2,10 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Windows.Storage.Pickers;
|
using Windows.Storage.Pickers;
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
|
using Windows.UI.Xaml.Controls;
|
||||||
|
using Windows.UI.Xaml.Navigation;
|
||||||
using ModernKeePass.Events;
|
using ModernKeePass.Events;
|
||||||
|
using ModernKeePass.ImportFormats;
|
||||||
using ModernKeePass.Services;
|
using ModernKeePass.Services;
|
||||||
using ModernKeePass.ViewModels;
|
using ModernKeePass.ViewModels;
|
||||||
|
|
||||||
@@ -15,6 +18,8 @@ namespace ModernKeePass.Views
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed partial class NewDatabasePage
|
public sealed partial class NewDatabasePage
|
||||||
{
|
{
|
||||||
|
private Frame _mainFrame;
|
||||||
|
|
||||||
public NewVm Model => (NewVm)DataContext;
|
public NewVm Model => (NewVm)DataContext;
|
||||||
|
|
||||||
public NewDatabasePage()
|
public NewDatabasePage()
|
||||||
@@ -22,6 +27,12 @@ namespace ModernKeePass.Views
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnNavigatedTo(e);
|
||||||
|
_mainFrame = e.Parameter as Frame;
|
||||||
|
}
|
||||||
|
|
||||||
private async void ButtonBase_OnClick(object sender, RoutedEventArgs e)
|
private async void ButtonBase_OnClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var savePicker = new FileSavePicker
|
var savePicker = new FileSavePicker
|
||||||
@@ -52,8 +63,23 @@ namespace ModernKeePass.Views
|
|||||||
|
|
||||||
private void CompositeKeyUserControl_OnValidationChecked(object sender, PasswordEventArgs e)
|
private void CompositeKeyUserControl_OnValidationChecked(object sender, PasswordEventArgs e)
|
||||||
{
|
{
|
||||||
Model.PopulateInitialData(DatabaseService.Instance, new SettingsService());
|
Model.PopulateInitialData(DatabaseService.Instance, new SettingsService(), new ImportService());
|
||||||
Frame.Navigate(typeof(GroupDetailPage));
|
|
||||||
|
_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