Updated nuspec to target any CPU

This commit is contained in:
2017-09-15 11:24:14 +02:00
parent dd9d848618
commit a74f2c9156
19 changed files with 208 additions and 24 deletions

View File

@@ -34,7 +34,8 @@ namespace ModernKeePass
textBlock.Text = "Opened database: " + file.Name;
var database = new DatabaseVm();
database.Open(file, "test");
Frame.Navigate(typeof(GroupDetailPage), database.RootGroup);
Frame.Navigate(typeof(GroupDetailPage), database);
//Frame.Navigate(typeof(GroupDetailPage), database.RootGroup);
}
else
{

View File

@@ -114,6 +114,9 @@
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\BasicPage1.xaml.cs">
<DependentUpon>BasicPage1.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\GroupDetailPage.xaml.cs">
<DependentUpon>GroupDetailPage.xaml</DependentUpon>
</Compile>
@@ -145,14 +148,18 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Pages\BasicPage1.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\GroupDetailPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Reference Include="ModernKeePassLib, Version=2.19.0.27017, Culture=neutral, processorArchitecture=x86">
<HintPath>..\packages\ModernKeePassLib.2.19.2910\lib\x86\netstandard1.2\ModernKeePassLib.dll</HintPath>
<Reference Include="ModernKeePassLib, Version=2.19.0.20446, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ModernKeePassLib.2.19.2930\lib\netstandard1.2\ModernKeePassLib.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">

View File

@@ -0,0 +1,50 @@
<Page
x:Name="pageRoot"
x:Class="ModernKeePass.Pages.BasicPage1"
DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:ModernKeePass.Pages"
xmlns:common="using:ModernKeePass.Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<!-- TODO: Delete this line if the key AppName is declared in App.xaml -->
<x:String x:Key="AppName">My Application</x:String>
</Page.Resources>
<!--
This grid acts as a root panel for the page that defines two rows:
* Row 0 contains the back button and page title
* Row 1 contains the rest of the page layout
-->
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.ChildrenTransitions>
<TransitionCollection>
<EntranceThemeTransition/>
</TransitionCollection>
</Grid.ChildrenTransitions>
<Grid.RowDefinitions>
<RowDefinition Height="140"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Back button and page title -->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button x:Name="backButton" Margin="39,59,39,0" Command="{Binding NavigationHelper.GoBackCommand, ElementName=pageRoot}"
Style="{StaticResource NavigationBackButtonNormalStyle}"
VerticalAlignment="Top"
AutomationProperties.Name="Back"
AutomationProperties.AutomationId="BackButton"
AutomationProperties.ItemType="Navigation Button"/>
<TextBlock x:Name="pageTitle" Text="{StaticResource AppName}" Style="{StaticResource HeaderTextBlockStyle}" Grid.Column="1"
IsHitTestVisible="false" TextWrapping="NoWrap" VerticalAlignment="Bottom" Margin="0,0,30,40"/>
</Grid>
</Grid>
</Page>

View File

@@ -0,0 +1,106 @@
using ModernKeePass.Common;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Basic Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234237
namespace ModernKeePass.Pages
{
/// <summary>
/// A basic page that provides characteristics common to most applications.
/// </summary>
public sealed partial class BasicPage1 : Page
{
private NavigationHelper navigationHelper;
private ObservableDictionary defaultViewModel = new ObservableDictionary();
/// <summary>
/// This can be changed to a strongly typed view model.
/// </summary>
public ObservableDictionary DefaultViewModel
{
get { return this.defaultViewModel; }
}
/// <summary>
/// NavigationHelper is used on each page to aid in navigation and
/// process lifetime management
/// </summary>
public NavigationHelper NavigationHelper
{
get { return this.navigationHelper; }
}
public BasicPage1()
{
this.InitializeComponent();
this.navigationHelper = new NavigationHelper(this);
this.navigationHelper.LoadState += navigationHelper_LoadState;
this.navigationHelper.SaveState += navigationHelper_SaveState;
}
/// <summary>
/// Populates the page with content passed during navigation. Any saved state is also
/// provided when recreating a page from a prior session.
/// </summary>
/// <param name="sender">
/// The source of the event; typically <see cref="Common.NavigationHelper"/>
/// </param>
/// <param name="e">Event data that provides both the navigation parameter passed to
/// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
/// a dictionary of state preserved by this page during an earlier
/// session. The state will be null the first time a page is visited.</param>
private void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
{
}
/// <summary>
/// Preserves state associated with this page in case the application is suspended or the
/// page is discarded from the navigation cache. Values must conform to the serialization
/// requirements of <see cref="Common.SuspensionManager.SessionState"/>.
/// </summary>
/// <param name="sender">The source of the event; typically <see cref="Common.NavigationHelper"/></param>
/// <param name="e">Event data that provides an empty dictionary to be populated with
/// serializable state.</param>
private void navigationHelper_SaveState(object sender, SaveStateEventArgs e)
{
}
#region NavigationHelper registration
/// The methods provided in this section are simply used to allow
/// NavigationHelper to respond to the page's navigation methods.
///
/// Page specific logic should be placed in event handlers for the
/// <see cref="Common.NavigationHelper.LoadState"/>
/// and <see cref="Common.NavigationHelper.SaveState"/>.
/// The navigation parameter is available in the LoadState method
/// in addition to page state preserved during an earlier session.
protected override void OnNavigatedTo(NavigationEventArgs e)
{
navigationHelper.OnNavigatedTo(e);
}
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
navigationHelper.OnNavigatedFrom(e);
}
#endregion
}
}

View File

@@ -8,9 +8,11 @@
xmlns:ViewModels="using:ModernKeePass.ViewModels"
x:Name="pageRoot"
x:Class="ModernKeePass.Pages.GroupDetailPage"
mc:Ignorable="d"
DataContext="{Binding ViewModel, RelativeSource={RelativeSource Mode=Self}}">
mc:Ignorable="d" >
<Page.DataContext>
<ViewModels:GroupVm />
</Page.DataContext>
<Grid>
<Grid.ChildrenTransitions>
<TransitionCollection>
@@ -25,7 +27,7 @@
<Grid.Resources>
<CollectionViewSource
x:Name="itemsViewSource"
Source="{Binding Groups}"/>
Source="{Binding Path=Groups}"/>
</Grid.Resources>
<!-- Horizontal scrolling grid -->
<GridView
@@ -82,7 +84,7 @@
AutomationProperties.Name="Back"
AutomationProperties.AutomationId="BackButton"
AutomationProperties.ItemType="Navigation Button"/>
<TextBlock x:Name="pageTitle" Text="{Binding Name}" Style="{StaticResource HeaderTextBlockStyle}" Grid.Column="1"
<TextBlock x:Name="pageTitle" Text="{Binding Path=Name}" Style="{StaticResource HeaderTextBlockStyle}" Grid.Column="1"
IsHitTestVisible="false" TextWrapping="NoWrap" VerticalAlignment="Bottom" Margin="0,0,30,40"/>
</Grid>
</Grid>

View File

@@ -69,6 +69,7 @@ namespace ModernKeePass.Pages
if (e.Parameter is GroupVm)
{
ViewModel = e.Parameter as GroupVm;
ViewModel?.NotifyPropertyChanged("Name");
}
}

View File

@@ -1,4 +1,5 @@
using Windows.Storage;
using System.ComponentModel;
using Windows.Storage;
using ModernKeePassLib;
using ModernKeePassLib.Keys;
@@ -7,13 +8,15 @@ using ModernKeePassLib.Interfaces;
namespace ModernKeePass.ViewModels
{
public class DatabaseVm
public class DatabaseVm : INotifyPropertyChanged
{
private PwDatabase _database = new PwDatabase();
public string Name { get; set; }
public GroupVm RootGroup { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
public async void Open(StorageFile databaseFile, string password)
{
var key = new CompositeKey();

View File

@@ -1,13 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
using ModernKeePassLib;
namespace ModernKeePass.ViewModels
{
public class EntryVm
public class EntryVm : INotifyPropertyChanged
{
public string Title { get; private set; }
public string UserName { get; private set; }
@@ -22,5 +18,7 @@ namespace ModernKeePass.ViewModels
URL = entry.Strings.GetSafe(PwDefs.UrlField).ReadString();
Notes = entry.Strings.GetSafe(PwDefs.NotesField).ReadString();
}
public event PropertyChangedEventHandler PropertyChanged;
}
}

View File

@@ -1,10 +1,11 @@
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using ModernKeePassLib;
namespace ModernKeePass.ViewModels
{
public class GroupVm
public class GroupVm : INotifyPropertyChanged
{
public ObservableCollection<EntryVm> Entries { get; set; }
public ObservableCollection<GroupVm> Groups { get; set; }
@@ -17,7 +18,13 @@ namespace ModernKeePass.ViewModels
}
}
public GroupVm() { }
public GroupVm()
{
Name = "GroupName";
Entries = new ObservableCollection<EntryVm>();
Groups = new ObservableCollection<GroupVm>();
}
public GroupVm(PwGroup group)
{
@@ -25,5 +32,13 @@ namespace ModernKeePass.ViewModels
Entries = new ObservableCollection<EntryVm>(group.Entries.Select(e => new EntryVm(e)));
Groups = new ObservableCollection<GroupVm>(group.Groups.Select(g => new GroupVm(g)));
}
public event PropertyChangedEventHandler PropertyChanged;
public void NotifyPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}

View File

@@ -1,6 +1,6 @@
<XamlCompilerSaveState>
<ReferenceAssemblyList>
<ReferenceAssembly PathName="c:\users\gbe\source\repos\modernkeepass\packages\modernkeepasslib.2.19.2910\lib\x86\netstandard1.2\modernkeepasslib.dll" HashGuid="faaa9e31-5da0-29eb-3a86-b4eb77c4ada5" />
<ReferenceAssembly PathName="c:\users\gbe\source\repos\modernkeepass\packages\modernkeepasslib.2.19.2920\lib\netstandard1.2\modernkeepasslib.dll" HashGuid="faaa9e31-5da0-29eb-3a86-b4eb77c4ada5" />
<ReferenceAssembly PathName="c:\users\gbe\source\repos\modernkeepass\packages\system.runtime.interopservices.runtimeinformation.4.3.0\lib\win8\system.runtime.interopservices.runtimeinformation.dll" HashGuid="6560d00f-0bb0-0755-5423-c4e1bf779127" />
</ReferenceAssemblyList>
</XamlCompilerSaveState>

View File

@@ -2,7 +2,7 @@
<packages>
<package id="Microsoft.NETCore.Platforms" version="2.0.0" targetFramework="win81" />
<package id="Microsoft.NETCore.Portable.Compatibility" version="1.0.2" targetFramework="win81" />
<package id="ModernKeePassLib" version="2.19.2910" targetFramework="win81" />
<package id="ModernKeePassLib" version="2.19.2930" targetFramework="win81" />
<package id="NETStandard.Library" version="2.0.0" targetFramework="win81" />
<package id="System.Net.Requests" version="4.3.0" targetFramework="win81" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="win81" />