WIP on data binding, nothing is working...

This commit is contained in:
2017-09-12 18:20:32 +02:00
parent 4487f0343f
commit 1cd7c0411c
33 changed files with 1397 additions and 1373 deletions

View File

@@ -1,8 +1,9 @@
using ModernKeePass.Pages;
using System;
using System;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
using ModernKeePass.Pages;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace ModernKeePass
@@ -30,7 +31,7 @@ namespace ModernKeePass
{
// Application now has read/write access to the picked file
textBlock.Text = "Opened database: " + file.Name;
Frame.Navigate(typeof(DatabaseViewPage), file);
Frame.Navigate(typeof(DatabaseDetailPage), file);
}
else
{

View File

@@ -114,10 +114,13 @@
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\DatabaseViewPage.xaml.cs">
<DependentUpon>DatabaseViewPage.xaml</DependentUpon>
<Compile Include="Pages\DatabaseDetailPage.xaml.cs">
<DependentUpon>DatabaseDetailPage.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ViewModels\DatabaseVm.cs" />
<Compile Include="ViewModels\EntryVm.cs" />
<Compile Include="ViewModels\GroupVm.cs" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
@@ -141,14 +144,14 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Pages\DatabaseViewPage.xaml">
<Page Include="Pages\DatabaseDetailPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Reference Include="ModernKeePassLib, Version=2.19.0.27133, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ModernKeePassLib.2.19.0.27133\lib\netstandard1.2\ModernKeePassLib.dll</HintPath>
<Reference Include="ModernKeePassLib, Version=2.19.0.26202, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ModernKeePassLib.2.19.0.26202\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">
@@ -156,9 +159,7 @@
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Folder Include="Interfaces\" />
</ItemGroup>
<ItemGroup />
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '12.0' ">
<VisualStudioVersion>12.0</VisualStudioVersion>
</PropertyGroup>

View File

@@ -1,38 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest">
<Identity Name="204cf947-89ad-4b37-83cd-19a477e2f961"
Publisher="CN=GBE"
Version="1.0.0.0" />
<Identity Name="204cf947-89ad-4b37-83cd-19a477e2f961" Publisher="CN=GBE" Version="1.0.0.0" />
<Properties>
<DisplayName>ModernKeePass</DisplayName>
<PublisherDisplayName>GBE</PublisherDisplayName>
<PublisherDisplayName>Wismna</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Prerequisites>
<OSMinVersion>6.3.0</OSMinVersion>
<OSMaxVersionTested>6.3.0</OSMaxVersionTested>
</Prerequisites>
<Resources>
<Resource Language="x-generate"/>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="ModernKeePass.App">
<m2:VisualElements
DisplayName="ModernKeePass"
Square150x150Logo="Assets\Logo.png"
Square30x30Logo="Assets\SmallLogo.png"
Description="ModernKeePass"
ForegroundText="light"
BackgroundColor="#464646">
<m2:SplashScreen Image="Assets\SplashScreen.png" />
</m2:VisualElements>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="ModernKeePass.App">
<m2:VisualElements DisplayName="ModernKeePass" Square150x150Logo="Assets\Logo.png" Square30x30Logo="Assets\SmallLogo.png" Description="ModernKeePass" ForegroundText="light" BackgroundColor="#464646" ToastCapable="true">
<m2:SplashScreen Image="Assets\SplashScreen.png" />
</m2:VisualElements>
<Extensions>
<Extension Category="windows.fileOpenPicker">
<FileOpenPicker>
<SupportedFileTypes>
<FileType>.kdbx</FileType>
</SupportedFileTypes>
</FileOpenPicker>
</Extension>
</Extensions>
</Application>
</Applications>
<Capabilities>

View File

@@ -0,0 +1,99 @@
<Page
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"
xmlns:ViewModels="using:ModernKeePass.ViewModels"
x:Name="pageRoot"
x:Class="ModernKeePass.Pages.DatabaseDetailPage"
DataContext="{Binding ViewModel, RelativeSource={RelativeSource Self}}"
mc:Ignorable="d">
<!--<Page.DataContext>
<ViewModels:DatabaseVm />
</Page.DataContext>-->
<Page.Resources>
<!-- Collection of items displayed by this page -->
<CollectionViewSource
x:Name="itemsViewSource"
Source="{Binding Groups}"/>
</Page.Resources>
<Grid>
<Grid.DataContext>
<ViewModels:DatabaseVm/>
</Grid.DataContext>
<Grid.ChildrenTransitions>
<TransitionCollection>
<EntranceThemeTransition/>
</TransitionCollection>
</Grid.ChildrenTransitions>
<Grid.RowDefinitions>
<RowDefinition Height="140"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Horizontal scrolling grid -->
<GridView
x:Name="itemGridView"
AutomationProperties.AutomationId="ItemGridView"
AutomationProperties.Name="Groups"
TabIndex="1"
Grid.RowSpan="2"
Padding="120,126,120,50"
ItemsSource="{Binding Source={StaticResource itemsViewSource}}"
SelectionMode="None"
IsSwipeEnabled="false">
<GridView.ItemTemplate>
<DataTemplate>
<Grid Height="110" Width="480" Margin="10">
<Grid.DataContext>
<ViewModels:GroupVm/>
</Grid.DataContext>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Background="{ThemeResource ListViewItemPlaceholderBackgroundThemeBrush}" Width="110" Height="110">
<Image Stretch="UniformToFill" AutomationProperties.Name="{Binding Title}"/>
</Border>
<StackPanel Grid.Column="1" VerticalAlignment="Top" Margin="10,0,0,0">
<TextBlock Style="{StaticResource TitleTextBlockStyle}" TextWrapping="NoWrap" Text="{Binding Name}"/>
<TextBlock Style="{StaticResource CaptionTextBlockStyle}" TextWrapping="NoWrap"/>
<TextBlock Style="{StaticResource BodyTextBlockStyle}" MaxHeight="60"/>
</StackPanel>
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
<GridView.Header>
<StackPanel Width="480" Margin="0,4,14,0">
<TextBlock Margin="0,0,0,20" Style="{StaticResource SubheaderTextBlockStyle}" MaxHeight="60"/>
<Image Height="400" Margin="0,0,0,20" Stretch="UniformToFill" AutomationProperties.Name="{Binding Title}"/>
<TextBlock Margin="0,0,0,0" Style="{StaticResource BodyTextBlockStyle}"/>
</StackPanel>
</GridView.Header>
<GridView.ItemContainerStyle>
<Style TargetType="FrameworkElement">
<Setter Property="Margin" Value="52,0,0,2"/>
</Style>
</GridView.ItemContainerStyle>
</GridView>
<!-- 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="{Binding Name}" Style="{StaticResource HeaderTextBlockStyle}" Grid.Column="1"
IsHitTestVisible="false" TextWrapping="NoWrap" VerticalAlignment="Bottom" Margin="0,0,30,40"/>
</Grid>
</Grid>
</Page>

View File

@@ -1,33 +1,25 @@
using ModernKeePass.Common;
using ModernKeePassLib;
using ModernKeePassLib.Interfaces;
using ModernKeePassLib.Keys;
using ModernKeePassLib.Serialization;
using Windows.Storage;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
using System.Linq;
using System;
using ModernKeePass.ViewModels;
using Windows.Storage;
// The Hub Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=321224
// The Group Detail Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234229
namespace ModernKeePass.Pages
{
/// <summary>
/// A page that displays a grouped collection of items.
/// A page that displays an overview of a single group, including a preview of the items
/// within the group.
/// </summary>
public sealed partial class DatabaseViewPage : Page
public sealed partial class DatabaseDetailPage : Page
{
private NavigationHelper navigationHelper;
private ObservableDictionary defaultViewModel = new ObservableDictionary();
private PwDatabase _database = new PwDatabase();
private DatabaseVm viewModel = new DatabaseVm();
/// <summary>
/// This can be changed to a strongly typed view model.
/// </summary>
public ObservableDictionary DefaultViewModel
public DatabaseVm ViewModel
{
get { return this.defaultViewModel; }
get { return this.viewModel; }
}
/// <summary>
@@ -39,14 +31,14 @@ namespace ModernKeePass.Pages
get { return this.navigationHelper; }
}
public DatabaseViewPage()
public DatabaseDetailPage()
{
this.InitializeComponent();
this.navigationHelper = new NavigationHelper(this);
this.navigationHelper.LoadState += navigationHelper_LoadState;
}
/// <summary>
/// Populates the page with content passed during navigation. Any saved state is also
/// provided when recreating a page from a prior session.
@@ -60,7 +52,8 @@ namespace ModernKeePass.Pages
/// session. The state will be null the first time a page is visited.</param>
private void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
{
// TODO: Assign a collection of bindable groups to this.DefaultViewModel["Groups"]
// TODO: Assign a bindable group to this.DefaultViewModel["Group"]
// TODO: Assign a collection of bindable items to this.DefaultViewModel["Items"]
}
#region NavigationHelper registration
@@ -77,21 +70,11 @@ namespace ModernKeePass.Pages
protected override void OnNavigatedTo(NavigationEventArgs e)
{
navigationHelper.OnNavigatedTo(e);
if (e.Parameter is StorageFile)
{
var file = e.Parameter as StorageFile;
var key = new CompositeKey();
key.AddUserKey(new KcpPassword("test"));
try
{
_database.Open(IOConnectionInfo.FromPath(file.Path), key, new NullStatusLogger());
DefaultViewModel["Groups"] = _database.RootGroup.GetGroups(false).Select(g => g.Name);
}
finally
{
_database.Close();
}
viewModel.Open(file, "test");
}
}

View File

@@ -1,127 +0,0 @@
<Page
x:Name="pageRoot"
x:Class="ModernKeePass.Pages.DatabaseViewPage"
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>
<x:String x:Key="ChevronGlyph">&#xE26B;</x:String>
<!-- 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.
-->
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.ChildrenTransitions>
<TransitionCollection>
<EntranceThemeTransition/>
</TransitionCollection>
</Grid.ChildrenTransitions>
<Hub>
<Hub.Header>
<!-- Back button and page title -->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button x:Name="backButton" Margin="-1,-1,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="Top"/>
</Grid>
</Hub.Header>
<HubSection Width="780" Margin="0,0,80,0">
<HubSection.Background>
<ImageBrush Stretch="UniformToFill" />
</HubSection.Background>
</HubSection>
<HubSection Width="500" Header="Section 1">
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Image Stretch="Fill" Width="420" Height="280"/>
<TextBlock Style="{StaticResource SubheaderTextBlockStyle}" Grid.Row="1" Margin="0,10,0,0" TextWrapping="Wrap"
Text="Lorem ipsum dolor sit nonumy sed consectetuer ising elit, sed diam"/>
<TextBlock Style="{StaticResource TitleTextBlockStyle}" Grid.Row="2" Margin="0,10,0,0"
Text="Description text:"/>
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Grid.Row="3"
Text="Lorem ipsum dolor sit amet, consectetuer ising elit, sed diam nonummy nibh uismod tincidunt ut laoreet suscipit lobortis ni ut wisi quipexerci quis consequat minim veniam, quis nostrud exerci tation ullam corper. Lorem ipsum dolor sit amet, consectetuer ising elit, sed diam nonummy nibh uismod tincidunt ut laoreet suscipit lobortis ni ut wisi quipexerci quis consequat minim veniam, quis nostrud exerci tation ullam corper. "/>
</Grid>
</DataTemplate>
</HubSection>
<HubSection Width="520" Header="Section 2">
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource TitleTextBlockStyle}" Margin="0,0,0,10"
Text="Item Title" />
<TextBlock Style="{StaticResource SubheaderTextBlockStyle}" Grid.Row="1"
Text="Quisque in porta lorem dolor amet sed consectetuer ising elit, sed diam non my nibh uis mod wisi quip."/>
<TextBlock Style="{StaticResource SubtitleTextBlockStyle}" Grid.Row="2" Margin="0,20,0,0"
Text="Item Sub Title"/>
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Grid.Row="3"
Text="Lorem ipsum dolor sit amet, consectetuer ising elit, sed diam nonummy nibh uismod tincidunt ut laoreet suscipit lobortis ni ut wisi quipexerci quis consequat minim veniam, quis nostrud exerci tation ullam corper. Lorem ipsum dolor sit amet, consectetuer ising elit, sed diam nonummy nibh uismod tincidunt ut laoreet suscipit lobortis ni ut wisi quipexerci quis consequat minim veniam, quis nostrud exerci tation ullam corper."/>
</Grid>
</DataTemplate>
</HubSection>
<HubSection Header="Section 3">
<DataTemplate>
<!-- width of 400 -->
<StackPanel Orientation="Vertical">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="130"/>
<ColumnDefinition Width="5"/>
<ColumnDefinition Width="130"/>
<ColumnDefinition Width="5"/>
<ColumnDefinition Width="130"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="270"/>
<RowDefinition Height="95"/>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Image Grid.ColumnSpan="5" Stretch="Fill" Margin="0,0,0,10"/>
<Image Grid.Row="1" Stretch="Fill"/>
<Image Grid.Row="1" Grid.Column="2" Stretch="Fill"/>
<Image Grid.Row="1" Grid.Column="4" Stretch="Fill"/>
<TextBlock Style="{StaticResource TitleTextBlockStyle}" Grid.Row="2" Grid.ColumnSpan="5" Margin="0,15,0,0"
Text="Description Text:"/>
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Grid.Row="3" Grid.ColumnSpan="5"
Text="Lorem ipsum dolor sit amet, consectetuer ising elit, sed diam nonummy nibh uismod tincidunt ut laoreet suscipit lobortis ni ut wisi quipexerci quis consequat minim veniam, quis nostrud exerci tation ullam corper. Lorem ipsum dolor sit amet, consectetuer ising elit, sed diam nonummy nibh uismod tincidunt ut laoreet suscipit lobortis ni ut wisi quipexerci quis consequat minim veniam, quis nostrud exerci tation ullam corper."/>
</Grid>
</StackPanel>
</DataTemplate>
</HubSection>
</Hub>
</Grid>
</Page>

View File

@@ -0,0 +1,37 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Windows.Storage;
using ModernKeePassLib;
using ModernKeePassLib.Keys;
using ModernKeePassLib.Serialization;
using ModernKeePassLib.Interfaces;
namespace ModernKeePass.ViewModels
{
public class DatabaseVm
{
private PwDatabase _database = new PwDatabase();
public string Name { get; set; }
public ObservableCollection<GroupVm> Groups { get; set; }
public async void Open(StorageFile databaseFile, string password)
{
var key = new CompositeKey();
key.AddUserKey(new KcpPassword(password));
try
{
await _database.Open(IOConnectionInfo.FromFile(databaseFile), key, new NullStatusLogger());
if (!_database.IsOpen) return;
Name = databaseFile.DisplayName;
Groups = new ObservableCollection<GroupVm>(_database.RootGroup.Groups.Select(g => new GroupVm { Name = g.Name }));
}
finally
{
_database.Close();
}
}
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ModernKeePass.ViewModels
{
public class EntryVm
{
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ModernKeePass.ViewModels
{
public class GroupVm
{
public List<EntryVm> Entries { get; set; }
public string Name { get; set; }
}
}

View File

@@ -1,7 +1,7 @@
<XamlCompilerSaveState>
<ReferenceAssemblyList>
<LocalAssembly PathName="c:\users\gbe\source\repos\modernkeepass\modernkeepass\obj\debug\intermediatexaml\modernkeepass.exe" HashGuid="ba913411-8172-a080-2ef8-daa6762bdbba" />
<ReferenceAssembly PathName="c:\users\gbe\source\repos\modernkeepass\packages\modernkeepasslib.2.19.0.27133\lib\netstandard1.2\modernkeepasslib.dll" HashGuid="d08e360b-ca16-7b19-6f2a-08b4fd9e8331" />
<LocalAssembly PathName="c:\users\gbe\source\repos\modernkeepass\modernkeepass\obj\debug\intermediatexaml\modernkeepass.exe" HashGuid="76dc0cd8-3905-4d82-b50e-0e7de053066f" />
<ReferenceAssembly PathName="c:\users\gbe\source\repos\modernkeepass\packages\modernkeepasslib.2.19.0.26202\lib\netstandard1.2\modernkeepasslib.dll" HashGuid="29b95f3b-9b53-5341-fc4d-d6dbb7ef4dbc" />
<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

@@ -1,614 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ModernKeePass
{
public partial class App : global::Windows.UI.Xaml.Markup.IXamlMetadataProvider
{
private global::ModernKeePass.ModernKeePass_XamlTypeInfo.XamlTypeInfoProvider _provider;
public global::Windows.UI.Xaml.Markup.IXamlType GetXamlType(global::System.Type type)
{
if(_provider == null)
{
_provider = new global::ModernKeePass.ModernKeePass_XamlTypeInfo.XamlTypeInfoProvider();
}
return _provider.GetXamlTypeByType(type);
}
public global::Windows.UI.Xaml.Markup.IXamlType GetXamlType(string fullName)
{
if(_provider == null)
{
_provider = new global::ModernKeePass.ModernKeePass_XamlTypeInfo.XamlTypeInfoProvider();
}
return _provider.GetXamlTypeByName(fullName);
}
public global::Windows.UI.Xaml.Markup.XmlnsDefinition[] GetXmlnsDefinitions()
{
return new global::Windows.UI.Xaml.Markup.XmlnsDefinition[0];
}
}
}
namespace ModernKeePass.ModernKeePass_XamlTypeInfo
{
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks", "4.0.0.0")]
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal partial class XamlTypeInfoProvider
{
public global::Windows.UI.Xaml.Markup.IXamlType GetXamlTypeByType(global::System.Type type)
{
global::Windows.UI.Xaml.Markup.IXamlType xamlType;
if (_xamlTypeCacheByType.TryGetValue(type, out xamlType))
{
return xamlType;
}
int typeIndex = LookupTypeIndexByType(type);
if(typeIndex != -1)
{
xamlType = CreateXamlType(typeIndex);
}
if (xamlType != null)
{
_xamlTypeCacheByName.Add(xamlType.FullName, xamlType);
_xamlTypeCacheByType.Add(xamlType.UnderlyingType, xamlType);
}
return xamlType;
}
public global::Windows.UI.Xaml.Markup.IXamlType GetXamlTypeByName(string typeName)
{
if (string.IsNullOrEmpty(typeName))
{
return null;
}
global::Windows.UI.Xaml.Markup.IXamlType xamlType;
if (_xamlTypeCacheByName.TryGetValue(typeName, out xamlType))
{
return xamlType;
}
int typeIndex = LookupTypeIndexByName(typeName);
if(typeIndex != -1)
{
xamlType = CreateXamlType(typeIndex);
}
if (xamlType != null)
{
_xamlTypeCacheByName.Add(xamlType.FullName, xamlType);
_xamlTypeCacheByType.Add(xamlType.UnderlyingType, xamlType);
}
return xamlType;
}
public global::Windows.UI.Xaml.Markup.IXamlMember GetMemberByLongName(string longMemberName)
{
if (string.IsNullOrEmpty(longMemberName))
{
return null;
}
global::Windows.UI.Xaml.Markup.IXamlMember xamlMember;
if (_xamlMembers.TryGetValue(longMemberName, out xamlMember))
{
return xamlMember;
}
xamlMember = CreateXamlMember(longMemberName);
if (xamlMember != null)
{
_xamlMembers.Add(longMemberName, xamlMember);
}
return xamlMember;
}
global::System.Collections.Generic.Dictionary<string, global::Windows.UI.Xaml.Markup.IXamlType>
_xamlTypeCacheByName = new global::System.Collections.Generic.Dictionary<string, global::Windows.UI.Xaml.Markup.IXamlType>();
global::System.Collections.Generic.Dictionary<global::System.Type, global::Windows.UI.Xaml.Markup.IXamlType>
_xamlTypeCacheByType = new global::System.Collections.Generic.Dictionary<global::System.Type, global::Windows.UI.Xaml.Markup.IXamlType>();
global::System.Collections.Generic.Dictionary<string, global::Windows.UI.Xaml.Markup.IXamlMember>
_xamlMembers = new global::System.Collections.Generic.Dictionary<string, global::Windows.UI.Xaml.Markup.IXamlMember>();
string[] _typeNameTable = null;
global::System.Type[] _typeTable = null;
private void InitTypeTables()
{
_typeNameTable = new string[9];
_typeNameTable[0] = "ModernKeePass.MainPage";
_typeNameTable[1] = "Windows.UI.Xaml.Controls.Page";
_typeNameTable[2] = "Windows.UI.Xaml.Controls.UserControl";
_typeNameTable[3] = "ModernKeePass.Pages.DatabaseViewPage";
_typeNameTable[4] = "ModernKeePass.Common.ObservableDictionary";
_typeNameTable[5] = "Object";
_typeNameTable[6] = "String";
_typeNameTable[7] = "ModernKeePass.Common.NavigationHelper";
_typeNameTable[8] = "Windows.UI.Xaml.DependencyObject";
_typeTable = new global::System.Type[9];
_typeTable[0] = typeof(global::ModernKeePass.MainPage);
_typeTable[1] = typeof(global::Windows.UI.Xaml.Controls.Page);
_typeTable[2] = typeof(global::Windows.UI.Xaml.Controls.UserControl);
_typeTable[3] = typeof(global::ModernKeePass.Pages.DatabaseViewPage);
_typeTable[4] = typeof(global::ModernKeePass.Common.ObservableDictionary);
_typeTable[5] = typeof(global::System.Object);
_typeTable[6] = typeof(global::System.String);
_typeTable[7] = typeof(global::ModernKeePass.Common.NavigationHelper);
_typeTable[8] = typeof(global::Windows.UI.Xaml.DependencyObject);
}
private int LookupTypeIndexByName(string typeName)
{
if (_typeNameTable == null)
{
InitTypeTables();
}
for (int i=0; i<_typeNameTable.Length; i++)
{
if(0 == string.CompareOrdinal(_typeNameTable[i], typeName))
{
return i;
}
}
return -1;
}
private int LookupTypeIndexByType(global::System.Type type)
{
if (_typeTable == null)
{
InitTypeTables();
}
for(int i=0; i<_typeTable.Length; i++)
{
if(type == _typeTable[i])
{
return i;
}
}
return -1;
}
private object Activate_0_MainPage() { return new global::ModernKeePass.MainPage(); }
private object Activate_3_DatabaseViewPage() { return new global::ModernKeePass.Pages.DatabaseViewPage(); }
private object Activate_4_ObservableDictionary() { return new global::ModernKeePass.Common.ObservableDictionary(); }
private void MapAdd_4_ObservableDictionary(object instance, object key, object item)
{
var collection = (global::System.Collections.Generic.IDictionary<global::System.String, global::System.Object>)instance;
var newKey = (global::System.String)key;
var newItem = (global::System.Object)item;
collection.Add(newKey, newItem);
}
private global::Windows.UI.Xaml.Markup.IXamlType CreateXamlType(int typeIndex)
{
global::ModernKeePass.ModernKeePass_XamlTypeInfo.XamlSystemBaseType xamlType = null;
global::ModernKeePass.ModernKeePass_XamlTypeInfo.XamlUserType userType;
string typeName = _typeNameTable[typeIndex];
global::System.Type type = _typeTable[typeIndex];
switch (typeIndex)
{
case 0: // ModernKeePass.MainPage
userType = new global::ModernKeePass.ModernKeePass_XamlTypeInfo.XamlUserType(this, typeName, type, GetXamlTypeByName("Windows.UI.Xaml.Controls.Page"));
userType.Activator = Activate_0_MainPage;
userType.SetIsLocalType();
xamlType = userType;
break;
case 1: // Windows.UI.Xaml.Controls.Page
xamlType = new global::ModernKeePass.ModernKeePass_XamlTypeInfo.XamlSystemBaseType(typeName, type);
break;
case 2: // Windows.UI.Xaml.Controls.UserControl
xamlType = new global::ModernKeePass.ModernKeePass_XamlTypeInfo.XamlSystemBaseType(typeName, type);
break;
case 3: // ModernKeePass.Pages.DatabaseViewPage
userType = new global::ModernKeePass.ModernKeePass_XamlTypeInfo.XamlUserType(this, typeName, type, GetXamlTypeByName("Windows.UI.Xaml.Controls.Page"));
userType.Activator = Activate_3_DatabaseViewPage;
userType.AddMemberName("DefaultViewModel");
userType.AddMemberName("NavigationHelper");
userType.SetIsLocalType();
xamlType = userType;
break;
case 4: // ModernKeePass.Common.ObservableDictionary
userType = new global::ModernKeePass.ModernKeePass_XamlTypeInfo.XamlUserType(this, typeName, type, GetXamlTypeByName("Object"));
userType.DictionaryAdd = MapAdd_4_ObservableDictionary;
userType.SetIsReturnTypeStub();
userType.SetIsLocalType();
xamlType = userType;
break;
case 5: // Object
xamlType = new global::ModernKeePass.ModernKeePass_XamlTypeInfo.XamlSystemBaseType(typeName, type);
break;
case 6: // String
xamlType = new global::ModernKeePass.ModernKeePass_XamlTypeInfo.XamlSystemBaseType(typeName, type);
break;
case 7: // ModernKeePass.Common.NavigationHelper
userType = new global::ModernKeePass.ModernKeePass_XamlTypeInfo.XamlUserType(this, typeName, type, GetXamlTypeByName("Windows.UI.Xaml.DependencyObject"));
userType.SetIsReturnTypeStub();
userType.SetIsLocalType();
xamlType = userType;
break;
case 8: // Windows.UI.Xaml.DependencyObject
xamlType = new global::ModernKeePass.ModernKeePass_XamlTypeInfo.XamlSystemBaseType(typeName, type);
break;
}
return xamlType;
}
private object get_0_DatabaseViewPage_DefaultViewModel(object instance)
{
var that = (global::ModernKeePass.Pages.DatabaseViewPage)instance;
return that.DefaultViewModel;
}
private object get_1_DatabaseViewPage_NavigationHelper(object instance)
{
var that = (global::ModernKeePass.Pages.DatabaseViewPage)instance;
return that.NavigationHelper;
}
private global::Windows.UI.Xaml.Markup.IXamlMember CreateXamlMember(string longMemberName)
{
global::ModernKeePass.ModernKeePass_XamlTypeInfo.XamlMember xamlMember = null;
global::ModernKeePass.ModernKeePass_XamlTypeInfo.XamlUserType userType;
switch (longMemberName)
{
case "ModernKeePass.Pages.DatabaseViewPage.DefaultViewModel":
userType = (global::ModernKeePass.ModernKeePass_XamlTypeInfo.XamlUserType)GetXamlTypeByName("ModernKeePass.Pages.DatabaseViewPage");
xamlMember = new global::ModernKeePass.ModernKeePass_XamlTypeInfo.XamlMember(this, "DefaultViewModel", "ModernKeePass.Common.ObservableDictionary");
xamlMember.Getter = get_0_DatabaseViewPage_DefaultViewModel;
xamlMember.SetIsReadOnly();
break;
case "ModernKeePass.Pages.DatabaseViewPage.NavigationHelper":
userType = (global::ModernKeePass.ModernKeePass_XamlTypeInfo.XamlUserType)GetXamlTypeByName("ModernKeePass.Pages.DatabaseViewPage");
xamlMember = new global::ModernKeePass.ModernKeePass_XamlTypeInfo.XamlMember(this, "NavigationHelper", "ModernKeePass.Common.NavigationHelper");
xamlMember.Getter = get_1_DatabaseViewPage_NavigationHelper;
xamlMember.SetIsReadOnly();
break;
}
return xamlMember;
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks", "4.0.0.0")]
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal class XamlSystemBaseType : global::Windows.UI.Xaml.Markup.IXamlType
{
string _fullName;
global::System.Type _underlyingType;
public XamlSystemBaseType(string fullName, global::System.Type underlyingType)
{
_fullName = fullName;
_underlyingType = underlyingType;
}
public string FullName { get { return _fullName; } }
public global::System.Type UnderlyingType
{
get
{
return _underlyingType;
}
}
virtual public global::Windows.UI.Xaml.Markup.IXamlType BaseType { get { throw new global::System.NotImplementedException(); } }
virtual public global::Windows.UI.Xaml.Markup.IXamlMember ContentProperty { get { throw new global::System.NotImplementedException(); } }
virtual public global::Windows.UI.Xaml.Markup.IXamlMember GetMember(string name) { throw new global::System.NotImplementedException(); }
virtual public bool IsArray { get { throw new global::System.NotImplementedException(); } }
virtual public bool IsCollection { get { throw new global::System.NotImplementedException(); } }
virtual public bool IsConstructible { get { throw new global::System.NotImplementedException(); } }
virtual public bool IsDictionary { get { throw new global::System.NotImplementedException(); } }
virtual public bool IsMarkupExtension { get { throw new global::System.NotImplementedException(); } }
virtual public bool IsBindable { get { throw new global::System.NotImplementedException(); } }
virtual public bool IsReturnTypeStub { get { throw new global::System.NotImplementedException(); } }
virtual public bool IsLocalType { get { throw new global::System.NotImplementedException(); } }
virtual public global::Windows.UI.Xaml.Markup.IXamlType ItemType { get { throw new global::System.NotImplementedException(); } }
virtual public global::Windows.UI.Xaml.Markup.IXamlType KeyType { get { throw new global::System.NotImplementedException(); } }
virtual public object ActivateInstance() { throw new global::System.NotImplementedException(); }
virtual public void AddToMap(object instance, object key, object item) { throw new global::System.NotImplementedException(); }
virtual public void AddToVector(object instance, object item) { throw new global::System.NotImplementedException(); }
virtual public void RunInitializer() { throw new global::System.NotImplementedException(); }
virtual public object CreateFromString(string input) { throw new global::System.NotImplementedException(); }
}
internal delegate object Activator();
internal delegate void AddToCollection(object instance, object item);
internal delegate void AddToDictionary(object instance, object key, object item);
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks", "4.0.0.0")]
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal class XamlUserType : global::ModernKeePass.ModernKeePass_XamlTypeInfo.XamlSystemBaseType
{
global::ModernKeePass.ModernKeePass_XamlTypeInfo.XamlTypeInfoProvider _provider;
global::Windows.UI.Xaml.Markup.IXamlType _baseType;
bool _isArray;
bool _isMarkupExtension;
bool _isBindable;
bool _isReturnTypeStub;
bool _isLocalType;
string _contentPropertyName;
string _itemTypeName;
string _keyTypeName;
global::System.Collections.Generic.Dictionary<string, string> _memberNames;
global::System.Collections.Generic.Dictionary<string, object> _enumValues;
public XamlUserType(global::ModernKeePass.ModernKeePass_XamlTypeInfo.XamlTypeInfoProvider provider, string fullName, global::System.Type fullType, global::Windows.UI.Xaml.Markup.IXamlType baseType)
:base(fullName, fullType)
{
_provider = provider;
_baseType = baseType;
}
// --- Interface methods ----
override public global::Windows.UI.Xaml.Markup.IXamlType BaseType { get { return _baseType; } }
override public bool IsArray { get { return _isArray; } }
override public bool IsCollection { get { return (CollectionAdd != null); } }
override public bool IsConstructible { get { return (Activator != null); } }
override public bool IsDictionary { get { return (DictionaryAdd != null); } }
override public bool IsMarkupExtension { get { return _isMarkupExtension; } }
override public bool IsBindable { get { return _isBindable; } }
override public bool IsReturnTypeStub { get { return _isReturnTypeStub; } }
override public bool IsLocalType { get { return _isLocalType; } }
override public global::Windows.UI.Xaml.Markup.IXamlMember ContentProperty
{
get { return _provider.GetMemberByLongName(_contentPropertyName); }
}
override public global::Windows.UI.Xaml.Markup.IXamlType ItemType
{
get { return _provider.GetXamlTypeByName(_itemTypeName); }
}
override public global::Windows.UI.Xaml.Markup.IXamlType KeyType
{
get { return _provider.GetXamlTypeByName(_keyTypeName); }
}
override public global::Windows.UI.Xaml.Markup.IXamlMember GetMember(string name)
{
if (_memberNames == null)
{
return null;
}
string longName;
if (_memberNames.TryGetValue(name, out longName))
{
return _provider.GetMemberByLongName(longName);
}
return null;
}
override public object ActivateInstance()
{
return Activator();
}
override public void AddToMap(object instance, object key, object item)
{
DictionaryAdd(instance, key, item);
}
override public void AddToVector(object instance, object item)
{
CollectionAdd(instance, item);
}
override public void RunInitializer()
{
System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(UnderlyingType.TypeHandle);
}
override public object CreateFromString(string input)
{
if (_enumValues != null)
{
int value = 0;
string[] valueParts = input.Split(',');
foreach (string valuePart in valueParts)
{
object partValue;
int enumFieldValue = 0;
try
{
if (_enumValues.TryGetValue(valuePart.Trim(), out partValue))
{
enumFieldValue = global::System.Convert.ToInt32(partValue);
}
else
{
try
{
enumFieldValue = global::System.Convert.ToInt32(valuePart.Trim());
}
catch( global::System.FormatException )
{
foreach( string key in _enumValues.Keys )
{
if( string.Compare(valuePart.Trim(), key, global::System.StringComparison.OrdinalIgnoreCase) == 0 )
{
if( _enumValues.TryGetValue(key.Trim(), out partValue) )
{
enumFieldValue = global::System.Convert.ToInt32(partValue);
break;
}
}
}
}
}
value |= enumFieldValue;
}
catch( global::System.FormatException )
{
throw new global::System.ArgumentException(input, FullName);
}
}
return value;
}
throw new global::System.ArgumentException(input, FullName);
}
// --- End of Interface methods
public Activator Activator { get; set; }
public AddToCollection CollectionAdd { get; set; }
public AddToDictionary DictionaryAdd { get; set; }
public void SetContentPropertyName(string contentPropertyName)
{
_contentPropertyName = contentPropertyName;
}
public void SetIsArray()
{
_isArray = true;
}
public void SetIsMarkupExtension()
{
_isMarkupExtension = true;
}
public void SetIsBindable()
{
_isBindable = true;
}
public void SetIsReturnTypeStub()
{
_isReturnTypeStub = true;
}
public void SetIsLocalType()
{
_isLocalType = true;
}
public void SetItemTypeName(string itemTypeName)
{
_itemTypeName = itemTypeName;
}
public void SetKeyTypeName(string keyTypeName)
{
_keyTypeName = keyTypeName;
}
public void AddMemberName(string shortName)
{
if(_memberNames == null)
{
_memberNames = new global::System.Collections.Generic.Dictionary<string,string>();
}
_memberNames.Add(shortName, FullName + "." + shortName);
}
public void AddEnumValue(string name, object value)
{
if (_enumValues == null)
{
_enumValues = new global::System.Collections.Generic.Dictionary<string, object>();
}
_enumValues.Add(name, value);
}
}
internal delegate object Getter(object instance);
internal delegate void Setter(object instance, object value);
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks", "4.0.0.0")]
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal class XamlMember : global::Windows.UI.Xaml.Markup.IXamlMember
{
global::ModernKeePass.ModernKeePass_XamlTypeInfo.XamlTypeInfoProvider _provider;
string _name;
bool _isAttachable;
bool _isDependencyProperty;
bool _isReadOnly;
string _typeName;
string _targetTypeName;
public XamlMember(global::ModernKeePass.ModernKeePass_XamlTypeInfo.XamlTypeInfoProvider provider, string name, string typeName)
{
_name = name;
_typeName = typeName;
_provider = provider;
}
public string Name { get { return _name; } }
public global::Windows.UI.Xaml.Markup.IXamlType Type
{
get { return _provider.GetXamlTypeByName(_typeName); }
}
public void SetTargetTypeName(string targetTypeName)
{
_targetTypeName = targetTypeName;
}
public global::Windows.UI.Xaml.Markup.IXamlType TargetType
{
get { return _provider.GetXamlTypeByName(_targetTypeName); }
}
public void SetIsAttachable() { _isAttachable = true; }
public bool IsAttachable { get { return _isAttachable; } }
public void SetIsDependencyProperty() { _isDependencyProperty = true; }
public bool IsDependencyProperty { get { return _isDependencyProperty; } }
public void SetIsReadOnly() { _isReadOnly = true; }
public bool IsReadOnly { get { return _isReadOnly; } }
public Getter Getter { get; set; }
public object GetValue(object instance)
{
if (Getter != null)
return Getter(instance);
else
throw new global::System.InvalidOperationException("GetValue");
}
public Setter Setter { get; set; }
public void SetValue(object instance, object value)
{
if (Setter != null)
Setter(instance, value);
else
throw new global::System.InvalidOperationException("SetValue");
}
}
}

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="win81" />
<package id="Microsoft.NETCore.Platforms" version="2.0.0" targetFramework="win81" />
<package id="Microsoft.NETCore.Portable.Compatibility" version="1.0.1" targetFramework="win81" />
<package id="ModernKeePassLib" version="2.19.0.27133" targetFramework="win81" />
<package id="ModernKeePassLib" version="2.19.0.26202" targetFramework="win81" />
<package id="NETStandard.Library" version="2.0.0" targetFramework="win81" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="win81" />
<package id="System.Runtime.WindowsRuntime" version="4.3.0" targetFramework="win81" />