diff options
author | Jason Smith <jason.smith@xamarin.com> | 2016-04-24 12:25:26 -0400 |
---|---|---|
committer | Rui Marinho <me@ruimarinho.net> | 2016-04-24 12:25:26 -0400 |
commit | 5907152c50ee2c658b266f2804e6b383bb15a6f1 (patch) | |
tree | 9beb907623359723456c5c03b08922bebc4f41f3 | |
parent | feac1ba3ed6df5e27b3fa2076bd15c190cbacd1c (diff) | |
download | xamarin-forms-5907152c50ee2c658b266f2804e6b383bb15a6f1.tar.gz xamarin-forms-5907152c50ee2c658b266f2804e6b383bb15a6f1.tar.bz2 xamarin-forms-5907152c50ee2c658b266f2804e6b383bb15a6f1.zip |
Evolve feature branch (#117)
* Initial import of evolve features
* [Android] Add Xamarin.Forms.Platform.Android.AppLinks project
* [iOS] Fix issues with c# 6 features on iOS AppLinks
* Added naive stanza to update-docs-windows.bat to produce Pages docs. Not tested. (#69)
* Update packages
* Add AppLinks android nuspec and fix linker issues
* Fix build
* Fix nusepc
* Fix nuspec
* Update android support nugets to 23.2.1
* Update Xamarin.UITest
* Add CardView
* [iOS] Fix app link for CoreSpotlight
* [Android] Update AppLinks android support libs
* Add Newtonsoft.Json dependency to nuspec
* Fix NRE when setting ControlTemplate to null
* Move to ModernHttpClient for download
* Try fix build
* Preserve android app links
* Fix margin issue
* General coding and simple fixes
169 files changed, 6290 insertions, 11 deletions
diff --git a/.nuspec/Xamarin.Forms.AppLinks.nuspec b/.nuspec/Xamarin.Forms.AppLinks.nuspec new file mode 100644 index 00000000..05f679df --- /dev/null +++ b/.nuspec/Xamarin.Forms.AppLinks.nuspec @@ -0,0 +1,30 @@ +<?xml version="1.0"?> +<package > + <metadata> + <id>Xamarin.Forms.AppLinks$IdAppend$</id> + <version>1.0.0</version> + <authors>Xamarin Inc.</authors> + <owners>Xamarin Inc.</owners> + <tags>xamarin forms applinks xamarinforms xamarin.forms</tags> + <licenseUrl>http://download.xamarin.com/content/licenses/Xamarin.Forms.rtf</licenseUrl> + <iconUrl>http://xamarin.com/content/images/nuget/xamarin.png</iconUrl> + <projectUrl>http://xamarin.com/forms</projectUrl> + <requireLicenseAcceptance>false</requireLicenseAcceptance> + <description>Add support for deep linking and indexing app content using Xamarin.Forms on the Android Platform</description> + <copyright>Copyright 2013-2016</copyright> + <dependencies> + <group targetFramework="MonoAndroid10"> + <dependency id="Xamarin.Android.Support.v4" version="[23.3.0]"/> + <dependency id="Xamarin.GooglePlayServices.AppIndexing" version="[29.0.0.1]"/> + </group> + </dependencies> + <references> + <group targetFramework="MonoAndroid10"> + <reference file="Xamarin.Forms.Platform.Android.AppLinks.dll" /> + </group> + </references> + </metadata> + <files> + <file src="..\Xamarin.Forms.Platform.Android.AppLinks\bin\$Configuration$\Xamarin.Forms.Platform.Android.AppLinks.dll" target="lib\MonoAndroid10" /> + </files> +</package> diff --git a/.nuspec/Xamarin.Forms.Pages.nuspec b/.nuspec/Xamarin.Forms.Pages.nuspec new file mode 100644 index 00000000..aad47165 --- /dev/null +++ b/.nuspec/Xamarin.Forms.Pages.nuspec @@ -0,0 +1,68 @@ +<?xml version="1.0"?> +<package > + <metadata> + <id>Xamarin.Forms.Pages$IdAppend$</id> + <version>$version$</version> + <authors>Xamarin, Inc.</authors> + <owners>Xamarin, Inc.</owners> + <licenseUrl>http://download.xamarin.com/content/licenses/Xamarin.Forms.rtf</licenseUrl> + <iconUrl>http://xamarin.com/content/images/nuget/xamarin.png</iconUrl> + <projectUrl>http://xamarin.com/forms</projectUrl> + <requireLicenseAcceptance>false</requireLicenseAcceptance> + <description>Pre-built themeable pages for Xamarin.Forms</description> + <copyright>Copyright 2013-2016</copyright> + <dependencies> + <group> + <dependency id="Xamarin.Forms$IdAppend$" version="$version$"/> + <dependency id="Newtonsoft.Json" version="8.0.3"/> + </group> + </dependencies> + <references> + <group targetFramework="portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10"> + <reference file="Xamarin.Forms.Pages.dll" /> + </group> + <group targetFramework="Xamarin.iOS10"> + <reference file="Xamarin.Forms.Pages.dll" /> + </group> + <group targetFramework="MonoTouch10"> + <reference file="Xamarin.Forms.Pages.dll" /> + </group> + <group targetFramework="MonoAndroid10"> + <reference file="Xamarin.Forms.Pages.dll" /> + </group> + <group targetFramework="win81"> + <reference file="Xamarin.Forms.Pages.dll" /> + </group> + <group targetFramework="wpa81"> + <reference file="Xamarin.Forms.Pages.dll" /> + </group> + <group targetFramework="uap10.0"> + <reference file="Xamarin.Forms.Pages.dll" /> + </group> + <group targetFramework="WP80"> + <reference file="Xamarin.Forms.Pages.dll" /> + </group> + </references> + </metadata> + <files> + <file src="..\Xamarin.Forms.Pages\bin\$Configuration$\Xamarin.Forms.Pages.dll" target="lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10" /> + + <file src="..\Xamarin.Forms.Pages\bin\$Configuration$\Xamarin.Forms.Pages.dll" target="lib\MonoAndroid10" /> + + <file src="..\Xamarin.Forms.Pages\bin\$Configuration$\Xamarin.Forms.Pages.dll" target="lib\Xamarin.iOS10" /> + + <file src="..\Xamarin.Forms.Pages\bin\$Configuration$\Xamarin.Forms.Pages.dll" target="lib\MonoTouch10" /> + + <file src="..\Xamarin.Forms.Pages\bin\$Configuration$\Xamarin.Forms.Pages.dll" target="lib\WP80" /> + + <!--UWP--> + <file src="..\Xamarin.Forms.Pages\bin\$Configuration$\Xamarin.Forms.Pages.dll" target="lib\uap10.0" /> + + <!--WinRT Phone--> + <file src="..\Xamarin.Forms.Pages\bin\$Configuration$\Xamarin.Forms.Pages.dll" target="lib\wpa81" /> + + <!--WinRT Tablet--> + <file src="..\Xamarin.Forms.Pages\bin\$Configuration$\Xamarin.Forms.Pages.dll" target="lib\win81" /> + + </files> +</package> diff --git a/PagesGallery/PagesGallery.Droid/Assets/AboutAssets.txt b/PagesGallery/PagesGallery.Droid/Assets/AboutAssets.txt new file mode 100644 index 00000000..5ddf0872 --- /dev/null +++ b/PagesGallery/PagesGallery.Droid/Assets/AboutAssets.txt @@ -0,0 +1,19 @@ +Any raw assets you want to be deployed with your application can be placed in +this directory (and child directories) and given a Build Action of "AndroidAsset". + +These files will be deployed with you package and will be accessible using Android's +AssetManager, like this: + +public class ReadAsset : Activity +{ + protected override void OnCreate (Bundle bundle) + { + base.OnCreate (bundle); + + InputStream input = Assets.Open ("my_asset.txt"); + } +} + +Additionally, some Android functions will automatically load asset files: + +Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); diff --git a/PagesGallery/PagesGallery.Droid/MainActivity.cs b/PagesGallery/PagesGallery.Droid/MainActivity.cs new file mode 100644 index 00000000..b991250c --- /dev/null +++ b/PagesGallery/PagesGallery.Droid/MainActivity.cs @@ -0,0 +1,24 @@ +using Android.App; +using Android.Content.PM; +using Android.OS; +using Xamarin.Forms; +using Xamarin.Forms.Platform.Android; + +namespace PagesGallery.Droid +{ + [Activity(Label = "PagesGallery", Theme = "@style/MyTheme", Icon = "@drawable/icon", MainLauncher = true, + ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] + public class MainActivity : FormsAppCompatActivity + { + protected override void OnCreate(Bundle bundle) + { + ToolbarResource = Resource.Layout.Toolbar; + TabLayoutResource = Resource.Layout.Tabbar; + + base.OnCreate(bundle); + + Forms.Init(this, bundle); + LoadApplication(new App()); + } + } +}
\ No newline at end of file diff --git a/PagesGallery/PagesGallery.Droid/PagesGallery.Droid.csproj b/PagesGallery/PagesGallery.Droid/PagesGallery.Droid.csproj new file mode 100644 index 00000000..02e1434e --- /dev/null +++ b/PagesGallery/PagesGallery.Droid/PagesGallery.Droid.csproj @@ -0,0 +1,172 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.30703</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}</ProjectGuid> + <ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>PagesGallery.Droid</RootNamespace> + <AssemblyName>PagesGallery.Droid</AssemblyName> + <FileAlignment>512</FileAlignment> + <AndroidApplication>true</AndroidApplication> + <AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile> + <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies> + <AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest> + <AndroidUseLatestPlatformSdk>true</AndroidUseLatestPlatformSdk> + <TargetFrameworkVersion>v6.0</TargetFrameworkVersion> + <AndroidSupportedAbis>armeabi,armeabi-v7a,x86</AndroidSupportedAbis> + <AndroidStoreUncompressedFileExtensions /> + <MandroidI18n /> + <JavaMaximumHeapSize /> + <JavaOptions /> + <NuGetPackageImportStamp> + </NuGetPackageImportStamp> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <AndroidUseSharedRuntime>True</AndroidUseSharedRuntime> + <AndroidLinkMode>None</AndroidLinkMode> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <AndroidUseSharedRuntime>False</AndroidUseSharedRuntime> + <AndroidLinkMode>SdkOnly</AndroidLinkMode> + </PropertyGroup> + <ItemGroup> + <Reference Include="ModernHttpClient, Version=2.4.2.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\modernhttpclient.2.4.2\lib\MonoAndroid\ModernHttpClient.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Mono.Android" /> + <Reference Include="mscorlib" /> + <Reference Include="OkHttp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\modernhttpclient.2.4.2\lib\MonoAndroid\OkHttp.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Xml" /> + <Reference Include="Xamarin.Android.Support.Animated.Vector.Drawable, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.Animated.Vector.Drawable.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Xamarin.Android.Support.Design, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Xamarin.Android.Support.Design.23.3.0\lib\MonoAndroid43\Xamarin.Android.Support.Design.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Xamarin.Android.Support.v4, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Xamarin.Android.Support.v4.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v4.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Xamarin.Android.Support.v7.AppCompat, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Xamarin.Android.Support.v7.AppCompat.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.AppCompat.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Xamarin.Android.Support.v7.CardView, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Xamarin.Android.Support.v7.CardView.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.CardView.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Xamarin.Android.Support.v7.MediaRouter, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Xamarin.Android.Support.v7.MediaRouter.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.MediaRouter.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Xamarin.Android.Support.v7.RecyclerView, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Xamarin.Android.Support.v7.RecyclerView.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.RecyclerView.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Xamarin.Android.Support.Vector.Drawable, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.Vector.Drawable.dll</HintPath> + <Private>True</Private> + </Reference> + </ItemGroup> + <ItemGroup> + <Compile Include="MainActivity.cs" /> + <Compile Include="Resources\Resource.Designer.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="app.config" /> + <None Include="packages.config" /> + <None Include="Resources\AboutResources.txt" /> + <None Include="Assets\AboutAssets.txt" /> + <AndroidResource Include="Resources\layout\Tabbar.axml"> + <SubType>Designer</SubType> + </AndroidResource> + <AndroidResource Include="Resources\layout\Toolbar.axml"> + <SubType>Designer</SubType> + </AndroidResource> + </ItemGroup> + <ItemGroup> + <AndroidResource Include="Resources\drawable\icon.png" /> + <AndroidResource Include="Resources\drawable-hdpi\icon.png" /> + <AndroidResource Include="Resources\drawable-xhdpi\icon.png" /> + <AndroidResource Include="Resources\drawable-xxhdpi\icon.png" /> + </ItemGroup> + <ItemGroup> + <None Include="Properties\AndroidManifest.xml" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\Stubs\Xamarin.Forms.Platform.Android\Xamarin.Forms.Platform.Android %28Forwarders%29.csproj"> + <Project>{6e53feb1-1100-46ae-8013-17bba35cc197}</Project> + <Name>Xamarin.Forms.Platform.Android %28Forwarders%29</Name> + </ProjectReference> + <ProjectReference Include="..\..\Xamarin.Forms.Core\Xamarin.Forms.Core.csproj"> + <Project>{57b8b73d-c3b5-4c42-869e-7b2f17d354ac}</Project> + <Name>Xamarin.Forms.Core</Name> + </ProjectReference> + <ProjectReference Include="..\..\Xamarin.Forms.Pages\Xamarin.Forms.Pages.csproj"> + <Project>{d6133dbd-6c60-4bd5-bea2-07e0a3927c31}</Project> + <Name>Xamarin.Forms.Pages</Name> + </ProjectReference> + <ProjectReference Include="..\..\Xamarin.Forms.Platform.Android.FormsViewGroup\Xamarin.Forms.Platform.Android.FormsViewGroup.csproj"> + <Project>{3b72465b-acae-43ae-9327-10f372fe5f80}</Project> + <Name>Xamarin.Forms.Platform.Android.FormsViewGroup</Name> + </ProjectReference> + <ProjectReference Include="..\..\Xamarin.Forms.Platform.Android\Xamarin.Forms.Platform.Android.csproj"> + <Project>{0e16e70a-d6dd-4323-ad5d-363abff42d6a}</Project> + <Name>Xamarin.Forms.Platform.Android</Name> + </ProjectReference> + <ProjectReference Include="..\..\Xamarin.Forms.Xaml\Xamarin.Forms.Xaml.csproj"> + <Project>{9db2f292-8034-4e06-89ad-98bbda4306b9}</Project> + <Name>Xamarin.Forms.Xaml</Name> + </ProjectReference> + <ProjectReference Include="..\PagesGallery\PagesGallery.csproj"> + <Name>PagesGallery</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <AndroidResource Include="Resources\values\styles.xml" /> + </ItemGroup> + <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> + <Import Project="..\..\.nuspec\Xamarin.Forms.targets" /> + <Import Project="..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" /> + <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> + <PropertyGroup> + <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> + </PropertyGroup> + <Error Condition="!Exists('..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets'))" /> + </Target> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project>
\ No newline at end of file diff --git a/PagesGallery/PagesGallery.Droid/Properties/AndroidManifest.xml b/PagesGallery/PagesGallery.Droid/Properties/AndroidManifest.xml new file mode 100644 index 00000000..1b619fc0 --- /dev/null +++ b/PagesGallery/PagesGallery.Droid/Properties/AndroidManifest.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android"> + <uses-sdk android:minSdkVersion="15" /> + <application></application> +</manifest> diff --git a/PagesGallery/PagesGallery.Droid/Properties/AssemblyInfo.cs b/PagesGallery/PagesGallery.Droid/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..95627221 --- /dev/null +++ b/PagesGallery/PagesGallery.Droid/Properties/AssemblyInfo.cs @@ -0,0 +1,34 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Android.App; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle ("PagesGallery.Droid")] +[assembly: AssemblyDescription ("")] +[assembly: AssemblyConfiguration ("")] +[assembly: AssemblyCompany ("")] +[assembly: AssemblyProduct ("PagesGallery.Droid")] +[assembly: AssemblyCopyright ("Copyright © 2014")] +[assembly: AssemblyTrademark ("")] +[assembly: AssemblyCulture ("")] +[assembly: ComVisible (false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion ("1.0.0.0")] +[assembly: AssemblyFileVersion ("1.0.0.0")] + +// Add some common permissions, these can be removed if not needed +[assembly: UsesPermission (Android.Manifest.Permission.Internet)] +[assembly: UsesPermission (Android.Manifest.Permission.WriteExternalStorage)] diff --git a/PagesGallery/PagesGallery.Droid/Resources/AboutResources.txt b/PagesGallery/PagesGallery.Droid/Resources/AboutResources.txt new file mode 100644 index 00000000..cb30f20b --- /dev/null +++ b/PagesGallery/PagesGallery.Droid/Resources/AboutResources.txt @@ -0,0 +1,50 @@ +Images, layout descriptions, binary blobs and string dictionaries can be included +in your application as resource files. Various Android APIs are designed to +operate on the resource IDs instead of dealing with images, strings or binary blobs +directly. + +For example, a sample Android app that contains a user interface layout (main.xml), +an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) +would keep its resources in the "Resources" directory of the application: + +Resources/ + drawable-hdpi/ + icon.png + + drawable-ldpi/ + icon.png + + drawable-mdpi/ + icon.png + + layout/ + main.xml + + values/ + strings.xml + +In order to get the build system to recognize Android resources, set the build action to +"AndroidResource". The native Android APIs do not operate directly with filenames, but +instead operate on resource IDs. When you compile an Android application that uses resources, +the build system will package the resources for distribution and generate a class called +"Resource" that contains the tokens for each one of the resources included. For example, +for the above Resources layout, this is what the Resource class would expose: + +public class Resource { + public class drawable { + public const int icon = 0x123; + } + + public class layout { + public const int main = 0x456; + } + + public class strings { + public const int first_string = 0xabc; + public const int second_string = 0xbcd; + } +} + +You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main +to reference the layout/main.xml file, or Resource.strings.first_string to reference the first +string in the dictionary file values/strings.xml. diff --git a/PagesGallery/PagesGallery.Droid/Resources/drawable-hdpi/icon.png b/PagesGallery/PagesGallery.Droid/Resources/drawable-hdpi/icon.png Binary files differnew file mode 100644 index 00000000..964f110a --- /dev/null +++ b/PagesGallery/PagesGallery.Droid/Resources/drawable-hdpi/icon.png diff --git a/PagesGallery/PagesGallery.Droid/Resources/drawable-xhdpi/icon.png b/PagesGallery/PagesGallery.Droid/Resources/drawable-xhdpi/icon.png Binary files differnew file mode 100644 index 00000000..3c01e60c --- /dev/null +++ b/PagesGallery/PagesGallery.Droid/Resources/drawable-xhdpi/icon.png diff --git a/PagesGallery/PagesGallery.Droid/Resources/drawable-xxhdpi/icon.png b/PagesGallery/PagesGallery.Droid/Resources/drawable-xxhdpi/icon.png Binary files differnew file mode 100644 index 00000000..0d8c1c57 --- /dev/null +++ b/PagesGallery/PagesGallery.Droid/Resources/drawable-xxhdpi/icon.png diff --git a/PagesGallery/PagesGallery.Droid/Resources/drawable/icon.png b/PagesGallery/PagesGallery.Droid/Resources/drawable/icon.png Binary files differnew file mode 100644 index 00000000..b0ba7150 --- /dev/null +++ b/PagesGallery/PagesGallery.Droid/Resources/drawable/icon.png diff --git a/PagesGallery/PagesGallery.Droid/Resources/layout/Tabbar.axml b/PagesGallery/PagesGallery.Droid/Resources/layout/Tabbar.axml new file mode 100644 index 00000000..97cb27ad --- /dev/null +++ b/PagesGallery/PagesGallery.Droid/Resources/layout/Tabbar.axml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<android.support.design.widget.TabLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/sliding_tabs" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?attr/colorPrimary" + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" + app:tabIndicatorColor="@android:color/white" + app:tabGravity="fill" + app:tabMode="fixed" />
\ No newline at end of file diff --git a/PagesGallery/PagesGallery.Droid/Resources/layout/Toolbar.axml b/PagesGallery/PagesGallery.Droid/Resources/layout/Toolbar.axml new file mode 100644 index 00000000..3a1989a8 --- /dev/null +++ b/PagesGallery/PagesGallery.Droid/Resources/layout/Toolbar.axml @@ -0,0 +1,8 @@ +<android.support.v7.widget.Toolbar + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?attr/colorPrimary" + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" + android:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> diff --git a/PagesGallery/PagesGallery.Droid/Resources/values/styles.xml b/PagesGallery/PagesGallery.Droid/Resources/values/styles.xml new file mode 100644 index 00000000..68b5d73c --- /dev/null +++ b/PagesGallery/PagesGallery.Droid/Resources/values/styles.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<resources> + <style name="MyTheme" parent="MyTheme.Base"> + </style> + <!-- Base theme applied no matter what API --> + <style name="MyTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar"> + <!--If you are using revision 22.1 please use just windowNoTitle. Without android:--> + <item name="windowNoTitle">true</item> + <!--We will be using the toolbar so no need to show ActionBar--> + <item name="windowActionBar">false</item> + <!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette--> + <!-- colorPrimary is used for the default action bar background --> + <item name="colorPrimary">#2196F3</item> + <!-- colorPrimaryDark is used for the status bar --> + <item name="colorPrimaryDark">#1976D2</item> + <!-- colorAccent is used as the default value for colorControlActivated + which is used to tint widgets --> + <item name="colorAccent">#FF4081</item> + <!-- You can also set colorControlNormal, colorControlActivated + colorControlHighlight and colorSwitchThumbNormal. --> + <item name="windowActionModeOverlay">true</item> + + <item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item> + </style> + + <style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog"> + <item name="colorAccent">#FF4081</item> + </style> +</resources>
\ No newline at end of file diff --git a/PagesGallery/PagesGallery.Droid/app.config b/PagesGallery/PagesGallery.Droid/app.config new file mode 100644 index 00000000..4dd3b43c --- /dev/null +++ b/PagesGallery/PagesGallery.Droid/app.config @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.5.0.0" newVersion="1.5.0.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration>
\ No newline at end of file diff --git a/PagesGallery/PagesGallery.Droid/packages.config b/PagesGallery/PagesGallery.Droid/packages.config new file mode 100644 index 00000000..b11a3746 --- /dev/null +++ b/PagesGallery/PagesGallery.Droid/packages.config @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="modernhttpclient" version="2.4.2" targetFramework="monoandroid60" /> + <package id="Xamarin.Android.Support.Animated.Vector.Drawable" version="23.3.0" targetFramework="monoandroid60" /> + <package id="Xamarin.Android.Support.Design" version="23.3.0" targetFramework="monoandroid60" /> + <package id="Xamarin.Android.Support.v4" version="23.3.0" targetFramework="monoandroid60" /> + <package id="Xamarin.Android.Support.v7.AppCompat" version="23.3.0" targetFramework="monoandroid60" /> + <package id="Xamarin.Android.Support.v7.CardView" version="23.3.0" targetFramework="monoandroid60" /> + <package id="Xamarin.Android.Support.v7.MediaRouter" version="23.3.0" targetFramework="monoandroid60" /> + <package id="Xamarin.Android.Support.v7.RecyclerView" version="23.3.0" targetFramework="monoandroid60" /> + <package id="Xamarin.Android.Support.Vector.Drawable" version="23.3.0" targetFramework="monoandroid60" /> +</packages>
\ No newline at end of file diff --git a/PagesGallery/PagesGallery.UWP/App.xaml b/PagesGallery/PagesGallery.UWP/App.xaml new file mode 100644 index 00000000..48c10160 --- /dev/null +++ b/PagesGallery/PagesGallery.UWP/App.xaml @@ -0,0 +1,8 @@ +<Application + x:Class="PagesGallery.UWP.App" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="using:PagesGallery.UWP" + RequestedTheme="Light"> + +</Application> diff --git a/PagesGallery/PagesGallery.UWP/App.xaml.cs b/PagesGallery/PagesGallery.UWP/App.xaml.cs new file mode 100644 index 00000000..b6eecf87 --- /dev/null +++ b/PagesGallery/PagesGallery.UWP/App.xaml.cs @@ -0,0 +1,97 @@ +using System; +using System.Diagnostics; +using Windows.ApplicationModel; +using Windows.ApplicationModel.Activation; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Navigation; +using Xamarin.Forms; +using Application = Windows.UI.Xaml.Application; +using Frame = Windows.UI.Xaml.Controls.Frame; + +namespace PagesGallery.UWP +{ + /// <summary> + /// Provides application-specific behavior to supplement the default Application class. + /// </summary> + partial class App : Application + { + /// <summary> + /// Initializes the singleton application object. This is the first line of authored code + /// executed, and as such is the logical equivalent of main() or WinMain(). + /// </summary> + public App() + { + InitializeComponent(); + Suspending += OnSuspending; + } + + /// <summary> + /// Invoked when the application is launched normally by the end user. Other entry points + /// will be used such as when the application is launched to open a specific file. + /// </summary> + /// <param name="e">Details about the launch request and process.</param> + protected override void OnLaunched(LaunchActivatedEventArgs e) + { +#if DEBUG + if (Debugger.IsAttached) + DebugSettings.EnableFrameRateCounter = true; +#endif + + var rootFrame = Window.Current.Content as Frame; + + // Do not repeat app initialization when the Window already has content, + // just ensure that the window is active + if (rootFrame == null) + { + // Create a Frame to act as the navigation context and navigate to the first page + rootFrame = new Frame(); + + rootFrame.NavigationFailed += OnNavigationFailed; + + Forms.Init(e); + + if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) + { + //TODO: Load state from previously suspended application + } + + // Place the frame in the current Window + Window.Current.Content = rootFrame; + } + + if (rootFrame.Content == null) + { + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter + rootFrame.Navigate(typeof (MainPage), e.Arguments); + } + // Ensure the current window is active + Window.Current.Activate(); + } + + /// <summary> + /// Invoked when Navigation to a certain page fails + /// </summary> + /// <param name="sender">The Frame which failed navigation</param> + /// <param name="e">Details about the navigation failure</param> + void OnNavigationFailed(object sender, NavigationFailedEventArgs e) + { + throw new Exception("Failed to load Page " + e.SourcePageType.FullName); + } + + /// <summary> + /// Invoked when application execution is being suspended. Application state is saved + /// without knowing whether the application will be terminated or resumed with the contents + /// of memory still intact. + /// </summary> + /// <param name="sender">The source of the suspend request.</param> + /// <param name="e">Details about the suspend request.</param> + void OnSuspending(object sender, SuspendingEventArgs e) + { + var deferral = e.SuspendingOperation.GetDeferral(); + //TODO: Save application state and stop any background activity + deferral.Complete(); + } + } +}
\ No newline at end of file diff --git a/PagesGallery/PagesGallery.UWP/Assets/LockScreenLogo.scale-200.png b/PagesGallery/PagesGallery.UWP/Assets/LockScreenLogo.scale-200.png Binary files differnew file mode 100644 index 00000000..735f57ad --- /dev/null +++ b/PagesGallery/PagesGallery.UWP/Assets/LockScreenLogo.scale-200.png diff --git a/PagesGallery/PagesGallery.UWP/Assets/SplashScreen.scale-200.png b/PagesGallery/PagesGallery.UWP/Assets/SplashScreen.scale-200.png Binary files differnew file mode 100644 index 00000000..023e7f1f --- /dev/null +++ b/PagesGallery/PagesGallery.UWP/Assets/SplashScreen.scale-200.png diff --git a/PagesGallery/PagesGallery.UWP/Assets/Square150x150Logo.scale-200.png b/PagesGallery/PagesGallery.UWP/Assets/Square150x150Logo.scale-200.png Binary files differnew file mode 100644 index 00000000..af49fec1 --- /dev/null +++ b/PagesGallery/PagesGallery.UWP/Assets/Square150x150Logo.scale-200.png diff --git a/PagesGallery/PagesGallery.UWP/Assets/Square44x44Logo.scale-200.png b/PagesGallery/PagesGallery.UWP/Assets/Square44x44Logo.scale-200.png Binary files differnew file mode 100644 index 00000000..ce342a2e --- /dev/null +++ b/PagesGallery/PagesGallery.UWP/Assets/Square44x44Logo.scale-200.png diff --git a/PagesGallery/PagesGallery.UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/PagesGallery/PagesGallery.UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png Binary files differnew file mode 100644 index 00000000..f6c02ce9 --- /dev/null +++ b/PagesGallery/PagesGallery.UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png diff --git a/PagesGallery/PagesGallery.UWP/Assets/StoreLogo.png b/PagesGallery/PagesGallery.UWP/Assets/StoreLogo.png Binary files differnew file mode 100644 index 00000000..7385b56c --- /dev/null +++ b/PagesGallery/PagesGallery.UWP/Assets/StoreLogo.png diff --git a/PagesGallery/PagesGallery.UWP/Assets/Wide310x150Logo.scale-200.png b/PagesGallery/PagesGallery.UWP/Assets/Wide310x150Logo.scale-200.png Binary files differnew file mode 100644 index 00000000..288995b3 --- /dev/null +++ b/PagesGallery/PagesGallery.UWP/Assets/Wide310x150Logo.scale-200.png diff --git a/PagesGallery/PagesGallery.UWP/MainPage.xaml b/PagesGallery/PagesGallery.UWP/MainPage.xaml new file mode 100644 index 00000000..a922248b --- /dev/null +++ b/PagesGallery/PagesGallery.UWP/MainPage.xaml @@ -0,0 +1,14 @@ +<forms:WindowsPage + x:Class="PagesGallery.UWP.MainPage" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:forms="using:Xamarin.Forms.Platform.UWP" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="using:PagesGallery.UWP" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + mc:Ignorable="d"> + + <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> + + </Grid> +</forms:WindowsPage> diff --git a/PagesGallery/PagesGallery.UWP/MainPage.xaml.cs b/PagesGallery/PagesGallery.UWP/MainPage.xaml.cs new file mode 100644 index 00000000..ec4546ff --- /dev/null +++ b/PagesGallery/PagesGallery.UWP/MainPage.xaml.cs @@ -0,0 +1,12 @@ +namespace PagesGallery.UWP +{ + public sealed partial class MainPage + { + public MainPage() + { + InitializeComponent(); + + LoadApplication(new PagesGallery.App()); + } + } +}
\ No newline at end of file diff --git a/PagesGallery/PagesGallery.UWP/Package.appxmanifest b/PagesGallery/PagesGallery.UWP/Package.appxmanifest new file mode 100644 index 00000000..e50e6602 --- /dev/null +++ b/PagesGallery/PagesGallery.UWP/Package.appxmanifest @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="utf-8"?> + +<Package + xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" + xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" + xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" + IgnorableNamespaces="uap mp"> + + <Identity + Name="f736c883-f105-4d30-a719-4bf328872f5e" + Publisher="CN=joaqu" + Version="1.0.0.0" /> + + <mp:PhoneIdentity PhoneProductId="f736c883-f105-4d30-a719-4bf328872f5e" PhonePublisherId="00000000-0000-0000-0000-000000000000"/> + + <Properties> + <DisplayName>FPCL.WIndows</DisplayName> + <PublisherDisplayName>joaqu</PublisherDisplayName> + <Logo>Assets\StoreLogo.png</Logo> + </Properties> + + <Dependencies> + <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" /> + </Dependencies> + + <Resources> + <Resource Language="x-generate"/> + </Resources> + + <Applications> + <Application Id="App" + Executable="$targetnametoken$.exe" + EntryPoint="FPCL.WIndows.App"> + <uap:VisualElements + DisplayName="FPCL.WIndows" + Square150x150Logo="Assets\Square150x150Logo.png" + Square44x44Logo="Assets\Square44x44Logo.png" + Description="FPCL.WIndows" + BackgroundColor="transparent"> + <uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/> + <uap:SplashScreen Image="Assets\SplashScreen.png" /> + </uap:VisualElements> + </Application> + </Applications> + + <Capabilities> + <Capability Name="internetClient" /> + </Capabilities> +</Package>
\ No newline at end of file diff --git a/PagesGallery/PagesGallery.UWP/PagesGallery.UWP.csproj b/PagesGallery/PagesGallery.UWP/PagesGallery.UWP.csproj new file mode 100644 index 00000000..b72b6705 --- /dev/null +++ b/PagesGallery/PagesGallery.UWP/PagesGallery.UWP.csproj @@ -0,0 +1,163 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">x86</Platform> + <ProjectGuid>{95FEB8D4-D57E-4B96-A8D8-59D241C0501B}</ProjectGuid> + <OutputType>AppContainerExe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>PagesGallery.UWP</RootNamespace> + <AssemblyName>PagesGallery.UWP</AssemblyName> + <DefaultLanguage>en-US</DefaultLanguage> + <TargetPlatformIdentifier>UAP</TargetPlatformIdentifier> + <TargetPlatformVersion>10.0.10240.0</TargetPlatformVersion> + <TargetPlatformMinVersion>10.0.10240.0</TargetPlatformMinVersion> + <MinimumVisualStudioVersion>14</MinimumVisualStudioVersion> + <EnableDotNetNativeCompatibleProfile>true</EnableDotNetNativeCompatibleProfile> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <PackageCertificateKeyFile>Windows_TemporaryKey.pfx</PackageCertificateKeyFile> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'"> + <DebugSymbols>true</DebugSymbols> + <OutputPath>bin\ARM\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> + <NoWarn>;2008</NoWarn> + <DebugType>full</DebugType> + <PlatformTarget>ARM</PlatformTarget> + <UseVSHostingProcess>false</UseVSHostingProcess> + <ErrorReport>prompt</ErrorReport> + <Prefer32Bit>true</Prefer32Bit> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'"> + <OutputPath>bin\ARM\Release\</OutputPath> + <DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> + <Optimize>true</Optimize> + <NoWarn>;2008</NoWarn> + <DebugType>pdbonly</DebugType> + <PlatformTarget>ARM</PlatformTarget> + <UseVSHostingProcess>false</UseVSHostingProcess> + <ErrorReport>prompt</ErrorReport> + <Prefer32Bit>true</Prefer32Bit> + <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> + <DebugSymbols>true</DebugSymbols> + <OutputPath>bin\x64\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> + <NoWarn>;2008</NoWarn> + <DebugType>full</DebugType> + <PlatformTarget>x64</PlatformTarget> + <UseVSHostingProcess>false</UseVSHostingProcess> + <ErrorReport>prompt</ErrorReport> + <Prefer32Bit>true</Prefer32Bit> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> + <OutputPath>bin\x64\Release\</OutputPath> + <DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> + <Optimize>true</Optimize> + <NoWarn>;2008</NoWarn> + <DebugType>pdbonly</DebugType> + <PlatformTarget>x64</PlatformTarget> + <UseVSHostingProcess>false</UseVSHostingProcess> + <ErrorReport>prompt</ErrorReport> + <Prefer32Bit>true</Prefer32Bit> + <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> + <DebugSymbols>true</DebugSymbols> + <OutputPath>bin\x86\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> + <NoWarn>;2008</NoWarn> + <DebugType>full</DebugType> + <PlatformTarget>x86</PlatformTarget> + <UseVSHostingProcess>false</UseVSHostingProcess> + <ErrorReport>prompt</ErrorReport> + <Prefer32Bit>true</Prefer32Bit> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> + <OutputPath>bin\x86\Release\</OutputPath> + <DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> + <Optimize>true</Optimize> + <NoWarn>;2008</NoWarn> + <DebugType>pdbonly</DebugType> + <PlatformTarget>x86</PlatformTarget> + <UseVSHostingProcess>false</UseVSHostingProcess> + <ErrorReport>prompt</ErrorReport> + <Prefer32Bit>true</Prefer32Bit> + <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain> + </PropertyGroup> + <ItemGroup> + <!-- A reference to the entire .Net Framework and Windows SDK are automatically included --> + <None Include="project.json" /> + </ItemGroup> + <ItemGroup> + <Compile Include="App.xaml.cs"> + <DependentUpon>App.xaml</DependentUpon> + </Compile> + <Compile Include="MainPage.xaml.cs"> + <DependentUpon>MainPage.xaml</DependentUpon> + </Compile> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <AppxManifest Include="Package.appxmanifest"> + <SubType>Designer</SubType> + </AppxManifest> + <None Include="Windows_TemporaryKey.pfx" /> + </ItemGroup> + <ItemGroup> + <Content Include="Properties\Default.rd.xml" /> + <Content Include="Assets\LockScreenLogo.scale-200.png" /> + <Content Include="Assets\SplashScreen.scale-200.png" /> + <Content Include="Assets\Square150x150Logo.scale-200.png" /> + <Content Include="Assets\Square44x44Logo.scale-200.png" /> + <Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" /> + <Content Include="Assets\StoreLogo.png" /> + <Content Include="Assets\Wide310x150Logo.scale-200.png" /> + </ItemGroup> + <ItemGroup> + <ApplicationDefinition Include="App.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </ApplicationDefinition> + <Page Include="MainPage.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\Xamarin.Forms.Core\Xamarin.Forms.Core.csproj"> + <Project>{57b8b73d-c3b5-4c42-869e-7b2f17d354ac}</Project> + <Name>Xamarin.Forms.Core</Name> + </ProjectReference> + <ProjectReference Include="..\..\Xamarin.Forms.Pages\Xamarin.Forms.Pages.csproj"> + <Project>{d6133dbd-6c60-4bd5-bea2-07e0a3927c31}</Project> + <Name>Xamarin.Forms.Pages</Name> + </ProjectReference> + <ProjectReference Include="..\..\Xamarin.Forms.Platform.UAP\Xamarin.Forms.Platform.UAP.csproj"> + <Project>{00d8d049-ffaa-4759-8fc9-1eca30777f72}</Project> + <Name>Xamarin.Forms.Platform.UAP</Name> + </ProjectReference> + <ProjectReference Include="..\..\Xamarin.Forms.Xaml\Xamarin.Forms.Xaml.csproj"> + <Project>{9db2f292-8034-4e06-89ad-98bbda4306b9}</Project> + <Name>Xamarin.Forms.Xaml</Name> + </ProjectReference> + <ProjectReference Include="..\PagesGallery\PagesGallery.csproj"> + <Name>PagesGallery</Name> + </ProjectReference> + </ItemGroup> + <PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' "> + <VisualStudioVersion>14.0</VisualStudioVersion> + </PropertyGroup> + <Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" /> + <Import Project="..\..\.nuspec\Xamarin.Forms.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project>
\ No newline at end of file diff --git a/PagesGallery/PagesGallery.UWP/Properties/AssemblyInfo.cs b/PagesGallery/PagesGallery.UWP/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..a0611778 --- /dev/null +++ b/PagesGallery/PagesGallery.UWP/Properties/AssemblyInfo.cs @@ -0,0 +1,29 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle ("PagesGallery.UWP")] +[assembly: AssemblyDescription ("")] +[assembly: AssemblyConfiguration ("")] +[assembly: AssemblyCompany ("")] +[assembly: AssemblyProduct ("PagesGallery.UWP")] +[assembly: AssemblyCopyright ("Copyright © 2015")] +[assembly: AssemblyTrademark ("")] +[assembly: AssemblyCulture ("")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion ("1.0.0.0")] +[assembly: AssemblyFileVersion ("1.0.0.0")] +[assembly: ComVisible (false)]
\ No newline at end of file diff --git a/PagesGallery/PagesGallery.UWP/Properties/Default.rd.xml b/PagesGallery/PagesGallery.UWP/Properties/Default.rd.xml new file mode 100644 index 00000000..80a960ce --- /dev/null +++ b/PagesGallery/PagesGallery.UWP/Properties/Default.rd.xml @@ -0,0 +1,31 @@ +<!-- + This file contains Runtime Directives used by .NET Native. The defaults here are suitable for most + developers. However, you can modify these parameters to modify the behavior of the .NET Native + optimizer. + + Runtime Directives are documented at http://go.microsoft.com/fwlink/?LinkID=391919 + + To fully enable reflection for App1.MyClass and all of its public/private members + <Type Name="App1.MyClass" Dynamic="Required All"/> + + To enable dynamic creation of the specific instantiation of AppClass<T> over System.Int32 + <TypeInstantiation Name="App1.AppClass" Arguments="System.Int32" Activate="Required Public" /> + + Using the Namespace directive to apply reflection policy to all the types in a particular namespace + <Namespace Name="DataClasses.ViewModels" Seralize="All" /> +--> + +<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata"> + <Application> + <!-- + An Assembly element with Name="*Application*" applies to all assemblies in + the application package. The asterisks are not wildcards. + --> + <Assembly Name="*Application*" Dynamic="Required All" /> + + + <!-- Add your application specific runtime directives here. --> + + + </Application> +</Directives>
\ No newline at end of file diff --git a/PagesGallery/PagesGallery.UWP/Windows_TemporaryKey.pfx b/PagesGallery/PagesGallery.UWP/Windows_TemporaryKey.pfx Binary files differnew file mode 100644 index 00000000..084f19a4 --- /dev/null +++ b/PagesGallery/PagesGallery.UWP/Windows_TemporaryKey.pfx diff --git a/PagesGallery/PagesGallery.UWP/project.json b/PagesGallery/PagesGallery.UWP/project.json new file mode 100644 index 00000000..226a07ce --- /dev/null +++ b/PagesGallery/PagesGallery.UWP/project.json @@ -0,0 +1,17 @@ +{ + "dependencies": { + "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0", + "modernhttpclient": "2.4.2" + }, + "frameworks": { + "uap10.0": {} + }, + "runtimes": { + "win10-arm": {}, + "win10-arm-aot": {}, + "win10-x86": {}, + "win10-x86-aot": {}, + "win10-x64": {}, + "win10-x64-aot": {} + } +}
\ No newline at end of file diff --git a/PagesGallery/PagesGallery.WinPhone/App.xaml b/PagesGallery/PagesGallery.WinPhone/App.xaml new file mode 100644 index 00000000..1b6e49f3 --- /dev/null +++ b/PagesGallery/PagesGallery.WinPhone/App.xaml @@ -0,0 +1,7 @@ +<Application + x:Class="PagesGallery.WinPhone.App" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="using:PagesGallery.WinPhone"> + +</Application> diff --git a/PagesGallery/PagesGallery.WinPhone/App.xaml.cs b/PagesGallery/PagesGallery.WinPhone/App.xaml.cs new file mode 100644 index 00000000..059fbf88 --- /dev/null +++ b/PagesGallery/PagesGallery.WinPhone/App.xaml.cs @@ -0,0 +1,127 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; +using Windows.ApplicationModel; +using Windows.ApplicationModel.Activation; +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.Media.Animation; +using Windows.UI.Xaml.Navigation; + +// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227 + +namespace PagesGallery.WinPhone +{ + /// <summary> + /// Provides application-specific behavior to supplement the default Application class. + /// </summary> + public sealed partial class App : Application + { + private TransitionCollection transitions; + + /// <summary> + /// Initializes the singleton application object. This is the first line of authored code + /// executed, and as such is the logical equivalent of main() or WinMain(). + /// </summary> + public App () + { + this.InitializeComponent (); + this.Suspending += this.OnSuspending; + } + + /// <summary> + /// Invoked when the application is launched normally by the end user. Other entry points + /// will be used when the application is launched to open a specific file, to display + /// search results, and so forth. + /// </summary> + /// <param name="e">Details about the launch request and process.</param> + protected override void OnLaunched (LaunchActivatedEventArgs e) + { +#if DEBUG + if (System.Diagnostics.Debugger.IsAttached) + { + this.DebugSettings.EnableFrameRateCounter = true; + } +#endif + + Frame rootFrame = Window.Current.Content as Frame; + + // Do not repeat app initialization when the Window already has content, + // just ensure that the window is active + if (rootFrame == null) { + // Create a Frame to act as the navigation context and navigate to the first page + rootFrame = new Frame (); + + // TODO: change this value to a cache size that is appropriate for your application + rootFrame.CacheSize = 1; + + Xamarin.Forms.Forms.Init (e); + + if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { + // TODO: Load state from previously suspended application + } + + // Place the frame in the current Window + Window.Current.Content = rootFrame; + } + + if (rootFrame.Content == null) { + // Removes the turnstile navigation for startup. + if (rootFrame.ContentTransitions != null) { + this.transitions = new TransitionCollection (); + foreach (var c in rootFrame.ContentTransitions) { + this.transitions.Add (c); + } + } + + rootFrame.ContentTransitions = null; + rootFrame.Navigated += this.RootFrame_FirstNavigated; + + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter + if (!rootFrame.Navigate (typeof (MainPage), e.Arguments)) { + throw new Exception ("Failed to create initial page"); + } + } + + // Ensure the current window is active + Window.Current.Activate (); + } + + /// <summary> + /// Restores the content transitions after the app has launched. + /// </summary> + /// <param name="sender">The object where the handler is attached.</param> + /// <param name="e">Details about the navigation event.</param> + private void RootFrame_FirstNavigated (object sender, NavigationEventArgs e) + { + var rootFrame = sender as Frame; + rootFrame.ContentTransitions = this.transitions ?? new TransitionCollection () { new NavigationThemeTransition () }; + rootFrame.Navigated -= this.RootFrame_FirstNavigated; + } + + /// <summary> + /// Invoked when application execution is being suspended. Application state is saved + /// without knowing whether the application will be terminated or resumed with the contents + /// of memory still intact. + /// </summary> + /// <param name="sender">The source of the suspend request.</param> + /// <param name="e">Details about the suspend request.</param> + private void OnSuspending (object sender, SuspendingEventArgs e) + { + var deferral = e.SuspendingOperation.GetDeferral (); + + // TODO: Save application state and stop any background activity + deferral.Complete (); + } + } +}
\ No newline at end of file diff --git a/PagesGallery/PagesGallery.WinPhone/Assets/Logo.scale-240.png b/PagesGallery/PagesGallery.WinPhone/Assets/Logo.scale-240.png Binary files differnew file mode 100644 index 00000000..76921ca9 --- /dev/null +++ b/PagesGallery/PagesGallery.WinPhone/Assets/Logo.scale-240.png diff --git a/PagesGallery/PagesGallery.WinPhone/Assets/SmallLogo.scale-240.png b/PagesGallery/PagesGallery.WinPhone/Assets/SmallLogo.scale-240.png Binary files differnew file mode 100644 index 00000000..31663012 --- /dev/null +++ b/PagesGallery/PagesGallery.WinPhone/Assets/SmallLogo.scale-240.png diff --git a/PagesGallery/PagesGallery.WinPhone/Assets/SplashScreen.scale-240.png b/PagesGallery/PagesGallery.WinPhone/Assets/SplashScreen.scale-240.png Binary files differnew file mode 100644 index 00000000..33f26b33 --- /dev/null +++ b/PagesGallery/PagesGallery.WinPhone/Assets/SplashScreen.scale-240.png diff --git a/PagesGallery/PagesGallery.WinPhone/Assets/Square71x71Logo.scale-240.png b/PagesGallery/PagesGallery.WinPhone/Assets/Square71x71Logo.scale-240.png Binary files differnew file mode 100644 index 00000000..cfa54bee --- /dev/null +++ b/PagesGallery/PagesGallery.WinPhone/Assets/Square71x71Logo.scale-240.png diff --git a/PagesGallery/PagesGallery.WinPhone/Assets/StoreLogo.scale-240.png b/PagesGallery/PagesGallery.WinPhone/Assets/StoreLogo.scale-240.png Binary files differnew file mode 100644 index 00000000..47e084b5 --- /dev/null +++ b/PagesGallery/PagesGallery.WinPhone/Assets/StoreLogo.scale-240.png diff --git a/PagesGallery/PagesGallery.WinPhone/Assets/WideLogo.scale-240.png b/PagesGallery/PagesGallery.WinPhone/Assets/WideLogo.scale-240.png Binary files differnew file mode 100644 index 00000000..6249d29d --- /dev/null +++ b/PagesGallery/PagesGallery.WinPhone/Assets/WideLogo.scale-240.png diff --git a/PagesGallery/PagesGallery.WinPhone/MainPage.xaml b/PagesGallery/PagesGallery.WinPhone/MainPage.xaml new file mode 100644 index 00000000..8ae3bc0a --- /dev/null +++ b/PagesGallery/PagesGallery.WinPhone/MainPage.xaml @@ -0,0 +1,12 @@ +<forms:WindowsPhonePage + x:Class="PagesGallery.WinPhone.MainPage" + xmlns:forms="using:Xamarin.Forms.Platform.WinRT" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="using:PagesGallery.WinPhone" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + mc:Ignorable="d" + Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> + +</forms:WindowsPhonePage>
\ No newline at end of file diff --git a/PagesGallery/PagesGallery.WinPhone/MainPage.xaml.cs b/PagesGallery/PagesGallery.WinPhone/MainPage.xaml.cs new file mode 100644 index 00000000..45fac898 --- /dev/null +++ b/PagesGallery/PagesGallery.WinPhone/MainPage.xaml.cs @@ -0,0 +1,50 @@ +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 Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 + +namespace PagesGallery.WinPhone +{ + /// <summary> + /// An empty page that can be used on its own or navigated to within a Frame. + /// </summary> + public sealed partial class MainPage + { + public MainPage () + { + this.InitializeComponent (); + + this.NavigationCacheMode = NavigationCacheMode.Required; + + LoadApplication (new PagesGallery.App ()); + } + + /// <summary> + /// Invoked when this page is about to be displayed in a Frame. + /// </summary> + /// <param name="e">Event data that describes how this page was reached. + /// This parameter is typically used to configure the page.</param> + protected override void OnNavigatedTo (NavigationEventArgs e) + { + // TODO: Prepare page for display here. + + // TODO: If your application contains multiple pages, ensure that you are + // handling the hardware Back button by registering for the + // Windows.Phone.UI.Input.HardwareButtons.BackPressed event. + // If you are using the NavigationHelper provided by some templates, + // this event is handled for you. + } + } +} diff --git a/PagesGallery/PagesGallery.WinPhone/Package.appxmanifest b/PagesGallery/PagesGallery.WinPhone/Package.appxmanifest new file mode 100644 index 00000000..cdf2a6a3 --- /dev/null +++ b/PagesGallery/PagesGallery.WinPhone/Package.appxmanifest @@ -0,0 +1,44 @@ +<?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" xmlns:m3="http://schemas.microsoft.com/appx/2014/manifest" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"> + + <Identity Name="e8ebdf4c-1a3c-4b54-919a-429e98e93142" + Publisher="CN=joaqu" + Version="1.0.0.0" /> + + <mp:PhoneIdentity PhoneProductId="e8ebdf4c-1a3c-4b54-919a-429e98e93142" PhonePublisherId="00000000-0000-0000-0000-000000000000"/> + + <Properties> + <DisplayName>FPCL.Windows8.WindowsPhone</DisplayName> + <PublisherDisplayName>joaqu</PublisherDisplayName> + <Logo>Assets\StoreLogo.png</Logo> + </Properties> + + <Prerequisites> + <OSMinVersion>6.3.1</OSMinVersion> + <OSMaxVersionTested>6.3.1</OSMaxVersionTested> + </Prerequisites> + + <Resources> + <Resource Language="x-generate"/> + </Resources> + + <Applications> + <Application Id="App" + Executable="$targetnametoken$.exe" + EntryPoint="FPCL.Windows8.WindowsPhone.App"> + <m3:VisualElements + DisplayName="FPCL.Windows8.WindowsPhone" + Square150x150Logo="Assets\Logo.png" + Square44x44Logo="Assets\SmallLogo.png" + Description="FPCL.Windows8.WindowsPhone" + ForegroundText="light" + BackgroundColor="transparent"> + <m3:DefaultTile Wide310x150Logo="Assets\WideLogo.png" Square71x71Logo="Assets\Square71x71Logo.png"/> + <m3:SplashScreen Image="Assets\SplashScreen.png"/> + </m3:VisualElements> + </Application> + </Applications> + <Capabilities> + <Capability Name="internetClientServer" /> + </Capabilities> +</Package>
\ No newline at end of file diff --git a/PagesGallery/PagesGallery.WinPhone/PagesGallery.WinPhone.csproj b/PagesGallery/PagesGallery.WinPhone/PagesGallery.WinPhone.csproj new file mode 100644 index 00000000..0adad426 --- /dev/null +++ b/PagesGallery/PagesGallery.WinPhone/PagesGallery.WinPhone.csproj @@ -0,0 +1,166 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{5AE58797-E40C-4EC3-836E-7DA2EF1B3180}</ProjectGuid> + <OutputType>AppContainerExe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>PagesGallery.WinPhone</RootNamespace> + <AssemblyName>PagesGallery.WinPhone</AssemblyName> + <DefaultLanguage>en-US</DefaultLanguage> + <TargetPlatformVersion>8.1</TargetPlatformVersion> + <MinimumVisualStudioVersion>12</MinimumVisualStudioVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{76F1466A-8B6D-4E39-A767-685A06062A39};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <SynthesizeLinkMetadata>true</SynthesizeLinkMetadata> + <NuGetPackageImportStamp> + </NuGetPackageImportStamp> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_PHONE_APP</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE;NETFX_CORE;WINDOWS_PHONE_APP</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'"> + <DebugSymbols>true</DebugSymbols> + <OutputPath>bin\ARM\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_PHONE_APP</DefineConstants> + <NoWarn>;2008</NoWarn> + <DebugType>full</DebugType> + <PlatformTarget>ARM</PlatformTarget> + <UseVSHostingProcess>false</UseVSHostingProcess> + <ErrorReport>prompt</ErrorReport> + <Prefer32Bit>true</Prefer32Bit> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'"> + <OutputPath>bin\ARM\Release\</OutputPath> + <DefineConstants>TRACE;NETFX_CORE;WINDOWS_PHONE_APP</DefineConstants> + <Optimize>true</Optimize> + <NoWarn>;2008</NoWarn> + <DebugType>pdbonly</DebugType> + <PlatformTarget>ARM</PlatformTarget> + <UseVSHostingProcess>false</UseVSHostingProcess> + <ErrorReport>prompt</ErrorReport> + <Prefer32Bit>true</Prefer32Bit> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> + <DebugSymbols>true</DebugSymbols> + <OutputPath>bin\x86\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_PHONE_APP</DefineConstants> + <NoWarn>;2008</NoWarn> + <DebugType>full</DebugType> + <PlatformTarget>x86</PlatformTarget> + <UseVSHostingProcess>false</UseVSHostingProcess> + <ErrorReport>prompt</ErrorReport> + <Prefer32Bit>true</Prefer32Bit> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> + <OutputPath>bin\x86\Release\</OutputPath> + <DefineConstants>TRACE;NETFX_CORE;WINDOWS_PHONE_APP</DefineConstants> + <Optimize>true</Optimize> + <NoWarn>;2008</NoWarn> + <DebugType>pdbonly</DebugType> + <PlatformTarget>x86</PlatformTarget> + <UseVSHostingProcess>false</UseVSHostingProcess> + <ErrorReport>prompt</ErrorReport> + <Prefer32Bit>true</Prefer32Bit> + </PropertyGroup> + <ItemGroup> + <Compile Include="App.xaml.cs"> + <DependentUpon>App.xaml</DependentUpon> + </Compile> + <Compile Include="MainPage.xaml.cs"> + <DependentUpon>MainPage.xaml</DependentUpon> + </Compile> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <AppxManifest Include="Package.appxmanifest"> + <SubType>Designer</SubType> + </AppxManifest> + </ItemGroup> + <ItemGroup> + <Content Include="Assets\Logo.scale-240.png" /> + <Content Include="Assets\SmallLogo.scale-240.png" /> + <Content Include="Assets\SplashScreen.scale-240.png" /> + <Content Include="Assets\Square71x71Logo.scale-240.png" /> + <Content Include="Assets\StoreLogo.scale-240.png" /> + <Content Include="Assets\WideLogo.scale-240.png" /> + </ItemGroup> + <ItemGroup> + <ApplicationDefinition Include="App.xaml"> + <SubType>Designer</SubType> + </ApplicationDefinition> + <Page Include="MainPage.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\PagesGallery\PagesGallery.csproj"> + <Name>PagesGallery</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <Reference Include="Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Xamarin.Forms.2.0.0.6482\lib\wpa81\Xamarin.Forms.Core.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Xamarin.Forms.Platform, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Xamarin.Forms.2.0.0.6482\lib\wpa81\Xamarin.Forms.Platform.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Xamarin.Forms.Platform.WinRT, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Xamarin.Forms.2.0.0.6482\lib\wpa81\Xamarin.Forms.Platform.WinRT.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Xamarin.Forms.Platform.WinRT.Phone, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Xamarin.Forms.2.0.0.6482\lib\wpa81\Xamarin.Forms.Platform.WinRT.Phone.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Xamarin.Forms.Xaml, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Xamarin.Forms.2.0.0.6482\lib\wpa81\Xamarin.Forms.Xaml.dll</HintPath> + <Private>True</Private> + </Reference> + </ItemGroup> + <ItemGroup> + <None Include="packages.config" /> + </ItemGroup> + <PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '12.0' "> + <VisualStudioVersion>12.0</VisualStudioVersion> + </PropertyGroup> + <PropertyGroup Condition=" '$(TargetPlatformIdentifier)' == '' "> + <TargetPlatformIdentifier>WindowsPhoneApp</TargetPlatformIdentifier> + </PropertyGroup> + <Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" /> + <Import Project="..\..\packages\Xamarin.Forms.2.0.0.6482\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.2.0.0.6482\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" /> + <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> + <PropertyGroup> + <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> + </PropertyGroup> + <Error Condition="!Exists('..\..\packages\Xamarin.Forms.2.0.0.6482\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.2.0.0.6482\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets'))" /> + </Target> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project>
\ No newline at end of file diff --git a/PagesGallery/PagesGallery.WinPhone/Properties/AssemblyInfo.cs b/PagesGallery/PagesGallery.WinPhone/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..f1a4f4ef --- /dev/null +++ b/PagesGallery/PagesGallery.WinPhone/Properties/AssemblyInfo.cs @@ -0,0 +1,29 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle ("PagesGallery.WinPhone.WindowsPhone")] +[assembly: AssemblyDescription ("")] +[assembly: AssemblyConfiguration ("")] +[assembly: AssemblyCompany ("")] +[assembly: AssemblyProduct ("PagesGallery.WinPhone.WindowsPhone")] +[assembly: AssemblyCopyright ("Copyright © 2015")] +[assembly: AssemblyTrademark ("")] +[assembly: AssemblyCulture ("")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion ("1.0.0.0")] +[assembly: AssemblyFileVersion ("1.0.0.0")] +[assembly: ComVisible (false)]
\ No newline at end of file diff --git a/PagesGallery/PagesGallery.WinPhone/packages.config b/PagesGallery/PagesGallery.WinPhone/packages.config new file mode 100644 index 00000000..fe86bc49 --- /dev/null +++ b/PagesGallery/PagesGallery.WinPhone/packages.config @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="Xamarin.Forms" version="2.0.0.6482" targetFramework="wpa81" /> +</packages>
\ No newline at end of file diff --git a/PagesGallery/PagesGallery.Windows/App.xaml b/PagesGallery/PagesGallery.Windows/App.xaml new file mode 100644 index 00000000..66d0576c --- /dev/null +++ b/PagesGallery/PagesGallery.Windows/App.xaml @@ -0,0 +1,7 @@ +<Application + x:Class="PagesGallery.Windows.App" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="using:PagesGallery.Windows"> + +</Application> diff --git a/PagesGallery/PagesGallery.Windows/App.xaml.cs b/PagesGallery/PagesGallery.Windows/App.xaml.cs new file mode 100644 index 00000000..6c0e11d7 --- /dev/null +++ b/PagesGallery/PagesGallery.Windows/App.xaml.cs @@ -0,0 +1,102 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; +using Windows.ApplicationModel; +using Windows.ApplicationModel.Activation; +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.Media.Animation; +using Windows.UI.Xaml.Navigation; + +// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227 + +namespace PagesGallery.Windows +{ + /// <summary> + /// Provides application-specific behavior to supplement the default Application class. + /// </summary> + public sealed partial class App : Application + { + /// <summary> + /// Initializes the singleton application object. This is the first line of authored code + /// executed, and as such is the logical equivalent of main() or WinMain(). + /// </summary> + public App () + { + this.InitializeComponent (); + this.Suspending += this.OnSuspending; + } + + /// <summary> + /// Invoked when the application is launched normally by the end user. Other entry points + /// will be used when the application is launched to open a specific file, to display + /// search results, and so forth. + /// </summary> + /// <param name="e">Details about the launch request and process.</param> + protected override void OnLaunched (LaunchActivatedEventArgs e) + { +#if DEBUG + if (System.Diagnostics.Debugger.IsAttached) + { + this.DebugSettings.EnableFrameRateCounter = true; + } +#endif + + Frame rootFrame = Window.Current.Content as Frame; + + // Do not repeat app initialization when the Window already has content, + // just ensure that the window is active + if (rootFrame == null) { + // Create a Frame to act as the navigation context and navigate to the first page + rootFrame = new Frame (); + + // TODO: change this value to a cache size that is appropriate for your application + rootFrame.CacheSize = 1; + + Xamarin.Forms.Forms.Init (e); + + if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { + // TODO: Load state from previously suspended application + } + + // Place the frame in the current Window + Window.Current.Content = rootFrame; + } + + if (rootFrame.Content == null) { + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter + if (!rootFrame.Navigate (typeof (MainPage), e.Arguments)) { + throw new Exception ("Failed to create initial page"); + } + } + + // Ensure the current window is active + Window.Current.Activate (); + } + + /// <summary> + /// Invoked when application execution is being suspended. Application state is saved + /// without knowing whether the application will be terminated or resumed with the contents + /// of memory still intact. + /// </summary> + /// <param name="sender">The source of the suspend request.</param> + /// <param name="e">Details about the suspend request.</param> + private void OnSuspending (object sender, SuspendingEventArgs e) + { + var deferral = e.SuspendingOperation.GetDeferral (); + + // TODO: Save application state and stop any background activity + deferral.Complete (); + } + } +}
\ No newline at end of file diff --git a/PagesGallery/PagesGallery.Windows/Assets/Logo.scale-100.png b/PagesGallery/PagesGallery.Windows/Assets/Logo.scale-100.png Binary files differnew file mode 100644 index 00000000..e26771cb --- /dev/null +++ b/PagesGallery/PagesGallery.Windows/Assets/Logo.scale-100.png diff --git a/PagesGallery/PagesGallery.Windows/Assets/SmallLogo.scale-100.png b/PagesGallery/PagesGallery.Windows/Assets/SmallLogo.scale-100.png Binary files differnew file mode 100644 index 00000000..1eb0d9d5 --- /dev/null +++ b/PagesGallery/PagesGallery.Windows/Assets/SmallLogo.scale-100.png diff --git a/PagesGallery/PagesGallery.Windows/Assets/SplashScreen.scale-100.png b/PagesGallery/PagesGallery.Windows/Assets/SplashScreen.scale-100.png Binary files differnew file mode 100644 index 00000000..c951e031 --- /dev/null +++ b/PagesGallery/PagesGallery.Windows/Assets/SplashScreen.scale-100.png diff --git a/PagesGallery/PagesGallery.Windows/Assets/StoreLogo.scale-100.png b/PagesGallery/PagesGallery.Windows/Assets/StoreLogo.scale-100.png Binary files differnew file mode 100644 index 00000000..dcb67271 --- /dev/null +++ b/PagesGallery/PagesGallery.Windows/Assets/StoreLogo.scale-100.png diff --git a/PagesGallery/PagesGallery.Windows/MainPage.xaml b/PagesGallery/PagesGallery.Windows/MainPage.xaml new file mode 100644 index 00000000..439770ea --- /dev/null +++ b/PagesGallery/PagesGallery.Windows/MainPage.xaml @@ -0,0 +1,14 @@ +<forms:WindowsPage + x:Class="PagesGallery.Windows.MainPage" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:forms="using:Xamarin.Forms.Platform.WinRT" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="using:PagesGallery.Windows" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + mc:Ignorable="d"> + + <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> + + </Grid> +</forms:WindowsPage> diff --git a/PagesGallery/PagesGallery.Windows/MainPage.xaml.cs b/PagesGallery/PagesGallery.Windows/MainPage.xaml.cs new file mode 100644 index 00000000..3029e7c2 --- /dev/null +++ b/PagesGallery/PagesGallery.Windows/MainPage.xaml.cs @@ -0,0 +1,27 @@ +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; + +namespace PagesGallery.Windows +{ + public sealed partial class MainPage + { + public MainPage () + { + this.InitializeComponent (); + + LoadApplication (new PagesGallery.App ()); + } + } +} diff --git a/PagesGallery/PagesGallery.Windows/Package.appxmanifest b/PagesGallery/PagesGallery.Windows/Package.appxmanifest new file mode 100644 index 00000000..188ba67c --- /dev/null +++ b/PagesGallery/PagesGallery.Windows/Package.appxmanifest @@ -0,0 +1,41 @@ +<?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="85930d70-750c-41a6-9b95-03faaed4159c" + Publisher="CN=joaqu" + Version="1.0.0.0" /> + + <Properties> + <DisplayName>FPCL.Windows8.Windows</DisplayName> + <PublisherDisplayName>joaqu</PublisherDisplayName> + <Logo>Assets\StoreLogo.png</Logo> + </Properties> + + <Prerequisites> + <OSMinVersion>6.3.0</OSMinVersion> + <OSMaxVersionTested>6.3.0</OSMaxVersionTested> + </Prerequisites> + + <Resources> + <Resource Language="x-generate"/> + </Resources> + + <Applications> + <Application Id="App" + Executable="$targetnametoken$.exe" + EntryPoint="FPCL.Windows8.Windows.App"> + <m2:VisualElements + DisplayName="FPCL.Windows8.Windows" + Square150x150Logo="Assets\Logo.png" + Square30x30Logo="Assets\SmallLogo.png" + Description="FPCL.Windows8.Windows" + ForegroundText="light" + BackgroundColor="#464646"> + <m2:SplashScreen Image="Assets\SplashScreen.png" /> + </m2:VisualElements> + </Application> + </Applications> + <Capabilities> + <Capability Name="internetClient" /> + </Capabilities> +</Package>
\ No newline at end of file diff --git a/PagesGallery/PagesGallery.Windows/PagesGallery.Windows.csproj b/PagesGallery/PagesGallery.Windows/PagesGallery.Windows.csproj new file mode 100644 index 00000000..13472fde --- /dev/null +++ b/PagesGallery/PagesGallery.Windows/PagesGallery.Windows.csproj @@ -0,0 +1,183 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{0948BB67-B926-4B4C-A093-9B49211DD801}</ProjectGuid> + <OutputType>AppContainerExe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>PagesGallery.Windows</RootNamespace> + <AssemblyName>PagesGallery.Windows</AssemblyName> + <DefaultLanguage>en-US</DefaultLanguage> + <TargetPlatformVersion>8.1</TargetPlatformVersion> + <MinimumVisualStudioVersion>12</MinimumVisualStudioVersion> + <FileAlignment>512</FileAlignment> + <SynthesizeLinkMetadata>true</SynthesizeLinkMetadata> + <ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <PackageCertificateKeyFile>Windows_TemporaryKey.pfx</PackageCertificateKeyFile> + <NuGetPackageImportStamp> + </NuGetPackageImportStamp> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_APP</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE;NETFX_CORE;WINDOWS_APP</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'"> + <DebugSymbols>true</DebugSymbols> + <OutputPath>bin\ARM\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_APP</DefineConstants> + <NoWarn>;2008</NoWarn> + <DebugType>full</DebugType> + <PlatformTarget>ARM</PlatformTarget> + <UseVSHostingProcess>false</UseVSHostingProcess> + <ErrorReport>prompt</ErrorReport> + <Prefer32Bit>true</Prefer32Bit> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'"> + <OutputPath>bin\ARM\Release\</OutputPath> + <DefineConstants>TRACE;NETFX_CORE;WINDOWS_APP</DefineConstants> + <Optimize>true</Optimize> + <NoWarn>;2008</NoWarn> + <DebugType>pdbonly</DebugType> + <PlatformTarget>ARM</PlatformTarget> + <UseVSHostingProcess>false</UseVSHostingProcess> + <ErrorReport>prompt</ErrorReport> + <Prefer32Bit>true</Prefer32Bit> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> + <DebugSymbols>true</DebugSymbols> + <OutputPath>bin\x64\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_APP</DefineConstants> + <NoWarn>;2008</NoWarn> + <DebugType>full</DebugType> + <PlatformTarget>x64</PlatformTarget> + <UseVSHostingProcess>false</UseVSHostingProcess> + <ErrorReport>prompt</ErrorReport> + <Prefer32Bit>true</Prefer32Bit> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> + <OutputPath>bin\x64\Release\</OutputPath> + <DefineConstants>TRACE;NETFX_CORE;WINDOWS_APP</DefineConstants> + <Optimize>true</Optimize> + <NoWarn>;2008</NoWarn> + <DebugType>pdbonly</DebugType> + <PlatformTarget>x64</PlatformTarget> + <UseVSHostingProcess>false</UseVSHostingProcess> + <ErrorReport>prompt</ErrorReport> + <Prefer32Bit>true</Prefer32Bit> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> + <DebugSymbols>true</DebugSymbols> + <OutputPath>bin\x86\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_APP</DefineConstants> + <NoWarn>;2008</NoWarn> + <DebugType>full</DebugType> + <PlatformTarget>x86</PlatformTarget> + <UseVSHostingProcess>false</UseVSHostingProcess> + <ErrorReport>prompt</ErrorReport> + <Prefer32Bit>true</Prefer32Bit> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> + <OutputPath>bin\x86\Release\</OutputPath> + <DefineConstants>TRACE;NETFX_CORE;WINDOWS_APP</DefineConstants> + <Optimize>true</Optimize> + <NoWarn>;2008</NoWarn> + <DebugType>pdbonly</DebugType> + <PlatformTarget>x86</PlatformTarget> + <UseVSHostingProcess>false</UseVSHostingProcess> + <ErrorReport>prompt</ErrorReport> + <Prefer32Bit>true</Prefer32Bit> + </PropertyGroup> + <ItemGroup> + <Compile Include="App.xaml.cs"> + <DependentUpon>App.xaml</DependentUpon> + </Compile> + <Compile Include="MainPage.xaml.cs"> + <DependentUpon>MainPage.xaml</DependentUpon> + </Compile> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <AppxManifest Include="Package.appxmanifest"> + <SubType>Designer</SubType> + </AppxManifest> + <None Include="packages.config" /> + <None Include="Windows_TemporaryKey.pfx" /> + </ItemGroup> + <ItemGroup> + <Content Include="Assets\Logo.scale-100.png" /> + <Content Include="Assets\SmallLogo.scale-100.png" /> + <Content Include="Assets\SplashScreen.scale-100.png" /> + <Content Include="Assets\StoreLogo.scale-100.png" /> + </ItemGroup> + <ItemGroup> + <ApplicationDefinition Include="App.xaml"> + <SubType>Designer</SubType> + </ApplicationDefinition> + <Page Include="MainPage.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\PagesGallery\PagesGallery.csproj"> + <Name>PagesGallery</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <Reference Include="Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Xamarin.Forms.2.0.0.6482\lib\win81\Xamarin.Forms.Core.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Xamarin.Forms.Platform, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Xamarin.Forms.2.0.0.6482\lib\win81\Xamarin.Forms.Platform.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Xamarin.Forms.Platform.WinRT, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Xamarin.Forms.2.0.0.6482\lib\win81\Xamarin.Forms.Platform.WinRT.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Xamarin.Forms.Platform.WinRT.Tablet, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Xamarin.Forms.2.0.0.6482\lib\win81\Xamarin.Forms.Platform.WinRT.Tablet.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Xamarin.Forms.Xaml, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Xamarin.Forms.2.0.0.6482\lib\win81\Xamarin.Forms.Xaml.dll</HintPath> + <Private>True</Private> + </Reference> + </ItemGroup> + <PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '12.0' "> + <VisualStudioVersion>12.0</VisualStudioVersion> + </PropertyGroup> + <Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" /> + <Import Project="..\..\packages\Xamarin.Forms.2.0.0.6482\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.2.0.0.6482\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" /> + <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> + <PropertyGroup> + <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> + </PropertyGroup> + <Error Condition="!Exists('..\..\packages\Xamarin.Forms.2.0.0.6482\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.2.0.0.6482\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets'))" /> + </Target> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project>
\ No newline at end of file diff --git a/PagesGallery/PagesGallery.Windows/Properties/AssemblyInfo.cs b/PagesGallery/PagesGallery.Windows/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..2912048a --- /dev/null +++ b/PagesGallery/PagesGallery.Windows/Properties/AssemblyInfo.cs @@ -0,0 +1,29 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle ("PagesGallery.Windows.Windows")] +[assembly: AssemblyDescription ("")] +[assembly: AssemblyConfiguration ("")] +[assembly: AssemblyCompany ("")] +[assembly: AssemblyProduct ("PagesGallery.Windows.Windows")] +[assembly: AssemblyCopyright ("Copyright © 2015")] +[assembly: AssemblyTrademark ("")] +[assembly: AssemblyCulture ("")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion ("1.0.0.0")] +[assembly: AssemblyFileVersion ("1.0.0.0")] +[assembly: ComVisible (false)]
\ No newline at end of file diff --git a/PagesGallery/PagesGallery.Windows/Windows_TemporaryKey.pfx b/PagesGallery/PagesGallery.Windows/Windows_TemporaryKey.pfx Binary files differnew file mode 100644 index 00000000..27389f27 --- /dev/null +++ b/PagesGallery/PagesGallery.Windows/Windows_TemporaryKey.pfx diff --git a/PagesGallery/PagesGallery.Windows/packages.config b/PagesGallery/PagesGallery.Windows/packages.config new file mode 100644 index 00000000..b258b22f --- /dev/null +++ b/PagesGallery/PagesGallery.Windows/packages.config @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="Xamarin.Forms" version="2.0.0.6482" targetFramework="win81" /> +</packages>
\ No newline at end of file diff --git a/PagesGallery/PagesGallery.iOS/AppDelegate.cs b/PagesGallery/PagesGallery.iOS/AppDelegate.cs new file mode 100644 index 00000000..7d59ad21 --- /dev/null +++ b/PagesGallery/PagesGallery.iOS/AppDelegate.cs @@ -0,0 +1,29 @@ +using Foundation; +using UIKit; +using Xamarin.Forms; +using Xamarin.Forms.Platform.iOS; + +namespace PagesGallery.iOS +{ + // The UIApplicationDelegate for the application. This class is responsible for launching the + // User Interface of the application, as well as listening (and optionally responding) to + // application events from iOS. + [Register("AppDelegate")] + public class AppDelegate : FormsApplicationDelegate + { + // + // This method is invoked when the application has loaded and is ready to run. In this + // method you should instantiate the window, load the UI into it and then make the window + // visible. + // + // You have 17 seconds to return from this method, or iOS will terminate your application. + // + public override bool FinishedLaunching(UIApplication app, NSDictionary options) + { + Forms.Init(); + LoadApplication(new App()); + + return base.FinishedLaunching(app, options); + } + } +}
\ No newline at end of file diff --git a/PagesGallery/PagesGallery.iOS/Entitlements.plist b/PagesGallery/PagesGallery.iOS/Entitlements.plist new file mode 100644 index 00000000..e9a3005f --- /dev/null +++ b/PagesGallery/PagesGallery.iOS/Entitlements.plist @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> +</dict> +</plist> + diff --git a/PagesGallery/PagesGallery.iOS/Info.plist b/PagesGallery/PagesGallery.iOS/Info.plist new file mode 100644 index 00000000..c68a0161 --- /dev/null +++ b/PagesGallery/PagesGallery.iOS/Info.plist @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> + <dict> + <key>UIDeviceFamily</key> + <array> + <integer>1</integer> + <integer>2</integer> + </array> + <key>UISupportedInterfaceOrientations</key> + <array> + <string>UIInterfaceOrientationPortrait</string> + <string>UIInterfaceOrientationLandscapeLeft</string> + <string>UIInterfaceOrientationLandscapeRight</string> + </array> + <key>UISupportedInterfaceOrientations~ipad</key> + <array> + <string>UIInterfaceOrientationPortrait</string> + <string>UIInterfaceOrientationPortraitUpsideDown</string> + <string>UIInterfaceOrientationLandscapeLeft</string> + <string>UIInterfaceOrientationLandscapeRight</string> + </array> + <key>MinimumOSVersion</key> + <string>6.0</string> + <key>CFBundleDisplayName</key> + <string>PagesGallery</string> + <key>CFBundleIdentifier</key> + <string>com.yourcompany.PagesGallery</string> + <key>CFBundleVersion</key> + <string>1.0</string> + <key>CFBundleIconFiles</key> + <array> + <string>Icon-60@2x</string> + <string>Icon-60@3x</string> + <string>Icon-76</string> + <string>Icon-76@2x</string> + <string>Default</string> + <string>Default@2x</string> + <string>Default-568h@2x</string> + <string>Default-Portrait</string> + <string>Default-Portrait@2x</string> + <string>Icon-Small-40</string> + <string>Icon-Small-40@2x</string> + <string>Icon-Small-40@3x</string> + <string>Icon-Small</string> + <string>Icon-Small@2x</string> + <string>Icon-Small@3x</string> + </array> + <key>UILaunchStoryboardName</key> + <string>LaunchScreen</string> + </dict> +</plist> diff --git a/PagesGallery/PagesGallery.iOS/Main.cs b/PagesGallery/PagesGallery.iOS/Main.cs new file mode 100644 index 00000000..b4caffaa --- /dev/null +++ b/PagesGallery/PagesGallery.iOS/Main.cs @@ -0,0 +1,15 @@ +using UIKit; + +namespace PagesGallery.iOS +{ + public class Application + { + // This is the main entry point of the application. + static void Main(string[] args) + { + // if you want to use a different Application Delegate class from "AppDelegate" + // you can specify it here. + UIApplication.Main(args, null, "AppDelegate"); + } + } +}
\ No newline at end of file diff --git a/PagesGallery/PagesGallery.iOS/PagesGallery.iOS.csproj b/PagesGallery/PagesGallery.iOS/PagesGallery.iOS.csproj new file mode 100644 index 00000000..8607831c --- /dev/null +++ b/PagesGallery/PagesGallery.iOS/PagesGallery.iOS.csproj @@ -0,0 +1,160 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform> + <ProductVersion>8.0.30703</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{392156B2-760A-4EE3-A822-CABD3238A21D}</ProjectGuid> + <ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <OutputType>Exe</OutputType> + <RootNamespace>PagesGallery.iOS</RootNamespace> + <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix> + <AssemblyName>PagesGalleryiOS</AssemblyName> + <NuGetPackageImportStamp> + </NuGetPackageImportStamp> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\iPhoneSimulator\Debug</OutputPath> + <DefineConstants>DEBUG</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <ConsolePause>false</ConsolePause> + <MtouchArch>i386, x86_64</MtouchArch> + <MtouchLink>None</MtouchLink> + <MtouchDebug>true</MtouchDebug> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' "> + <DebugType>none</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\iPhoneSimulator\Release</OutputPath> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <MtouchLink>None</MtouchLink> + <MtouchArch>i386, x86_64</MtouchArch> + <ConsolePause>false</ConsolePause> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\iPhone\Debug</OutputPath> + <DefineConstants>DEBUG</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <ConsolePause>false</ConsolePause> + <MtouchArch>ARMv7, ARM64</MtouchArch> + <CodesignKey>iPhone Developer</CodesignKey> + <MtouchDebug>true</MtouchDebug> + <CodesignEntitlements>Entitlements.plist</CodesignEntitlements> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' "> + <DebugType>none</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\iPhone\Release</OutputPath> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <MtouchArch>ARMv7, ARM64</MtouchArch> + <ConsolePause>false</ConsolePause> + <CodesignKey>iPhone Developer</CodesignKey> + <CodesignEntitlements>Entitlements.plist</CodesignEntitlements> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' "> + <DebugType>none</DebugType> + <Optimize>True</Optimize> + <OutputPath>bin\iPhone\Ad-Hoc</OutputPath> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <ConsolePause>False</ConsolePause> + <MtouchArch>ARMv7, ARM64</MtouchArch> + <BuildIpa>True</BuildIpa> + <CodesignProvision>Automatic:AdHoc</CodesignProvision> + <CodesignKey>iPhone Distribution</CodesignKey> + <CodesignEntitlements>Entitlements.plist</CodesignEntitlements> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' "> + <DebugType>none</DebugType> + <Optimize>True</Optimize> + <OutputPath>bin\iPhone\AppStore</OutputPath> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <ConsolePause>False</ConsolePause> + <MtouchArch>ARMv7, ARM64</MtouchArch> + <CodesignProvision>Automatic:AppStore</CodesignProvision> + <CodesignKey>iPhone Distribution</CodesignKey> + <CodesignEntitlements>Entitlements.plist</CodesignEntitlements> + </PropertyGroup> + <ItemGroup> + <Compile Include="Main.cs" /> + <Compile Include="AppDelegate.cs" /> + <None Include="app.config" /> + <None Include="Entitlements.plist" /> + <None Include="Info.plist" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <ITunesArtwork Include="iTunesArtwork" /> + <ITunesArtwork Include="iTunesArtwork@2x" /> + <None Include="packages.config"> + <SubType>Designer</SubType> + </None> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\Stubs\Xamarin.Forms.Platform.iOS\Xamarin.Forms.Platform.iOS %28Forwarders%29.csproj"> + <Project>{39b3457f-01d8-43d0-8e84-d8c4f73cf48d}</Project> + <Name>Xamarin.Forms.Platform.iOS %28Forwarders%29</Name> + </ProjectReference> + <ProjectReference Include="..\..\Xamarin.Forms.Core\Xamarin.Forms.Core.csproj"> + <Project>{57b8b73d-c3b5-4c42-869e-7b2f17d354ac}</Project> + <Name>Xamarin.Forms.Core</Name> + </ProjectReference> + <ProjectReference Include="..\..\Xamarin.Forms.Pages\Xamarin.Forms.Pages.csproj"> + <Project>{d6133dbd-6c60-4bd5-bea2-07e0a3927c31}</Project> + <Name>Xamarin.Forms.Pages</Name> + </ProjectReference> + <ProjectReference Include="..\..\Xamarin.Forms.Platform.iOS\Xamarin.Forms.Platform.iOS.csproj"> + <Project>{271193c1-6e7c-429c-a36d-3f1be5267231}</Project> + <Name>Xamarin.Forms.Platform.iOS</Name> + <IsAppExtension>false</IsAppExtension> + <IsWatchApp>false</IsWatchApp> + </ProjectReference> + <ProjectReference Include="..\..\Xamarin.Forms.Xaml\Xamarin.Forms.Xaml.csproj"> + <Project>{9db2f292-8034-4e06-89ad-98bbda4306b9}</Project> + <Name>Xamarin.Forms.Xaml</Name> + </ProjectReference> + <ProjectReference Include="..\PagesGallery\PagesGallery.csproj"> + <Name>PagesGallery</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <BundleResource Include="Resources\Default-568h%402x.png" /> + <BundleResource Include="Resources\Default-Portrait.png" /> + <BundleResource Include="Resources\Default-Portrait%402x.png" /> + <BundleResource Include="Resources\Default.png" /> + <BundleResource Include="Resources\Default%402x.png" /> + <BundleResource Include="Resources\Icon-60%402x.png" /> + <BundleResource Include="Resources\Icon-60%403x.png" /> + <BundleResource Include="Resources\Icon-76.png" /> + <BundleResource Include="Resources\Icon-76%402x.png" /> + <BundleResource Include="Resources\Icon-Small-40.png" /> + <BundleResource Include="Resources\Icon-Small-40%402x.png" /> + <BundleResource Include="Resources\Icon-Small-40%403x.png" /> + <BundleResource Include="Resources\Icon-Small.png" /> + <BundleResource Include="Resources\Icon-Small%402x.png" /> + <BundleResource Include="Resources\Icon-Small%403x.png" /> + <InterfaceDefinition Include="Resources\LaunchScreen.storyboard" /> + </ItemGroup> + <ItemGroup> + <Reference Include="ModernHttpClient, Version=2.4.2.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\modernhttpclient.2.4.2\lib\Xamarin.iOS10\ModernHttpClient.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Xml" /> + <Reference Include="System.Core" /> + <Reference Include="Xamarin.iOS" /> + </ItemGroup> + <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" /> + <Import Project="..\..\.nuspec\Xamarin.Forms.targets" /> +</Project>
\ No newline at end of file diff --git a/PagesGallery/PagesGallery.iOS/Properties/AssemblyInfo.cs b/PagesGallery/PagesGallery.iOS/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..c91e3867 --- /dev/null +++ b/PagesGallery/PagesGallery.iOS/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle ("PagesGallery.iOS")] +[assembly: AssemblyDescription ("")] +[assembly: AssemblyConfiguration ("")] +[assembly: AssemblyCompany ("")] +[assembly: AssemblyProduct ("PagesGallery.iOS")] +[assembly: AssemblyCopyright ("Copyright © 2014")] +[assembly: AssemblyTrademark ("")] +[assembly: AssemblyCulture ("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible (false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid ("72bdc44f-c588-44f3-b6df-9aace7daafdd")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion ("1.0.0.0")] +[assembly: AssemblyFileVersion ("1.0.0.0")] diff --git a/PagesGallery/PagesGallery.iOS/Resources/Default-568h@2x.png b/PagesGallery/PagesGallery.iOS/Resources/Default-568h@2x.png Binary files differnew file mode 100644 index 00000000..26c6461e --- /dev/null +++ b/PagesGallery/PagesGallery.iOS/Resources/Default-568h@2x.png diff --git a/PagesGallery/PagesGallery.iOS/Resources/Default-Portrait.png b/PagesGallery/PagesGallery.iOS/Resources/Default-Portrait.png Binary files differnew file mode 100644 index 00000000..5d0d1ab4 --- /dev/null +++ b/PagesGallery/PagesGallery.iOS/Resources/Default-Portrait.png diff --git a/PagesGallery/PagesGallery.iOS/Resources/Default-Portrait@2x.png b/PagesGallery/PagesGallery.iOS/Resources/Default-Portrait@2x.png Binary files differnew file mode 100644 index 00000000..0ee2688e --- /dev/null +++ b/PagesGallery/PagesGallery.iOS/Resources/Default-Portrait@2x.png diff --git a/PagesGallery/PagesGallery.iOS/Resources/Default.png b/PagesGallery/PagesGallery.iOS/Resources/Default.png Binary files differnew file mode 100644 index 00000000..b74643c0 --- /dev/null +++ b/PagesGallery/PagesGallery.iOS/Resources/Default.png diff --git a/PagesGallery/PagesGallery.iOS/Resources/Default@2x.png b/PagesGallery/PagesGallery.iOS/Resources/Default@2x.png Binary files differnew file mode 100644 index 00000000..dbd6bd3e --- /dev/null +++ b/PagesGallery/PagesGallery.iOS/Resources/Default@2x.png diff --git a/PagesGallery/PagesGallery.iOS/Resources/Icon-60@2x.png b/PagesGallery/PagesGallery.iOS/Resources/Icon-60@2x.png Binary files differnew file mode 100644 index 00000000..4b03c427 --- /dev/null +++ b/PagesGallery/PagesGallery.iOS/Resources/Icon-60@2x.png diff --git a/PagesGallery/PagesGallery.iOS/Resources/Icon-60@3x.png b/PagesGallery/PagesGallery.iOS/Resources/Icon-60@3x.png Binary files differnew file mode 100644 index 00000000..b03ca1bb --- /dev/null +++ b/PagesGallery/PagesGallery.iOS/Resources/Icon-60@3x.png diff --git a/PagesGallery/PagesGallery.iOS/Resources/Icon-76.png b/PagesGallery/PagesGallery.iOS/Resources/Icon-76.png Binary files differnew file mode 100644 index 00000000..587982e2 --- /dev/null +++ b/PagesGallery/PagesGallery.iOS/Resources/Icon-76.png diff --git a/PagesGallery/PagesGallery.iOS/Resources/Icon-76@2x.png b/PagesGallery/PagesGallery.iOS/Resources/Icon-76@2x.png Binary files differnew file mode 100644 index 00000000..cd4e2c8f --- /dev/null +++ b/PagesGallery/PagesGallery.iOS/Resources/Icon-76@2x.png diff --git a/PagesGallery/PagesGallery.iOS/Resources/Icon-Small-40.png b/PagesGallery/PagesGallery.iOS/Resources/Icon-Small-40.png Binary files differnew file mode 100644 index 00000000..6acff944 --- /dev/null +++ b/PagesGallery/PagesGallery.iOS/Resources/Icon-Small-40.png diff --git a/PagesGallery/PagesGallery.iOS/Resources/Icon-Small-40@2x.png b/PagesGallery/PagesGallery.iOS/Resources/Icon-Small-40@2x.png Binary files differnew file mode 100644 index 00000000..b833aac2 --- /dev/null +++ b/PagesGallery/PagesGallery.iOS/Resources/Icon-Small-40@2x.png diff --git a/PagesGallery/PagesGallery.iOS/Resources/Icon-Small-40@3x.png b/PagesGallery/PagesGallery.iOS/Resources/Icon-Small-40@3x.png Binary files differnew file mode 100644 index 00000000..ab8654e4 --- /dev/null +++ b/PagesGallery/PagesGallery.iOS/Resources/Icon-Small-40@3x.png diff --git a/PagesGallery/PagesGallery.iOS/Resources/Icon-Small.png b/PagesGallery/PagesGallery.iOS/Resources/Icon-Small.png Binary files differnew file mode 100644 index 00000000..33db7e71 --- /dev/null +++ b/PagesGallery/PagesGallery.iOS/Resources/Icon-Small.png diff --git a/PagesGallery/PagesGallery.iOS/Resources/Icon-Small@2x.png b/PagesGallery/PagesGallery.iOS/Resources/Icon-Small@2x.png Binary files differnew file mode 100644 index 00000000..bf45e259 --- /dev/null +++ b/PagesGallery/PagesGallery.iOS/Resources/Icon-Small@2x.png diff --git a/PagesGallery/PagesGallery.iOS/Resources/Icon-Small@3x.png b/PagesGallery/PagesGallery.iOS/Resources/Icon-Small@3x.png Binary files differnew file mode 100644 index 00000000..7ad3891b --- /dev/null +++ b/PagesGallery/PagesGallery.iOS/Resources/Icon-Small@3x.png diff --git a/PagesGallery/PagesGallery.iOS/Resources/LaunchScreen.storyboard b/PagesGallery/PagesGallery.iOS/Resources/LaunchScreen.storyboard new file mode 100644 index 00000000..a639c2f1 --- /dev/null +++ b/PagesGallery/PagesGallery.iOS/Resources/LaunchScreen.storyboard @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6245" systemVersion="13F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="X5k-f2-b5h"> + <dependencies> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/> + </dependencies> + <scenes> + <!--View Controller--> + <scene sceneID="gAE-YM-kbH"> + <objects> + <viewController id="X5k-f2-b5h" sceneMemberID="viewController"> + <layoutGuides> + <viewControllerLayoutGuide type="top" id="Y8P-hJ-Z43"/> + <viewControllerLayoutGuide type="bottom" id="9ZL-r4-8FZ"/> + </layoutGuides> + <view key="view" contentMode="scaleToFill" id="yd7-JS-zBw"> + <rect key="frame" x="0.0" y="0.0" width="600" height="600"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <imageView userInteractionEnabled="NO" contentMode="scaleToFill" misplaced="YES" image="Icon-60.png" translatesAutoresizingMaskIntoConstraints="NO" id="23"> + <rect key="frame" x="270" y="270" width="60" height="60"/> + <rect key="contentStretch" x="0.0" y="0.0" width="0.0" height="0.0"/> + </imageView> + </subviews> + <color key="backgroundColor" red="0.20392156862745098" green="0.59607843137254901" blue="0.85882352941176465" alpha="1" colorSpace="calibratedRGB"/> + <constraints> + <constraint firstItem="23" firstAttribute="centerY" secondItem="yd7-JS-zBw" secondAttribute="centerY" priority="1" id="39"/> + <constraint firstItem="23" firstAttribute="centerX" secondItem="yd7-JS-zBw" secondAttribute="centerX" priority="1" id="41"/> + </constraints> + </view> + </viewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="XAI-xm-WK6" userLabel="First Responder" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="349" y="339"/> + </scene> + </scenes> + <resources> + <image name="Icon-60.png" width="180" height="180"/> + </resources> +</document> diff --git a/PagesGallery/PagesGallery.iOS/app.config b/PagesGallery/PagesGallery.iOS/app.config new file mode 100644 index 00000000..4dd3b43c --- /dev/null +++ b/PagesGallery/PagesGallery.iOS/app.config @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.5.0.0" newVersion="1.5.0.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration>
\ No newline at end of file diff --git a/PagesGallery/PagesGallery.iOS/iTunesArtwork b/PagesGallery/PagesGallery.iOS/iTunesArtwork Binary files differnew file mode 100644 index 00000000..94c8ebd6 --- /dev/null +++ b/PagesGallery/PagesGallery.iOS/iTunesArtwork diff --git a/PagesGallery/PagesGallery.iOS/iTunesArtwork@2x b/PagesGallery/PagesGallery.iOS/iTunesArtwork@2x Binary files differnew file mode 100644 index 00000000..fa2ebf72 --- /dev/null +++ b/PagesGallery/PagesGallery.iOS/iTunesArtwork@2x diff --git a/PagesGallery/PagesGallery.iOS/packages.config b/PagesGallery/PagesGallery.iOS/packages.config new file mode 100644 index 00000000..f0eba649 --- /dev/null +++ b/PagesGallery/PagesGallery.iOS/packages.config @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="modernhttpclient" version="2.4.2" targetFramework="xamarinios10" /> +</packages>
\ No newline at end of file diff --git a/PagesGallery/PagesGallery/App.xaml b/PagesGallery/PagesGallery/App.xaml new file mode 100644 index 00000000..18a5e0f3 --- /dev/null +++ b/PagesGallery/PagesGallery/App.xaml @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="utf-8" ?> +<Application xmlns="http://xamarin.com/schemas/2014/forms" + xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" + xmlns:local="clr-namespace:PagesGallery" + xmlns:p="clr-namespace:Xamarin.Forms.Pages;assembly=Xamarin.Forms.Pages" + x:Class="PagesGallery.App"> + <Application.Resources> + <ResourceDictionary> + + <local:CapitalizationConverter x:Key="capitalizeConverter" /> + + <Style x:Key="EventPageStyle" TargetType="p:DataPage"> + <Setter Property="ControlTemplate"> + <ControlTemplate> + <p:ListDataPageControl /> + </ControlTemplate> + </Setter> + </Style> + + <Style Class="Speakers" ApplyToDerivedTypes="True" CanCascade="True" TargetType="p:DataPage" BasedOn="{StaticResource EventPageStyle}" /> + + <Style x:Key="DetailPageStyle" TargetType="p:DataPage"> + <Setter Property="ControlTemplate"> + <ControlTemplate> + <StackLayout Spacing="0"> + <ContentPresenter /> + <ListView ItemsSource="{TemplateBinding Data}" ItemTemplate="{TemplateBinding DefaultItemTemplate}" HasUnevenRows="true" /> + </StackLayout> + </ControlTemplate> + </Setter> + </Style> + + <Style TargetType="p:HeroImage"> + <Setter Property="ControlTemplate"> + <ControlTemplate> + <Grid BackgroundColor="Black" HeightRequest="300"> + <Grid.RowDefinitions> + <RowDefinition Height="4*" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="*" /> + </Grid.RowDefinitions> + <Image Grid.RowSpan="4" Source="{TemplateBinding ImageSource}" Aspect="{TemplateBinding Aspect}" Opacity="0.6" /> + <Label Grid.Row="1" Margin="25,0,0,0" Text="{TemplateBinding Text}" FontSize="25" TextColor="White" /> + <Label Grid.Row="2" Margin="25,0,0,0" Text="{TemplateBinding Detail}" FontSize="20" TextColor="White" /> + </Grid> + </ControlTemplate> + </Setter> + </Style> + + <DataTemplate x:Key="DetailCell"> + <ViewCell IsEnabled="false"> + <StackLayout Padding="15,5,5,5"> + <Label Text="{Binding Name, Converter={StaticResource capitalizeConverter}}" FontSize="16" /> + <Label Text="{Binding Value}" FontSize="14" TextColor="#444" LineBreakMode="WordWrap" /> + </StackLayout> + </ViewCell> + </DataTemplate> + + <DataTemplate x:Key="SpeakerDetailTemplate"> + <local:EventDetailsPage Title="Speaker Details" DataSource="{Binding Value}" Style="{StaticResource DetailPageStyle}" DefaultItemTemplate="{StaticResource DetailCell}" > + <p:HeroImage Aspect="Fill" Text="{p:DataSourceBinding name}" Detail="{p:DataSourceBinding email}" ImageSource="{p:DataSourceBinding picture}" DataSource="{Binding Value}" /> + </local:EventDetailsPage> + </DataTemplate> + + <DataTemplate x:Key="EventDetailTemplate"> + <local:EventDetailsPage Title="Event Details" DataSource="{Binding Value}" Style="{StaticResource DetailPageStyle}" DefaultItemTemplate="{StaticResource DetailCell}" > + <p:HeroImage Aspect="Fill" Text="{p:DataSourceBinding name}" Detail="{p:DataSourceBinding presenter}" ImageSource="{p:DataSourceBinding picture}" DataSource="{Binding Value}" /> + </local:EventDetailsPage> + </DataTemplate> + + </ResourceDictionary> + </Application.Resources> +</Application>
\ No newline at end of file diff --git a/PagesGallery/PagesGallery/App.xaml.cs b/PagesGallery/PagesGallery/App.xaml.cs new file mode 100644 index 00000000..5cad242d --- /dev/null +++ b/PagesGallery/PagesGallery/App.xaml.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using Xamarin.Forms; + +namespace PagesGallery +{ + public partial class App : Application + { + public App () + { + InitializeComponent (); + + var eventsPage = new EventsPage (); + var speakersPage = new SpeakersPage (); + MainPage = new NavigationPage (new TabbedPage { + Title = "Xamarin Evolve 2016", + Children = { + eventsPage, + speakersPage + } + }); + } + + protected override void OnStart () + { + // Handle when your app starts + } + + protected override void OnSleep () + { + // Handle when your app sleeps + } + + protected override void OnResume () + { + // Handle when your app resumes + } + } +} diff --git a/PagesGallery/PagesGallery/CapitalizationConverter.cs b/PagesGallery/PagesGallery/CapitalizationConverter.cs new file mode 100644 index 00000000..ea4e8d0e --- /dev/null +++ b/PagesGallery/PagesGallery/CapitalizationConverter.cs @@ -0,0 +1,20 @@ +using System; +using System.Globalization; +using Xamarin.Forms; + +namespace PagesGallery +{ + public class CapitalizationConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var str = (value as string ?? value.ToString()); + return char.ToUpper(str[0]) + str.Substring(1); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +}
\ No newline at end of file diff --git a/PagesGallery/PagesGallery/EventsPage.xaml b/PagesGallery/PagesGallery/EventsPage.xaml new file mode 100644 index 00000000..2d7abafd --- /dev/null +++ b/PagesGallery/PagesGallery/EventsPage.xaml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8" ?> +<p:ListDataPage xmlns="http://xamarin.com/schemas/2014/forms" + xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" + xmlns:p="clr-namespace:Xamarin.Forms.Pages;assembly=Xamarin.Forms.Pages" + x:Class="PagesGallery.EventsPage" + Title="Events" + DetailTemplate="{StaticResource EventDetailTemplate}" + Style="{StaticResource EventPageStyle}"> + <p:DataPage.DataSource> + <p:JsonDataSource Source="http://demo7391822.mockable.io/events" /> + </p:DataPage.DataSource> + <p:DataPage.DefaultItemTemplate> + <DataTemplate> + <TextCell Text="{Binding Value[name]}" Detail="{Binding Value[presenter]}" /> + </DataTemplate> + </p:DataPage.DefaultItemTemplate> +</p:ListDataPage>
\ No newline at end of file diff --git a/PagesGallery/PagesGallery/EventsPage.xaml.cs b/PagesGallery/PagesGallery/EventsPage.xaml.cs new file mode 100644 index 00000000..695c0d01 --- /dev/null +++ b/PagesGallery/PagesGallery/EventsPage.xaml.cs @@ -0,0 +1,23 @@ +using Xamarin.Forms.Pages; + +namespace PagesGallery +{ + public partial class EventsPage : ListDataPage + { + public EventsPage() + { + InitializeComponent(); + } + } + + public class EventDetailsPage : DataPage + { + public EventDetailsPage() + { + ((IDataSourceProvider)this).MaskKey("_id"); + ((IDataSourceProvider)this).MaskKey("guid"); + ((IDataSourceProvider)this).MaskKey("index"); + ((IDataSourceProvider)this).MaskKey("isPublic"); + } + } +}
\ No newline at end of file diff --git a/PagesGallery/PagesGallery/GettingStarted.Xamarin b/PagesGallery/PagesGallery/GettingStarted.Xamarin new file mode 100644 index 00000000..f31b0091 --- /dev/null +++ b/PagesGallery/PagesGallery/GettingStarted.Xamarin @@ -0,0 +1,4 @@ +<GettingStarted> + <LocalContent>GS\XF\CS\App\GettingStarted.html</LocalContent> + <EmbeddedNavigation>false</EmbeddedNavigation> +</GettingStarted>
\ No newline at end of file diff --git a/PagesGallery/PagesGallery/PagesGallery.csproj b/PagesGallery/PagesGallery/PagesGallery.csproj new file mode 100644 index 00000000..19fdfbb6 --- /dev/null +++ b/PagesGallery/PagesGallery/PagesGallery.csproj @@ -0,0 +1,105 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>PagesGallery</RootNamespace> + <AssemblyName>PagesGallery</AssemblyName> + <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> + <TargetFrameworkProfile>Profile259</TargetFrameworkProfile> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <NuGetPackageImportStamp> + </NuGetPackageImportStamp> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Compile Include="App.xaml.cs"> + <DependentUpon>App.xaml</DependentUpon> + </Compile> + <Compile Include="CapitalizationConverter.cs" /> + <Compile Include="EventsPage.xaml.cs"> + <DependentUpon>EventsPage.xaml</DependentUpon> + </Compile> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="SpeakersPage.xaml.cs"> + <DependentUpon>SpeakersPage.xaml</DependentUpon> + </Compile> + </ItemGroup> + <ItemGroup> + <None Include="GettingStarted.Xamarin" /> + <None Include="packages.config" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\Xamarin.Forms.Core\Xamarin.Forms.Core.csproj"> + <Project>{57b8b73d-c3b5-4c42-869e-7b2f17d354ac}</Project> + <Name>Xamarin.Forms.Core</Name> + </ProjectReference> + <ProjectReference Include="..\..\Xamarin.Forms.Pages\Xamarin.Forms.Pages.csproj"> + <Project>{d6133dbd-6c60-4bd5-bea2-07e0a3927c31}</Project> + <Name>Xamarin.Forms.Pages</Name> + </ProjectReference> + <ProjectReference Include="..\..\Xamarin.Forms.Platform\Xamarin.Forms.Platform.csproj"> + <Project>{67f9d3a8-f71e-4428-913f-c37ae82cdb24}</Project> + <Name>Xamarin.Forms.Platform</Name> + </ProjectReference> + <ProjectReference Include="..\..\Xamarin.Forms.Xaml\Xamarin.Forms.Xaml.csproj"> + <Project>{9db2f292-8034-4e06-89ad-98bbda4306b9}</Project> + <Name>Xamarin.Forms.Xaml</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="App.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:UpdateDesignTimeXaml</Generator> + </EmbeddedResource> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="EventsPage.xaml"> + <Generator>MSBuild:UpdateDesignTimeXaml</Generator> + <SubType>Designer</SubType> + </EmbeddedResource> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="SpeakersPage.xaml"> + <Generator>MSBuild:UpdateDesignTimeXaml</Generator> + <SubType>Designer</SubType> + </EmbeddedResource> + </ItemGroup> + <ItemGroup> + <Reference Include="ModernHttpClient, Version=2.4.2.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\modernhttpclient.2.4.2\lib\Portable-Net45+WinRT45+WP8+WPA81\ModernHttpClient.dll</HintPath> + <Private>True</Private> + </Reference> + </ItemGroup> + <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" /> + <Import Project="..\..\.nuspec\Xamarin.Forms.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project>
\ No newline at end of file diff --git a/PagesGallery/PagesGallery/Properties/AssemblyInfo.cs b/PagesGallery/PagesGallery/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..e5188feb --- /dev/null +++ b/PagesGallery/PagesGallery/Properties/AssemblyInfo.cs @@ -0,0 +1,30 @@ +using System.Resources; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle ("PagesGallery")] +[assembly: AssemblyDescription ("")] +[assembly: AssemblyConfiguration ("")] +[assembly: AssemblyCompany ("")] +[assembly: AssemblyProduct ("PagesGallery")] +[assembly: AssemblyCopyright ("Copyright © 2014")] +[assembly: AssemblyTrademark ("")] +[assembly: AssemblyCulture ("")] +[assembly: NeutralResourcesLanguage ("en")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion ("1.0.0.0")] +[assembly: AssemblyFileVersion ("1.0.0.0")] diff --git a/PagesGallery/PagesGallery/SpeakersPage.xaml b/PagesGallery/PagesGallery/SpeakersPage.xaml new file mode 100644 index 00000000..1bfcc8db --- /dev/null +++ b/PagesGallery/PagesGallery/SpeakersPage.xaml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8" ?> +<p:ListDataPage xmlns="http://xamarin.com/schemas/2014/forms" + xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" + xmlns:p="clr-namespace:Xamarin.Forms.Pages;assembly=Xamarin.Forms.Pages" + x:Class="PagesGallery.SpeakersPage" + Title="Speakers" + DetailTemplate="{StaticResource SpeakerDetailTemplate}" + StyleClass="Speakers"> + <p:DataPage.DataSource> + <p:JsonDataSource Source="http://demo7391822.mockable.io/speakers" /> + </p:DataPage.DataSource> + <p:DataPage.DefaultItemTemplate> + <DataTemplate> + <ImageCell ImageSource="{Binding Value[picture]}" Text="{Binding Value[name]}" Detail="{Binding Value[twitter]}" /> + </DataTemplate> + </p:DataPage.DefaultItemTemplate> +</p:ListDataPage>
\ No newline at end of file diff --git a/PagesGallery/PagesGallery/SpeakersPage.xaml.cs b/PagesGallery/PagesGallery/SpeakersPage.xaml.cs new file mode 100644 index 00000000..59a927f1 --- /dev/null +++ b/PagesGallery/PagesGallery/SpeakersPage.xaml.cs @@ -0,0 +1,12 @@ +using Xamarin.Forms.Pages; + +namespace PagesGallery +{ + public partial class SpeakersPage : ListDataPage + { + public SpeakersPage() + { + InitializeComponent(); + } + } +}
\ No newline at end of file diff --git a/PagesGallery/PagesGallery/packages.config b/PagesGallery/PagesGallery/packages.config new file mode 100644 index 00000000..8f0534f1 --- /dev/null +++ b/PagesGallery/PagesGallery/packages.config @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="modernhttpclient" version="2.4.2" targetFramework="portable45-net45+win8+wp8+wpa81" /> +</packages>
\ No newline at end of file diff --git a/Xamarin.Forms.ControlGallery.Android/Activity1.cs b/Xamarin.Forms.ControlGallery.Android/Activity1.cs index 4b36a548..bc1772c6 100644 --- a/Xamarin.Forms.ControlGallery.Android/Activity1.cs +++ b/Xamarin.Forms.ControlGallery.Android/Activity1.cs @@ -15,6 +15,7 @@ using Xamarin.Forms.ControlGallery.Android; using Xamarin.Forms.Controls; using Xamarin.Forms.Maps.Android; using Xamarin.Forms.Platform.Android; +using Xamarin.Forms.Platform.Android.AppLinks; using System.IO; using System.IO.IsolatedStorage; @@ -316,6 +317,7 @@ namespace Xamarin.Forms.ControlGallery.Android Forms.Init (this, bundle); FormsMaps.Init (this, bundle); + AndroidAppLinks.Init(this); Forms.ViewInitialized += (sender, e) => { // if (!string.IsNullOrWhiteSpace(e.View.StyleId)) { // e.NativeView.ContentDescription = e.View.StyleId; diff --git a/Xamarin.Forms.ControlGallery.Android/Properties/AndroidManifest.xml b/Xamarin.Forms.ControlGallery.Android/Properties/AndroidManifest.xml index 9bbcafdf..693419a7 100644 --- a/Xamarin.Forms.ControlGallery.Android/Properties/AndroidManifest.xml +++ b/Xamarin.Forms.ControlGallery.Android/Properties/AndroidManifest.xml @@ -1,6 +1,6 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="AndroidControlGallery.AndroidControlGallery" android:installLocation="auto"> - <uses-sdk android:minSdkVersion="15" /> + <uses-sdk android:minSdkVersion="15" android:targetSdkVersion="23" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> diff --git a/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj b/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj index cfaa1c22..6ba585d9 100644 --- a/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj +++ b/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj @@ -230,6 +230,10 @@ <Project>{7d13bac2-c6a4-416a-b07e-c169b199e52b}</Project> <Name>Xamarin.Forms.Maps</Name> </ProjectReference> + <ProjectReference Include="..\Xamarin.Forms.Platform.Android.AppLinks\Xamarin.Forms.Platform.Android.AppLinks.csproj"> + <Project>{42db052e-0909-45d2-8240-187f99f393fb}</Project> + <Name>Xamarin.Forms.Platform.Android.AppLinks</Name> + </ProjectReference> <ProjectReference Include="..\Xamarin.Forms.Platform.Android.FormsViewGroup\Xamarin.Forms.Platform.Android.FormsViewGroup.csproj"> <Project>{3b72465b-acae-43ae-9327-10f372fe5f80}</Project> <Name>Xamarin.Forms.Platform.Android.FormsViewGroup</Name> diff --git a/Xamarin.Forms.ControlGallery.Android/app.config b/Xamarin.Forms.ControlGallery.Android/app.config index b1d2a5a3..83b882b7 100644 --- a/Xamarin.Forms.ControlGallery.Android/app.config +++ b/Xamarin.Forms.ControlGallery.Android/app.config @@ -6,6 +6,10 @@ <assemblyIdentity name="Mono.Cecil" publicKeyToken="0738eb9f132ed756" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-0.9.6.0" newVersion="0.9.6.0" /> </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.5.0.0" newVersion="1.5.0.0" /> + </dependentAssembly> </assemblyBinding> </runtime> </configuration>
\ No newline at end of file diff --git a/Xamarin.Forms.ControlGallery.iOS/app.config b/Xamarin.Forms.ControlGallery.iOS/app.config index b1d2a5a3..83b882b7 100644 --- a/Xamarin.Forms.ControlGallery.iOS/app.config +++ b/Xamarin.Forms.ControlGallery.iOS/app.config @@ -6,6 +6,10 @@ <assemblyIdentity name="Mono.Cecil" publicKeyToken="0738eb9f132ed756" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-0.9.6.0" newVersion="0.9.6.0" /> </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.5.0.0" newVersion="1.5.0.0" /> + </dependentAssembly> </assemblyBinding> </runtime> </configuration>
\ No newline at end of file diff --git a/Xamarin.Forms.Controls/App.cs b/Xamarin.Forms.Controls/App.cs index 31c356e3..b297097c 100644 --- a/Xamarin.Forms.Controls/App.cs +++ b/Xamarin.Forms.Controls/App.cs @@ -32,6 +32,37 @@ namespace Xamarin.Forms.Controls }; } + protected override void OnAppLinkRequestReceived(Uri uri) + { + + var appDomain = "http://" + AppName.ToLowerInvariant() + "/"; + + if (!uri.ToString().ToLowerInvariant().StartsWith(appDomain)) + return; + + var url = uri.ToString().Replace(appDomain, ""); + + var parts = url.Split('/'); + if (parts.Length == 2) + { + var isPage = parts[0].Trim().ToLower() == "gallery"; + if (isPage) + { + string page = parts[1].Trim(); + var pageForms = Activator.CreateInstance(Type.GetType(page)); + + var appLinkPageGallery = pageForms as AppLinkPageGallery; + if (appLinkPageGallery != null) + { + appLinkPageGallery.ShowLabel = true; + (MainPage as MasterDetailPage)?.Detail.Navigation.PushAsync((pageForms as Page)); + } + } + } + + base.OnAppLinkRequestReceived(uri); + } + public static Dictionary<string, string> Config { get diff --git a/Xamarin.Forms.Controls/CoreGallery.cs b/Xamarin.Forms.Controls/CoreGallery.cs index 7b6ed150..d060fbbc 100644 --- a/Xamarin.Forms.Controls/CoreGallery.cs +++ b/Xamarin.Forms.Controls/CoreGallery.cs @@ -196,6 +196,7 @@ namespace Xamarin.Forms.Controls { var pages = new List<Page> { new CarouselViewGallaryPage {Title = "CarouselView Gallery"}, + new AppLinkPageGallery {Title = "App Link Page Gallery"}, new NestedNativeControlGalleryPage {Title = "Nested Native Controls Gallery"}, new CellForceUpdateSizeGalleryPage {Title = "Cell Force Update Size Gallery"}, new AppearingGalleryPage {Title = "Appearing Gallery"}, diff --git a/Xamarin.Forms.Controls/GalleryPages/AppLinkPageGallery.cs b/Xamarin.Forms.Controls/GalleryPages/AppLinkPageGallery.cs new file mode 100644 index 00000000..bc765dd9 --- /dev/null +++ b/Xamarin.Forms.Controls/GalleryPages/AppLinkPageGallery.cs @@ -0,0 +1,80 @@ +using System; + +namespace Xamarin.Forms.Controls +{ + public class AppLinkPageGallery : ContentPage + { + public AppLinkPageGallery () + { + _linkEntry = GetEntry (); + _lbl = new Label { + Text = "You are on a demo page via app url", IsVisible = ShowLabel + }; + + var btnRegister = new Button { Text = "Index this Page", + Command = new Command (() => Application.Current.AppLinks.RegisterLink (LinkEntry)) + }; + var btnRemove = new Button { Text = "Remove this Page from index", + Command = new Command (() => Application.Current.AppLinks.DeregisterLink (LinkEntry)) + }; + + var btnClearAll = new Button { Text = "Clear All Indexed Data", + // Command = new Command (() => Application.Current.AppLinks.DeregisterAll ()) + }; + + Content = new StackLayout { Children = { _lbl, btnRegister, btnRemove, btnClearAll } }; + } + + protected override void OnAppearing () + { + LinkEntry.IsLinkActive = true; + } + + protected override void OnDisappearing () + { + LinkEntry.IsLinkActive = false; + } + + public bool ShowLabel { + get { + return _showlabel; + } + set { + _showlabel = value; + _lbl.IsVisible = _showlabel; + } + } + + internal IAppLinkEntry LinkEntry { + get { + return _linkEntry; + } + } + + bool _showlabel; + IAppLinkEntry _linkEntry; + Label _lbl; + + AppLinkEntry GetEntry () + { + if (string.IsNullOrEmpty (Title)) + Title = "App Link Page Gallery"; + + var type = GetType ().ToString (); + var entry = new AppLinkEntry { + Title = Title, + Description =$"This is the page {Title} \nof Xamarin Forms Gallery", + AppLinkUri = new Uri ($"http://{App.AppName}/gallery/{type}", UriKind.RelativeOrAbsolute), + IsLinkActive = true, + Thumbnail = ImageSource.FromFile ("seth.png") + }; + + entry.KeyValues.Add ("contentType", "GalleryPage"); + entry.KeyValues.Add ("appName", App.AppName); + entry.KeyValues.Add ("companyName", "Xamarin"); + + return entry; + } + } +} + diff --git a/Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj b/Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj index b5dd6af5..3252403b 100644 --- a/Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj +++ b/Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj @@ -72,6 +72,10 @@ <Project>{7d13bac2-c6a4-416a-b07e-c169b199e52b}</Project> <Name>Xamarin.Forms.Maps</Name> </ProjectReference> + <ProjectReference Include="..\Xamarin.Forms.Pages\Xamarin.Forms.Pages.csproj"> + <Project>{d6133dbd-6c60-4bd5-bea2-07e0a3927c31}</Project> + <Name>Xamarin.Forms.Pages</Name> + </ProjectReference> <ProjectReference Include="..\Xamarin.Forms.Xaml\Xamarin.Forms.Xaml.csproj"> <Project>{9db2f292-8034-4e06-89ad-98bbda4306b9}</Project> <Name>Xamarin.Forms.Xaml</Name> @@ -224,6 +228,7 @@ <Compile Include="ControlGalleryPages\PinchGestureTestPage.cs" /> <Compile Include="ControlGalleryPages\AppearingGalleryPage.cs" /> <Compile Include="ControlGalleryPages\AutomationIDGallery.cs" /> + <Compile Include="GalleryPages\AppLinkPageGallery.cs" /> </ItemGroup> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" /> <Import Project="..\.nuspec\Xamarin.Forms.targets" /> diff --git a/Xamarin.Forms.Core/AppLinkEntry.cs b/Xamarin.Forms.Core/AppLinkEntry.cs new file mode 100644 index 00000000..6942aa10 --- /dev/null +++ b/Xamarin.Forms.Core/AppLinkEntry.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; + +namespace Xamarin.Forms +{ + public class AppLinkEntry : Element, IAppLinkEntry + { + public static readonly BindableProperty TitleProperty = BindableProperty.Create(nameof(Title), typeof(string), typeof(AppLinkEntry), default(string)); + + public static readonly BindableProperty DescriptionProperty = BindableProperty.Create(nameof(Description), typeof(string), typeof(AppLinkEntry), default(string)); + + public static readonly BindableProperty ThumbnailProperty = BindableProperty.Create(nameof(Thumbnail), typeof(ImageSource), typeof(AppLinkEntry), default(ImageSource)); + + public static readonly BindableProperty AppLinkUriProperty = BindableProperty.Create(nameof(AppLinkUri), typeof(Uri), typeof(AppLinkEntry), null); + + public static readonly BindableProperty IsLinkActiveProperty = BindableProperty.Create(nameof(IsLinkActive), typeof(bool), typeof(AppLinkEntry), false); + + public Uri AppLinkUri + { + get { return (Uri)GetValue(AppLinkUriProperty); } + set { SetValue(AppLinkUriProperty, value); } + } + + public string Description + { + get { return (string)GetValue(DescriptionProperty); } + set { SetValue(DescriptionProperty, value); } + } + + public bool IsLinkActive + { + get { return (bool)GetValue(IsLinkActiveProperty); } + set { SetValue(IsLinkActiveProperty, value); } + } + + public IDictionary<string, string> KeyValues => new Dictionary<string, string>(); + + public ImageSource Thumbnail + { + get { return (ImageSource)GetValue(ThumbnailProperty); } + set { SetValue(ThumbnailProperty, value); } + } + + public string Title + { + get { return (string)GetValue(TitleProperty); } + set { SetValue(TitleProperty, value); } + } + + public static AppLinkEntry FromUri(Uri uri) + { + var appEntry = new AppLinkEntry(); + appEntry.AppLinkUri = uri; + return appEntry; + } + + public override string ToString() + { + return AppLinkUri.ToString(); + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Core/Application.cs b/Xamarin.Forms.Core/Application.cs index 1dfe258b..230b744b 100644 --- a/Xamarin.Forms.Core/Application.cs +++ b/Xamarin.Forms.Core/Application.cs @@ -10,7 +10,8 @@ namespace Xamarin.Forms { static Application s_current; readonly Task<IDictionary<string, object>> _propertiesTask; - + + IAppIndexingProvider _appIndexProvider; bool _isSaving; ReadOnlyCollection<Element> _logicalChildren; @@ -33,6 +34,18 @@ namespace Xamarin.Forms SystemResources.ValuesChanged += OnParentResourcesChanged; } + public IAppLinks AppLinks + { + get + { + if (_appIndexProvider == null) + throw new ArgumentException("No IAppIndexingProvider was provided"); + if (_appIndexProvider.AppLinks == null) + throw new ArgumentException("No AppLinks implementation was found, if in Android make sure you installed the Xamarin.Forms.AppLinks"); + return _appIndexProvider.AppLinks; + } + } + public static Application Current { get { return s_current; } @@ -94,6 +107,11 @@ namespace Xamarin.Forms ObservableCollection<Element> InternalChildren { get; } = new ObservableCollection<Element>(); + void IApplicationController.SetAppIndexingProvider(IAppIndexingProvider provider) + { + _appIndexProvider = provider; + } + public ResourceDictionary Resources { get { return _resources; } @@ -128,6 +146,10 @@ namespace Xamarin.Forms await SetPropertiesAsync(); } + protected virtual void OnAppLinkRequestReceived(Uri uri) + { + } + protected override void OnParentSet() { throw new InvalidOperationException("Setting a Parent on Application is invalid."); @@ -177,6 +199,11 @@ namespace Xamarin.Forms internal event EventHandler PopCanceled; + internal void SendOnAppLinkRequestReceived(Uri uri) + { + OnAppLinkRequestReceived(uri); + } + internal void SendResume() { s_current = this; diff --git a/Xamarin.Forms.Core/IAppIndexingProvider.cs b/Xamarin.Forms.Core/IAppIndexingProvider.cs new file mode 100644 index 00000000..86b1d611 --- /dev/null +++ b/Xamarin.Forms.Core/IAppIndexingProvider.cs @@ -0,0 +1,7 @@ +namespace Xamarin.Forms +{ + public interface IAppIndexingProvider + { + IAppLinks AppLinks { get; } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Core/IAppLinkEntry.cs b/Xamarin.Forms.Core/IAppLinkEntry.cs new file mode 100644 index 00000000..b9a77a51 --- /dev/null +++ b/Xamarin.Forms.Core/IAppLinkEntry.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; + +namespace Xamarin.Forms +{ + public interface IAppLinkEntry + { + Uri AppLinkUri { get; set; } + + string Description { get; set; } + + bool IsLinkActive { get; set; } + + IDictionary<string, string> KeyValues { get; } + + ImageSource Thumbnail { get; set; } + + string Title { get; set; } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Core/IAppLinks.cs b/Xamarin.Forms.Core/IAppLinks.cs new file mode 100644 index 00000000..9dbcf466 --- /dev/null +++ b/Xamarin.Forms.Core/IAppLinks.cs @@ -0,0 +1,11 @@ +using System; + +namespace Xamarin.Forms +{ + public interface IAppLinks + { + void DeregisterLink(IAppLinkEntry appLink); + void DeregisterLink(Uri appLinkUri); + void RegisterLink(IAppLinkEntry appLink); + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Core/IApplicationController.cs b/Xamarin.Forms.Core/IApplicationController.cs index 201032f9..d31f2c49 100644 --- a/Xamarin.Forms.Core/IApplicationController.cs +++ b/Xamarin.Forms.Core/IApplicationController.cs @@ -2,5 +2,6 @@ { public interface IApplicationController { + void SetAppIndexingProvider(IAppIndexingProvider appIndexing); } }
\ No newline at end of file diff --git a/Xamarin.Forms.Core/TemplateUtilities.cs b/Xamarin.Forms.Core/TemplateUtilities.cs index 0599e747..a965308c 100644 --- a/Xamarin.Forms.Core/TemplateUtilities.cs +++ b/Xamarin.Forms.Core/TemplateUtilities.cs @@ -110,14 +110,20 @@ namespace Xamarin.Forms } ControlTemplate template = self.ControlTemplate; - var content = template.CreateContent() as View; - - if (content == null) + if (template == null) { - throw new NotSupportedException("ControlTemplate must return a type derived from View."); + // do nothing for now } + else + { + var content = template.CreateContent() as View; + if (content == null) + { + throw new NotSupportedException("ControlTemplate must return a type derived from View."); + } - self.InternalChildren.Add(content); + self.InternalChildren.Add(content); + } } } }
\ No newline at end of file diff --git a/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj b/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj index 70d721d6..a4580fd6 100644 --- a/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj +++ b/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj @@ -395,7 +395,11 @@ <Compile Include="PinchGestureRecognizer.cs" /> <Compile Include="IStyle.cs" /> <Compile Include="MergedStyle.cs" /> + <Compile Include="IAppLinks.cs" /> + <Compile Include="IAppLinkEntry.cs" /> + <Compile Include="AppLinkEntry.cs" /> <Compile Include="IApplicationController.cs" /> + <Compile Include="IAppIndexingProvider.cs" /> </ItemGroup> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" /> <ItemGroup> diff --git a/Xamarin.Forms.Pages.UnitTests/DataPageTests.cs b/Xamarin.Forms.Pages.UnitTests/DataPageTests.cs new file mode 100644 index 00000000..49fe38b2 --- /dev/null +++ b/Xamarin.Forms.Pages.UnitTests/DataPageTests.cs @@ -0,0 +1,165 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using NUnit.Framework; +using Xamarin.Forms.Core.UnitTests; + +namespace Xamarin.Forms.Pages.UnitTests +{ + [TestFixture] + public class DataPageTests + { + [SetUp] + public void Setup () + { + Device.PlatformServices = new MockPlatformServices (); + } + + [TearDown] + public void TearDown () + { + Device.PlatformServices = null; + } + + class TestDataPage : DataPage + { + public static readonly BindableProperty NameProperty = + BindableProperty.Create (nameof (Name), typeof (string), typeof (TestDataPage), null); + + public string Name + { + get { return (string)GetValue (NameProperty); } + set { SetValue (NameProperty, value); } + } + + public TestDataPage () + { + SetBinding (NameProperty, new DataSourceBinding ("Name")); + } + } + + class DataSource : BaseDataSource + { + ObservableCollection<IDataItem> data = new ObservableCollection<IDataItem> (); + protected override Task<IList<IDataItem>> GetRawData () + { + return Task.FromResult<IList<IDataItem>> (data); + } + + protected override object GetValue (string key) + { + var target = data.FirstOrDefault (d => d.Name == key); + if (target == null) + throw new KeyNotFoundException (); + return target.Value; + } + + protected override bool SetValue (string key, object value) + { + var target = data.FirstOrDefault (d => d.Name == key); + if (target == null) + data.Add (new DataItem (key, value)); + else if (target.Value == value) + return false; + else + target.Value = value; + return true; + } + } + + [Test] + public void DefaultBindingsLoad () + { + IDataSource dataSource = new DataSource (); + dataSource["Name"] = "Jason"; + + var detailpage = new TestDataPage (); + detailpage.Platform = new UnitPlatform (); + detailpage.DataSource = dataSource; + + Assert.AreEqual ("Jason", detailpage.Name); + } + + [Test] + public void RebindingDataSource () + { + IDataSource dataSource = new DataSource (); + dataSource["UserName"] = "Jason"; + + var detailpage = new TestDataPage (); + detailpage.Platform = new UnitPlatform (); + detailpage.SetBinding (TestDataPage.NameProperty, new DataSourceBinding ("UserName")); + detailpage.DataSource = dataSource; + + Assert.AreEqual ("Jason", detailpage.Name); + } + + [Test] + public void RebindingDataSourceNotMasked () + { + IDataSource dataSource = new DataSource (); + dataSource["UserName"] = "Jason"; + + var detailpage = new TestDataPage (); + detailpage.Platform = new UnitPlatform (); + detailpage.DataSource = dataSource; + + detailpage.SetBinding (TestDataPage.NameProperty, new DataSourceBinding ("UserName")); + Assert.AreEqual ("Jason", detailpage.Name); + + Assert.AreEqual (1, detailpage.DataSource.MaskedKeys.Count ()); + } + + [Test] + public void UpdateDataSource () + { + IDataSource dataSource = new DataSource (); + dataSource["UserName"] = "Jason"; + + var detailpage = new TestDataPage (); + detailpage.Platform = new UnitPlatform (); + detailpage.SetBinding (TestDataPage.NameProperty, new DataSourceBinding ("UserName")); + detailpage.DataSource = dataSource; + + dataSource["UserName"] = "Jerry"; + + Assert.AreEqual ("Jerry", detailpage.Name); + } + + [Test] + public void MaskedItemsNotInData () + { + IDataSource dataSource = new DataSource (); + dataSource["Name"] = "Jason"; + dataSource["Other"] = "Foo"; + + var detailpage = new TestDataPage (); + detailpage.Platform = new UnitPlatform (); + detailpage.DataSource = dataSource; + + Assert.AreEqual ("Jason", detailpage.Name); + + Assert.AreEqual (1, detailpage.Data.Count ()); + Assert.AreEqual ("Other", detailpage.Data.First ().Name); + } + + [Test] + public void TwoWayDataSourceBinding () + { + IDataSource dataSource = new DataSource (); + dataSource["UserName"] = "Jason"; + + var detailpage = new TestDataPage (); + detailpage.Platform = new UnitPlatform (); + detailpage.SetBinding (TestDataPage.NameProperty, new DataSourceBinding ("UserName", BindingMode.TwoWay)); + detailpage.DataSource = dataSource; + + ((IElementController)detailpage).SetValueFromRenderer (TestDataPage.NameProperty, "John"); + + Assert.AreEqual ("John", dataSource["UserName"]); + } + } +} diff --git a/Xamarin.Forms.Pages.UnitTests/DataSourceListTests.cs b/Xamarin.Forms.Pages.UnitTests/DataSourceListTests.cs new file mode 100644 index 00000000..4585e0d6 --- /dev/null +++ b/Xamarin.Forms.Pages.UnitTests/DataSourceListTests.cs @@ -0,0 +1,81 @@ +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net.NetworkInformation; +using System.Threading.Tasks; +using NUnit.Framework; + +namespace Xamarin.Forms.Pages.UnitTests +{ + [TestFixture] + public class DataSourceListTests + { + public class TestDataSource : BaseDataSource + { + public ObservableCollection<IDataItem> DataItems { get; } = new ObservableCollection<IDataItem> (); + + protected override Task<IList<IDataItem>> GetRawData () + { + return Task.FromResult<IList<IDataItem>> (DataItems); + } + + protected override object GetValue (string key) + { + var target = DataItems.FirstOrDefault (d => d.Name == key); + if (target == null) + throw new KeyNotFoundException (); + return target.Value; + } + + protected override bool SetValue (string key, object value) + { + var target = DataItems.FirstOrDefault (d => d.Name == key); + if (target == null) + DataItems.Add (new DataItem (key, value)); + else if (target.Value == value) + return false; + else + target.Value = value; + return true; + } + } + + [Test] + public void DataSourceListIndexer () + { + var source = new TestDataSource (); + IDataSource s = source; + source.DataItems.Add (new DataItem ("Foo", "Bar")); + + Assert.AreEqual ("Bar", s["Foo"]); + + Assert.AreEqual ("Bar", s.Data[0].Value); + } + + [Test] + public void CompoundListPrepend () + { + var source = new TestDataSource (); + IDataSource s = source; + source.DataItems.Add (new DataItem ("Foo1", "Bar1")); + source.DataItems.Add (new DataItem ("Foo2", "Bar2")); + + var compoundList = new CompoundCollection { + MainList = s.Data + }; + var prependItem = new DataItem ("Pre1", "Val1"); + compoundList.PrependList.Add (prependItem); + + Assert.AreEqual (prependItem, compoundList[0]); + Assert.AreEqual (source.DataItems[0], s.Data[0]); + Assert.AreEqual (source.DataItems[1], s.Data[1]); + + Assert.AreEqual (source.DataItems[0], compoundList[1]); + Assert.AreEqual (source.DataItems[1], compoundList[2]); + + s.MaskKey ("Foo1"); + + Assert.AreEqual (source.DataItems[1], compoundList[1]); + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Pages.UnitTests/IntegrationTests.cs b/Xamarin.Forms.Pages.UnitTests/IntegrationTests.cs new file mode 100644 index 00000000..480706fc --- /dev/null +++ b/Xamarin.Forms.Pages.UnitTests/IntegrationTests.cs @@ -0,0 +1,150 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using NUnit.Framework; +using Xamarin.Forms.Core.UnitTests; + +namespace Xamarin.Forms.Pages.UnitTests +{ + [TestFixture] + internal class IntegrationTests + { + [SetUp] + public void Setup () + { + Device.PlatformServices = new MockPlatformServices (); + } + + [TearDown] + public void TearDown () + { + Device.PlatformServices = null; + } + + public class SimpleDataSource : BaseDataSource + { + readonly ObservableCollection<IDataItem> dataItems = new ObservableCollection<IDataItem> (); + string json; + + public SimpleDataSource () + { + Json = @"{ + 'Name' : 'Jason Smith', + 'Phone' : '(555)248-7561', + 'PrimaryEmail' : 'jason@xamarin.com', + 'JobTitle' : 'Software Engineering Manager', + 'TimeZone' : 'PST', + 'Image' : 'https://c1.staticflickr.com/3/2877/10612763564_7f2d1734ea_b.jpg', + 'Address' : '430 Pacific Ave, San Francisico CA, 55592', +}"; + } + + public string Json + { + get { return json; } + set + { + json = value; + try { + var dict = JsonConvert.DeserializeObject<Dictionary<string, object>> (json); + foreach (var kvp in dict) + dataItems.Add (new DataItem (kvp.Key, kvp.Value)); + } catch (Exception ex) { + Debug.WriteLine (ex.Message); + } + } + } + + protected override Task<IList<IDataItem>> GetRawData () + { + return Task.FromResult<IList<IDataItem>> (dataItems); + } + + protected override object GetValue (string key) + { + var target = dataItems.FirstOrDefault (d => d.Name == key); + if (target == null) + return null; + //throw new KeyNotFoundException (); + return target.Value; + } + + protected override bool SetValue (string key, object value) + { + var target = dataItems.FirstOrDefault (d => d.Name == key); + if (target == null) { + dataItems.Add (new DataItem (key, value)); + return true; + } + if (target.Value == value) + return false; + target.Value = value; + return true; + } + } + + public class TestPage : PersonDetailPage + { + public TestPage () + { + SetBinding (DisplayNameProperty, new DataSourceBinding ("Name")); + SetBinding (PhoneNumberProperty, new DataSourceBinding ("Phone")); + SetBinding (EmailProperty, new DataSourceBinding ("PrimaryEmail")); + } + } + + [Test] + public void Test1 () + { + var page = new TestPage (); + + page.DataSource = new SimpleDataSource (); + page.Platform = new UnitPlatform(); + + Assert.AreEqual (9, page.DataSource.MaskedKeys.Count ()); + } + + [Test] + public void JsonDataSourceComplex () + { + var jsonDataSource = new JsonDataSource (); + + var json = @"[ + { + 'Name': 'Kristen Perez', + 'Address': 'Ap #325-3386 Ac Av.', + 'Phone': '(016977) 7108', + 'Title': 'Lorem Ipsum Dolor Incorporated', + 'Email': 'ac.risus.Morbi@interdum.co.uk', + 'List' : [ + 'Foo', 'Bar', 'Baz' + ] + }, + { + 'Name': 'Murphy Cote', + 'Address': '906-6938 Porttitor Ave', + 'Phone': '076 9223 8954', + 'Title': 'Vulputate Industries', + 'Email': 'non@consequat.ca', + 'List' : [ { 'Second' : 'Thing' } ] + }, + { + 'Name': 'Nicole Valdez', + 'Address': '485-9530 Ut Rd.', + 'Phone': '0800 364 0760', + 'Title': 'Diam At Ltd', + 'Email': 'nisl@ipsum.edu' + } +]"; + jsonDataSource.Source = json; + Debug.WriteLine (jsonDataSource); + } + } +} diff --git a/Xamarin.Forms.Pages.UnitTests/Properties/AssemblyInfo.cs b/Xamarin.Forms.Pages.UnitTests/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..3f2de233 --- /dev/null +++ b/Xamarin.Forms.Pages.UnitTests/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Xamarin.Forms.Pages.UnitTests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Xamarin.Forms.Pages.UnitTests")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("447dc60e-c485-4427-8cf7-50074c6b61de")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Xamarin.Forms.Pages.UnitTests/Xamarin.Forms.Pages.UnitTests.csproj b/Xamarin.Forms.Pages.UnitTests/Xamarin.Forms.Pages.UnitTests.csproj new file mode 100644 index 00000000..7d211310 --- /dev/null +++ b/Xamarin.Forms.Pages.UnitTests/Xamarin.Forms.Pages.UnitTests.csproj @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{447DC60E-C485-4427-8CF7-50074C6B61DE}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>Xamarin.Forms.Pages.UnitTests</RootNamespace> + <AssemblyName>Xamarin.Forms.Pages.UnitTests</AssemblyName> + <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <TargetFrameworkProfile /> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> + <HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="nunit.framework, Version=2.6.2.12296, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL"> + <HintPath>..\packages\NUnit.2.6.2\lib\nunit.framework.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="..\Xamarin.Forms.Core.UnitTests\MockPlatformServices.cs"> + <Link>MockPlatformServices.cs</Link> + </Compile> + <Compile Include="..\Xamarin.Forms.Core.UnitTests\UnitPlatform.cs"> + <Link>UnitPlatform.cs</Link> + </Compile> + <Compile Include="DataPageTests.cs" /> + <Compile Include="DataSourceListTests.cs" /> + <Compile Include="IntegrationTests.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\Xamarin.Forms.Core\Xamarin.Forms.Core.csproj"> + <Project>{57b8b73d-c3b5-4c42-869e-7b2f17d354ac}</Project> + <Name>Xamarin.Forms.Core</Name> + </ProjectReference> + <ProjectReference Include="..\Xamarin.Forms.Maps\Xamarin.Forms.Maps.csproj"> + <Project>{7d13bac2-c6a4-416a-b07e-c169b199e52b}</Project> + <Name>Xamarin.Forms.Maps</Name> + </ProjectReference> + <ProjectReference Include="..\Xamarin.Forms.Pages\Xamarin.Forms.Pages.csproj"> + <Project>{d6133dbd-6c60-4bd5-bea2-07e0a3927c31}</Project> + <Name>Xamarin.Forms.Pages</Name> + </ProjectReference> + <ProjectReference Include="..\Xamarin.Forms.Platform\Xamarin.Forms.Platform.csproj"> + <Project>{67f9d3a8-f71e-4428-913f-c37ae82cdb24}</Project> + <Name>Xamarin.Forms.Platform</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <None Include="packages.config" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project>
\ No newline at end of file diff --git a/Xamarin.Forms.Pages.UnitTests/packages.config b/Xamarin.Forms.Pages.UnitTests/packages.config new file mode 100644 index 00000000..2cf632d9 --- /dev/null +++ b/Xamarin.Forms.Pages.UnitTests/packages.config @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" /> + <package id="NUnit" version="2.6.2" targetFramework="net452" /> +</packages>
\ No newline at end of file diff --git a/Xamarin.Forms.Pages/BaseDataSource.cs b/Xamarin.Forms.Pages/BaseDataSource.cs new file mode 100644 index 00000000..31608b83 --- /dev/null +++ b/Xamarin.Forms.Pages/BaseDataSource.cs @@ -0,0 +1,113 @@ +using System.Collections.Generic; +using System.Collections.Specialized; +using System.ComponentModel; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; + +namespace Xamarin.Forms.Pages +{ + public abstract class BaseDataSource : IDataSource, INotifyPropertyChanged + { + readonly DataSourceList _dataSourceList = new DataSourceList(); + bool _initialized; + bool _isLoading; + + public IReadOnlyList<IDataItem> Data + { + get + { + Initialize(); + return _dataSourceList; + } + } + + public bool IsLoading + { + get { return _isLoading; } + set + { + if (_isLoading == value) + return; + _isLoading = value; + OnPropertyChanged(); + } + } + +#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed + public object this[string key] + { + get + { + Initialize(); + return GetValue(key); + } + set + { + Initialize(); + if (SetValue(key, value)) + OnKeyChanged(key); + } + } +#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed + + IEnumerable<string> IDataSource.MaskedKeys => _dataSourceList.MaskedKeys; + + async void IDataSource.MaskKey(string key) + { + await Initialize(); + _dataSourceList.MaskKey(key); + } + + async void IDataSource.UnmaskKey(string key) + { + await Initialize(); + _dataSourceList.UnmaskKey(key); + } + + event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged + { + add { PropertyChanged += value; } + remove { PropertyChanged -= value; } + } + + protected abstract Task<IList<IDataItem>> GetRawData(); + + protected abstract object GetValue(string key); + + protected void OnPropertyChanged([CallerMemberName] string property = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property)); + } + + protected abstract bool SetValue(string key, object value); + + async Task Initialize() + { + // Do this lazy because GetRawData is virtual and calling it in the ctor is therefor unfriendly + if (_initialized) + return; + _initialized = true; + IList<IDataItem> rawData = await GetRawData(); + if (!(rawData is INotifyCollectionChanged)) + { + Log.Warning("Xamarin.Forms.Pages", "DataSource does not implement INotifyCollectionChanged, updates will not be reflected"); + rawData = rawData.ToList(); // Make a copy so we can be sure this list wont change out from under us + } + _dataSourceList.MainList = rawData; + + // Test if INPC("Item") is enough to trigger a full reset rather than triggering a new event for each key? + foreach (IDataItem dataItem in rawData) + { + OnKeyChanged(dataItem.Name); + } + } + + void OnKeyChanged(string key) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs($"Item[{key}]")); + } + + event PropertyChangedEventHandler PropertyChanged; + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Pages/CardView.cs b/Xamarin.Forms.Pages/CardView.cs new file mode 100644 index 00000000..7aca6bde --- /dev/null +++ b/Xamarin.Forms.Pages/CardView.cs @@ -0,0 +1,37 @@ +using System; +using Xamarin.Forms; +using Xamarin.Forms.Pages; + +namespace Xamarin.Forms.Pages +{ + public class CardView : DataView + { + public static readonly BindableProperty TextProperty = + BindableProperty.Create(nameof(Text), typeof(string), typeof(CardView), null, BindingMode.OneWay); + + public string Text + { + get { return (string)GetValue(TextProperty); } + set { SetValue(TextProperty, value); } + } + + public static readonly BindableProperty DetailProperty = + BindableProperty.Create(nameof(Detail), typeof(string), typeof(CardView), null, BindingMode.OneWay); + + public string Detail + { + get { return (string)GetValue(DetailProperty); } + set { SetValue(DetailProperty, value); } + } + + public static readonly BindableProperty ImageSourceProperty = + BindableProperty.Create(nameof(ImageSource), typeof(ImageSource), typeof(CardView), null, BindingMode.OneWay); + + public ImageSource ImageSource + { + get { return (ImageSource)GetValue(ImageSourceProperty); } + set { SetValue(ImageSourceProperty, value); } + } + } +} + diff --git a/Xamarin.Forms.Pages/CompoundCollection.cs b/Xamarin.Forms.Pages/CompoundCollection.cs new file mode 100644 index 00000000..6dbf502b --- /dev/null +++ b/Xamarin.Forms.Pages/CompoundCollection.cs @@ -0,0 +1,223 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.Linq; + +namespace Xamarin.Forms.Pages +{ + public class CompoundCollection : Element, IList, INotifyCollectionChanged + { + public static readonly BindableProperty MainListProperty = BindableProperty.Create(nameof(MainList), typeof(IReadOnlyList<object>), typeof(CompoundCollection), default(IReadOnlyList<object>), + propertyChanged: OnMainListPropertyChanged); + + readonly ObservableCollection<object> _appendList = new ObservableCollection<object>(); + + readonly ObservableCollection<object> _prependList = new ObservableCollection<object>(); + + public CompoundCollection() + { + _prependList.CollectionChanged += OnPrependCollectionChanged; + _appendList.CollectionChanged += OnAppendCollectionChanged; + } + + public IList AppendList => _appendList; + + public IReadOnlyList<object> MainList + { + get { return (IReadOnlyList<object>)GetValue(MainListProperty); } + set { SetValue(MainListProperty, value); } + } + + public IList PrependList => _prependList; + + public void CopyTo(Array array, int index) + { + throw new NotSupportedException(); + } + + public int Count => AppendList.Count + PrependList.Count + (MainList?.Count ?? 0); + + public bool IsSynchronized => false; + + public object SyncRoot => null; + + public IEnumerator GetEnumerator() + { + foreach (object item in PrependList) + yield return item; + foreach (object item in MainList) + yield return item; + foreach (object item in AppendList) + yield return item; + } + + public int Add(object value) + { + throw new NotSupportedException(); + } + + public void Clear() + { + throw new NotSupportedException(); + } + + public bool Contains(object value) + { + IReadOnlyList<object> mainList = MainList; + bool masterContains; + var masterList = mainList as IList; + if (masterList != null) + { + masterContains = masterList.Contains(value); + } + else + { + masterContains = mainList.Contains(value); + } + return masterContains || PrependList.Contains(value) || AppendList.Contains(value); + } + + public int IndexOf(object value) + { + int result; + result = PrependList.IndexOf(value); + if (result >= 0) + return result; + result = MainList.IndexOf(value); + if (result >= 0) + return result + PrependList.Count; + + result = AppendList.IndexOf(value); + if (result >= 0) + return result + PrependList.Count + MainList.Count; + return -1; + } + + public void Insert(int index, object value) + { + throw new NotSupportedException(); + } + + public bool IsFixedSize => false; + + public bool IsReadOnly => true; + + public object this[int index] + { + get + { + IReadOnlyList<object> mainList = MainList; + int prependSize = PrependList.Count; + if (index < prependSize) + return PrependList[index]; + index -= prependSize; + + if (mainList != null) + { + if (index < mainList.Count) + return mainList[index]; + index -= mainList.Count; + } + + if (index >= AppendList.Count) + throw new IndexOutOfRangeException(); + return AppendList[index]; + } + set { throw new NotSupportedException(); } + } + + public void Remove(object value) + { + throw new NotSupportedException(); + } + + public void RemoveAt(int index) + { + throw new NotSupportedException(); + } + + public event NotifyCollectionChangedEventHandler CollectionChanged; + + void OnAppendCollectionChanged(object sender, NotifyCollectionChangedEventArgs args) + { + int offset = _prependList.Count + (MainList?.Count ?? 0); + // here we just need to calculate the offset for the index, everything else is the same + switch (args.Action) + { + case NotifyCollectionChangedAction.Add: + OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, args.NewItems, offset + args.NewStartingIndex)); + break; + case NotifyCollectionChangedAction.Move: + OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Move, args.OldItems, offset + args.NewStartingIndex, offset + args.OldStartingIndex)); + break; + case NotifyCollectionChangedAction.Remove: + OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, args.OldItems, offset + args.OldStartingIndex)); + break; + case NotifyCollectionChangedAction.Replace: + OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, args.NewItems, args.OldItems, offset + args.OldStartingIndex)); + break; + case NotifyCollectionChangedAction.Reset: + OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); + break; + default: + throw new ArgumentOutOfRangeException(); + } + } + + void OnCollectionChanged(NotifyCollectionChangedEventArgs args) + { + CollectionChanged?.Invoke(this, args); + } + + void OnMainCollectionChanged(object sender, NotifyCollectionChangedEventArgs args) + { + // much complexity to be had here + switch (args.Action) + { + case NotifyCollectionChangedAction.Add: + OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, args.NewItems, PublicIndexFromMainIndex(args.NewStartingIndex))); + break; + case NotifyCollectionChangedAction.Move: + OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Move, args.OldItems, PublicIndexFromMainIndex(args.NewStartingIndex), + PublicIndexFromMainIndex(args.OldStartingIndex))); + break; + case NotifyCollectionChangedAction.Remove: + OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, args.OldItems, PublicIndexFromMainIndex(args.OldStartingIndex))); + break; + case NotifyCollectionChangedAction.Replace: + OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, args.NewItems, args.OldItems, PublicIndexFromMainIndex(args.OldStartingIndex))); + break; + case NotifyCollectionChangedAction.Reset: + OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); + break; + default: + throw new ArgumentOutOfRangeException(); + } + } + + static void OnMainListPropertyChanged(BindableObject bindable, object oldValue, object newValue) + { + var self = (CompoundCollection)bindable; + var observable = oldValue as INotifyCollectionChanged; + if (observable != null) + observable.CollectionChanged -= self.OnMainCollectionChanged; + observable = newValue as INotifyCollectionChanged; + if (observable != null) + observable.CollectionChanged += self.OnMainCollectionChanged; + self.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); + } + + void OnPrependCollectionChanged(object sender, NotifyCollectionChangedEventArgs args) + { + // this can basically be a passthrough as prepend has no masking and identical indexing + OnCollectionChanged(args); + } + + int PublicIndexFromMainIndex(int index) + { + return PrependList.Count + index; + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Pages/DataItem.cs b/Xamarin.Forms.Pages/DataItem.cs new file mode 100644 index 00000000..62af919c --- /dev/null +++ b/Xamarin.Forms.Pages/DataItem.cs @@ -0,0 +1,86 @@ +using System.ComponentModel; +using System.Runtime.CompilerServices; + +namespace Xamarin.Forms.Pages +{ + public class DataItem : IDataItem, INotifyPropertyChanged + { + string _name; + object _val; + + public DataItem() + { + } + + public DataItem(string name, object value) + { + _name = name; + _val = value; + } + + public string Name + { + get { return _name; } + set + { + if (_name == value) + return; + _name = value; + OnPropertyChanged(); + } + } + + public object Value + { + get { return _val; } + set + { + if (_val == value) + return; + _val = value; + OnPropertyChanged(); + } + } + + public event PropertyChangedEventHandler PropertyChanged; + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) + return false; + if (ReferenceEquals(this, obj)) + return true; + if (obj.GetType() != GetType()) + return false; + return Equals((DataItem)obj); + } + + public override int GetHashCode() + { + unchecked + { + return ((_name?.GetHashCode() ?? 0) * 397) ^ (_val?.GetHashCode() ?? 0); + } + } + + public static bool operator ==(DataItem left, DataItem right) + { + return Equals(left, right); + } + + public static bool operator !=(DataItem left, DataItem right) + { + return !Equals(left, right); + } + + protected bool Equals(DataItem other) + { + return string.Equals(_name, other._name) && Equals(_val, other._val); + } + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Pages/DataPage.cs b/Xamarin.Forms.Pages/DataPage.cs new file mode 100644 index 00000000..1ec28d5c --- /dev/null +++ b/Xamarin.Forms.Pages/DataPage.cs @@ -0,0 +1,76 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Xamarin.Forms.Pages +{ + public class DataPage : ContentPage, IDataSourceProvider + { + public static readonly BindableProperty DataProperty = BindableProperty.Create(nameof(Data), typeof(IEnumerable<IDataItem>), typeof(DataPage), default(IEnumerable<IDataItem>)); + + public static readonly BindableProperty DataSourceProperty = BindableProperty.Create(nameof(DataSource), typeof(IDataSource), typeof(DataPage), null, propertyChanged: OnDataSourceChanged); + + public static readonly BindableProperty DefaultItemTemplateProperty = BindableProperty.Create(nameof(DefaultItemTemplate), typeof(DataTemplate), typeof(DataPage), default(DataTemplate)); + + readonly HashSet<string> _maskedKeys = new HashSet<string>(); + + public DataPage() + { + SetBinding(DataProperty, new Binding("DataSource.Data", source: this)); + } + + public IEnumerable<IDataItem> Data + { + get { return (IEnumerable<IDataItem>)GetValue(DataProperty); } + set { SetValue(DataProperty, value); } + } + + public DataTemplate DefaultItemTemplate + { + get { return (DataTemplate)GetValue(DefaultItemTemplateProperty); } + set { SetValue(DefaultItemTemplateProperty, value); } + } + + public IDataSource DataSource + { + get { return (IDataSource)GetValue(DataSourceProperty); } + set { SetValue(DataSourceProperty, value); } + } + + void IDataSourceProvider.MaskKey(string key) + { + _maskedKeys.Add(key); + IDataSource dataSource = DataSource; + if (dataSource != null && !dataSource.MaskedKeys.Contains(key)) + { + dataSource.MaskKey(key); + } + } + + void IDataSourceProvider.UnmaskKey(string key) + { + _maskedKeys.Remove(key); + DataSource?.UnmaskKey(key); + } + + static void OnDataSourceChanged(BindableObject bindable, object oldValue, object newValue) + { + var dataView = (DataPage)bindable; + var dataSource = (IDataSource)newValue; + var oldSource = (IDataSource)oldValue; + + if (oldSource != null) + { + foreach (string key in dataView._maskedKeys) + oldSource.UnmaskKey(key); + } + + if (dataSource != null) + { + foreach (string key in dataView._maskedKeys) + { + dataSource.MaskKey(key); + } + } + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Pages/DataSourceBinding.cs b/Xamarin.Forms.Pages/DataSourceBinding.cs new file mode 100644 index 00000000..44af47b4 --- /dev/null +++ b/Xamarin.Forms.Pages/DataSourceBinding.cs @@ -0,0 +1,157 @@ +using System; +using System.Globalization; +using System.Threading.Tasks; + +namespace Xamarin.Forms.Pages +{ + public class DataSourceBinding : BindingBase + { + internal const string SelfPath = "."; + IValueConverter _converter; + object _converterParameter; + WeakReference _dataSourceRef; + + BindingExpression _expression; + string _path; + + public DataSourceBinding() + { + } + + public DataSourceBinding(string path, BindingMode mode = BindingMode.Default, IValueConverter converter = null, object converterParameter = null, string stringFormat = null) + { + if (path == null) + throw new ArgumentNullException(nameof(path)); + if (string.IsNullOrWhiteSpace(path)) + throw new ArgumentException("path can not be an empty string", nameof(path)); + + AllowChaining = true; + Path = path; + Converter = converter; + ConverterParameter = converterParameter; + Mode = mode; + StringFormat = stringFormat; + } + + public IValueConverter Converter + { + get { return _converter; } + set + { + ThrowIfApplied(); + + _converter = value; + } + } + + public object ConverterParameter + { + get { return _converterParameter; } + set + { + ThrowIfApplied(); + + _converterParameter = value; + } + } + + public string Path + { + get { return _path; } + set + { + ThrowIfApplied(); + + _path = value; + _expression = GetBindingExpression($"DataSource[{value}]"); + } + } + + internal override void Apply(bool fromTarget) + { + base.Apply(fromTarget); + + if (_expression == null) + _expression = new BindingExpression(this, SelfPath); + + _expression.Apply(fromTarget); + } + + internal override async void Apply(object newContext, BindableObject bindObj, BindableProperty targetProperty) + { + var view = bindObj as VisualElement; + if (view == null) + throw new InvalidOperationException(); + + base.Apply(newContext, bindObj, targetProperty); + + Element dataSourceParent = await FindDataSourceParentAsync(view); + + var dataSourceProviderer = (IDataSourceProvider)dataSourceParent; + if (dataSourceProviderer != null) + _dataSourceRef = new WeakReference(dataSourceProviderer); + + dataSourceProviderer?.MaskKey(_path); + ApplyInner(dataSourceParent, bindObj, targetProperty); + } + + internal override BindingBase Clone() + { + return new DataSourceBinding(Path, Mode) { Converter = Converter, ConverterParameter = ConverterParameter, StringFormat = StringFormat }; + } + + internal override object GetSourceValue(object value, Type targetPropertyType) + { + if (Converter != null) + value = Converter.Convert(value, targetPropertyType, ConverterParameter, CultureInfo.CurrentUICulture); + + return base.GetSourceValue(value, targetPropertyType); + } + + internal override object GetTargetValue(object value, Type sourcePropertyType) + { + if (Converter != null) + value = Converter.ConvertBack(value, sourcePropertyType, ConverterParameter, CultureInfo.CurrentUICulture); + + return base.GetTargetValue(value, sourcePropertyType); + } + + internal override void Unapply() + { + base.Unapply(); + + if (_dataSourceRef != null && _dataSourceRef.IsAlive) + { + var dataSourceProviderer = (IDataSourceProvider)_dataSourceRef.Target; + dataSourceProviderer?.UnmaskKey(_path); + } + + _expression?.Unapply(); + } + + void ApplyInner(Element templatedParent, BindableObject bindableObject, BindableProperty targetProperty) + { + if (_expression == null && templatedParent != null) + _expression = new BindingExpression(this, SelfPath); + + _expression?.Apply(templatedParent, bindableObject, targetProperty); + } + + static async Task<Element> FindDataSourceParentAsync(Element element) + { + while (!Application.IsApplicationOrNull(element)) + { + if (element is IDataSourceProvider) + return element; + element = await TemplateUtilities.GetRealParentAsync(element); + } + + return null; + } + + BindingExpression GetBindingExpression(string path) + { + return new BindingExpression(this, !string.IsNullOrWhiteSpace(path) ? path : SelfPath); + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Pages/DataSourceBindingExtension.cs b/Xamarin.Forms.Pages/DataSourceBindingExtension.cs new file mode 100644 index 00000000..279240e7 --- /dev/null +++ b/Xamarin.Forms.Pages/DataSourceBindingExtension.cs @@ -0,0 +1,35 @@ +using System; +using Xamarin.Forms.Xaml; + +namespace Xamarin.Forms.Pages +{ + [ContentProperty("Path")] + public sealed class DataSourceBindingExtension : IMarkupExtension<BindingBase> + { + public DataSourceBindingExtension() + { + Mode = BindingMode.Default; + Path = Binding.SelfPath; + } + + public IValueConverter Converter { get; set; } + + public object ConverterParameter { get; set; } + + public BindingMode Mode { get; set; } + + public string Path { get; set; } + + public string StringFormat { get; set; } + + object IMarkupExtension.ProvideValue(IServiceProvider serviceProvider) + { + return (this as IMarkupExtension<BindingBase>).ProvideValue(serviceProvider); + } + + BindingBase IMarkupExtension<BindingBase>.ProvideValue(IServiceProvider serviceProvider) + { + return new DataSourceBinding(Path, Mode, Converter, ConverterParameter, StringFormat); + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Pages/DataSourceList.cs b/Xamarin.Forms.Pages/DataSourceList.cs new file mode 100644 index 00000000..7f3a59c1 --- /dev/null +++ b/Xamarin.Forms.Pages/DataSourceList.cs @@ -0,0 +1,233 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.Specialized; + +namespace Xamarin.Forms.Pages +{ + internal class DataSourceList : IList<IDataItem>, IReadOnlyList<IDataItem>, INotifyCollectionChanged + { + readonly List<int> _maskedIndexes = new List<int>(); // Indices + readonly HashSet<string> _maskedKeys = new HashSet<string>(); + IList<IDataItem> _mainList; + + public IList<IDataItem> MainList + { + get { return _mainList; } + set + { + var observable = _mainList as INotifyCollectionChanged; + if (observable != null) + observable.CollectionChanged -= OnMainCollectionChanged; + _mainList = value; + observable = _mainList as INotifyCollectionChanged; + if (observable != null) + observable.CollectionChanged += OnMainCollectionChanged; + _maskedIndexes.Clear(); + for (var i = 0; i < _mainList.Count; i++) + { + IDataItem data = _mainList[i]; + if (_maskedKeys.Contains(data.Name)) + _maskedIndexes.Add(i); + } + OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); + } + } + + public IEnumerable<string> MaskedKeys => _maskedKeys; + + public void Add(IDataItem item) + { + throw new NotSupportedException(); + } + + public void Clear() + { + throw new NotSupportedException(); + } + + public bool Contains(IDataItem item) + { + return MainList != null && !_maskedKeys.Contains(item.Name) && MainList.Contains(item); + } + + public void CopyTo(IDataItem[] array, int arrayIndex) + { + throw new NotSupportedException(); + } + + public int Count + { + get + { + if (MainList == null) + return 0; + var result = 0; + result += MainList.Count; + result -= _maskedIndexes.Count; + return result; + } + } + + public bool IsReadOnly => true; + + public bool Remove(IDataItem item) + { + throw new NotSupportedException(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public IEnumerator<IDataItem> GetEnumerator() + { + var index = 0; + if (MainList == null) + yield break; + foreach (IDataItem item in MainList) + { + if (!_maskedIndexes.Contains(index)) + yield return item; + index++; + } + } + + public int IndexOf(IDataItem item) + { + if (_maskedKeys.Contains(item.Name)) + return -1; + + if (MainList != null) + { + int result = MainList.IndexOf(item); + if (result >= 0) + return PublicIndexFromMainIndex(result); + } + return -1; + } + + public void Insert(int index, IDataItem item) + { + throw new NotSupportedException(); + } + + public IDataItem this[int index] + { + get + { + foreach (int i in _maskedIndexes) + { + if (i <= index) + index++; + } + if (_mainList == null) + throw new IndexOutOfRangeException(); + return _mainList[index]; + } + set { throw new NotSupportedException(); } + } + + public void RemoveAt(int index) + { + throw new NotSupportedException(); + } + + public event NotifyCollectionChangedEventHandler CollectionChanged; + + public void MaskKey(string key) + { + if (_maskedKeys.Contains(key) || _mainList == null) + return; + _maskedKeys.Add(key); + var index = 0; + foreach (IDataItem item in _mainList) + { + if (item.Name == key) + { + // We need to keep our indexes list sorted, so we insert everything pre-sorted + var added = false; + for (var i = 0; i < _maskedIndexes.Count; i++) + { + if (_maskedIndexes[i] > index) + { + _maskedIndexes.Insert(i, index); + added = true; + break; + } + } + if (!added) + _maskedIndexes.Add(index); + OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, item, PublicIndexFromMainIndex(index))); + break; + } + index++; + } + } + + public void UnmaskKey(string key) + { + _maskedKeys.Remove(key); + if (_mainList == null) + return; + var index = 0; + foreach (IDataItem item in _mainList) + { + if (item.Name == key) + { + bool removed = _maskedIndexes.Remove(index); + if (removed) + { + OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, item, PublicIndexFromMainIndex(index))); + } + break; + } + index++; + } + } + + protected void OnCollectionChanged(NotifyCollectionChangedEventArgs args) + { + CollectionChanged?.Invoke(this, args); + } + + void OnMainCollectionChanged(object sender, NotifyCollectionChangedEventArgs args) + { + // much complexity to be had here + switch (args.Action) + { + case NotifyCollectionChangedAction.Add: + OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, args.NewItems, PublicIndexFromMainIndex(args.NewStartingIndex))); + break; + case NotifyCollectionChangedAction.Move: + OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Move, args.OldItems, PublicIndexFromMainIndex(args.NewStartingIndex), + PublicIndexFromMainIndex(args.OldStartingIndex))); + break; + case NotifyCollectionChangedAction.Remove: + OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, args.OldItems, PublicIndexFromMainIndex(args.OldStartingIndex))); + break; + case NotifyCollectionChangedAction.Replace: + OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, args.NewItems, args.OldItems, PublicIndexFromMainIndex(args.OldStartingIndex))); + break; + case NotifyCollectionChangedAction.Reset: + OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); + break; + default: + throw new ArgumentOutOfRangeException(); + } + } + + int PublicIndexFromMainIndex(int index) + { + var count = 0; + for (var x = 0; x < _maskedIndexes.Count; x++) + { + int i = _maskedIndexes[x]; + if (i < index) + count++; + } + return index - count; + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Pages/DataView.cs b/Xamarin.Forms.Pages/DataView.cs new file mode 100644 index 00000000..983328ee --- /dev/null +++ b/Xamarin.Forms.Pages/DataView.cs @@ -0,0 +1,76 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Xamarin.Forms.Pages +{ + public class DataView : ContentView, IDataSourceProvider + { + public static readonly BindableProperty DataProperty = BindableProperty.Create(nameof(Data), typeof(IEnumerable<IDataItem>), typeof(DataView), default(IEnumerable<IDataItem>)); + + public static readonly BindableProperty DataSourceProperty = BindableProperty.Create(nameof(DataSource), typeof(IDataSource), typeof(DataView), null, propertyChanged: OnDataSourceChanged); + + public static readonly BindableProperty DefaultItemTemplateProperty = BindableProperty.Create(nameof(DefaultItemTemplate), typeof(DataTemplate), typeof(DataView), default(DataTemplate)); + + readonly HashSet<string> _maskedKeys = new HashSet<string>(); + + public DataView() + { + SetBinding(DataProperty, new Binding("DataSource.Data", source: this)); + } + + public IEnumerable<IDataItem> Data + { + get { return (IEnumerable<IDataItem>)GetValue(DataProperty); } + set { SetValue(DataProperty, value); } + } + + public DataTemplate DefaultItemTemplate + { + get { return (DataTemplate)GetValue(DefaultItemTemplateProperty); } + set { SetValue(DefaultItemTemplateProperty, value); } + } + + public IDataSource DataSource + { + get { return (IDataSource)GetValue(DataSourceProperty); } + set { SetValue(DataSourceProperty, value); } + } + + void IDataSourceProvider.MaskKey(string key) + { + _maskedKeys.Add(key); + IDataSource dataSource = DataSource; + if (dataSource != null && !dataSource.MaskedKeys.Contains(key)) + { + dataSource.MaskKey(key); + } + } + + void IDataSourceProvider.UnmaskKey(string key) + { + _maskedKeys.Remove(key); + DataSource?.UnmaskKey(key); + } + + static void OnDataSourceChanged(BindableObject bindable, object oldValue, object newValue) + { + var dataView = (DataView)bindable; + var dataSource = (IDataSource)newValue; + var oldSource = (IDataSource)oldValue; + + if (oldSource != null) + { + foreach (string key in dataView._maskedKeys) + oldSource.UnmaskKey(key); + } + + if (dataSource != null) + { + foreach (string key in dataView._maskedKeys) + { + dataSource.MaskKey(key); + } + } + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Pages/DirectoryPage.cs b/Xamarin.Forms.Pages/DirectoryPage.cs new file mode 100644 index 00000000..c85fae40 --- /dev/null +++ b/Xamarin.Forms.Pages/DirectoryPage.cs @@ -0,0 +1,13 @@ +namespace Xamarin.Forms.Pages +{ + public class DirectoryPage : DataPage + { + public static readonly BindableProperty IsGroupingEnabledProperty = BindableProperty.Create(nameof(IsGroupingEnabled), typeof(bool), typeof(DirectoryPage), default(bool)); + + public bool IsGroupingEnabled + { + get { return (bool)GetValue(IsGroupingEnabledProperty); } + set { SetValue(IsGroupingEnabledProperty, value); } + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Pages/HeroImage.cs b/Xamarin.Forms.Pages/HeroImage.cs new file mode 100644 index 00000000..ce5a4c93 --- /dev/null +++ b/Xamarin.Forms.Pages/HeroImage.cs @@ -0,0 +1,37 @@ +namespace Xamarin.Forms.Pages +{ + public class HeroImage : DataView + { + public static readonly BindableProperty TextProperty = BindableProperty.Create(nameof(Text), typeof(string), typeof(HeroImage), null); + + public static readonly BindableProperty DetailProperty = BindableProperty.Create(nameof(Detail), typeof(string), typeof(HeroImage), null); + + public static readonly BindableProperty ImageSourceProperty = BindableProperty.Create(nameof(ImageSource), typeof(ImageSource), typeof(HeroImage), null); + + public static readonly BindableProperty AspectProperty = BindableProperty.Create(nameof(Aspect), typeof(Aspect), typeof(HeroImage), Aspect.AspectFit); + + public Aspect Aspect + { + get { return (Aspect)GetValue(AspectProperty); } + set { SetValue(AspectProperty, value); } + } + + public string Detail + { + get { return (string)GetValue(DetailProperty); } + set { SetValue(DetailProperty, value); } + } + + public ImageSource ImageSource + { + get { return (ImageSource)GetValue(ImageSourceProperty); } + set { SetValue(ImageSourceProperty, value); } + } + + public string Text + { + get { return (string)GetValue(TextProperty); } + set { SetValue(TextProperty, value); } + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Pages/IDataItem.cs b/Xamarin.Forms.Pages/IDataItem.cs new file mode 100644 index 00000000..a594e8ee --- /dev/null +++ b/Xamarin.Forms.Pages/IDataItem.cs @@ -0,0 +1,9 @@ +namespace Xamarin.Forms.Pages +{ + public interface IDataItem + { + string Name { get; set; } + + object Value { get; set; } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Pages/IDataSource.cs b/Xamarin.Forms.Pages/IDataSource.cs new file mode 100644 index 00000000..a00e7f1c --- /dev/null +++ b/Xamarin.Forms.Pages/IDataSource.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; + +namespace Xamarin.Forms.Pages +{ + public interface IDataSource + { + IReadOnlyList<IDataItem> Data { get; } + + bool IsLoading { get; } + + object this[string key] { get; set; } + + IEnumerable<string> MaskedKeys { get; } + + void MaskKey(string key); + void UnmaskKey(string key); + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Pages/IDataSourceProvider.cs b/Xamarin.Forms.Pages/IDataSourceProvider.cs new file mode 100644 index 00000000..ae07c0f7 --- /dev/null +++ b/Xamarin.Forms.Pages/IDataSourceProvider.cs @@ -0,0 +1,11 @@ +namespace Xamarin.Forms.Pages +{ + public interface IDataSourceProvider + { + IDataSource DataSource { get; set; } + + void MaskKey(string key); + + void UnmaskKey(string key); + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Pages/JsonDataSource.cs b/Xamarin.Forms.Pages/JsonDataSource.cs new file mode 100644 index 00000000..3be50e8a --- /dev/null +++ b/Xamarin.Forms.Pages/JsonDataSource.cs @@ -0,0 +1,147 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Newtonsoft.Json.Linq; + +namespace Xamarin.Forms.Pages +{ + public class JsonDataSource : BaseDataSource + { + readonly ObservableCollection<IDataItem> _dataItems = new ObservableCollection<IDataItem>(); + Task _currentParseTask; + bool _initialized; + JsonSource _source; + + public JsonDataSource() + { + } + + internal JsonDataSource(JToken rootToken) + { + ParseJsonToken(rootToken); + } + + [TypeConverter(typeof(JsonSourceConverter))] + public JsonSource Source + { + get { return _source; } + set + { + if (_source == value) + return; + _source = value; + + _dataItems.Clear(); + if (value != null && _initialized) + { + _currentParseTask = ParseJson(); + _currentParseTask.ContinueWith(t => { throw t.Exception; }, TaskContinuationOptions.OnlyOnFaulted); + } + } + } + + protected override async Task<IList<IDataItem>> GetRawData() + { + if (!_initialized) + { + Task task = _currentParseTask = ParseJson(); + await task; + } + else if (_currentParseTask != null && _currentParseTask.IsCompleted == false) + await _currentParseTask; + return _dataItems; + } + + protected override object GetValue(string key) + { + IDataItem target = _dataItems.FirstOrDefault(d => d.Name == key); + return target?.Value; + } + + protected override bool SetValue(string key, object value) + { + IDataItem target = _dataItems.FirstOrDefault(d => d.Name == key); + if (target == null) + { + _dataItems.Add(new DataItem(key, value)); + return true; + } + if (target.Value == value) + return false; + target.Value = value; + return true; + } + + object GetValueForJToken(JToken token) + { + switch (token.Type) + { + case JTokenType.Object: + case JTokenType.Array: + return new JsonDataSource(token); + case JTokenType.Constructor: + case JTokenType.Property: + case JTokenType.Comment: + throw new NotImplementedException(); + case JTokenType.Integer: + return (int)token; + case JTokenType.Float: + return (float)token; + case JTokenType.Raw: + case JTokenType.String: + return (string)token; + case JTokenType.Boolean: + return (bool)token; + case JTokenType.Date: + return (DateTime)token; + case JTokenType.Bytes: + return (byte[])token; + case JTokenType.Guid: + return (Guid)token; + case JTokenType.Uri: + return (Uri)token; + case JTokenType.TimeSpan: + return (TimeSpan)token; + default: + return null; + } + } + + async Task ParseJson() + { + _initialized = true; + + if (Source == null) + return; + + IsLoading = true; + string json = await Source.GetJson(); + JToken jToken = JToken.Parse(json); + ParseJsonToken(jToken); + IsLoading = false; + } + + void ParseJsonToken(JToken token) + { + var jArray = token as JArray; + var jObject = token as JObject; + if (jArray != null) + { + for (var i = 0; i < jArray.Count; i++) + { + JToken obj = jArray[i]; + _dataItems.Add(new DataItem(i.ToString(), GetValueForJToken(obj))); + } + } + else if (jObject != null) + { + foreach (KeyValuePair<string, JToken> kvp in jObject) + { + _dataItems.Add(new DataItem(kvp.Key, GetValueForJToken(kvp.Value))); + } + } + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Pages/JsonSource.cs b/Xamarin.Forms.Pages/JsonSource.cs new file mode 100644 index 00000000..46c0a95d --- /dev/null +++ b/Xamarin.Forms.Pages/JsonSource.cs @@ -0,0 +1,25 @@ +using System; +using System.Threading.Tasks; + +namespace Xamarin.Forms.Pages +{ + public abstract class JsonSource : Element + { + public static JsonSource FromString(string json) + { + return new StringJsonSource { Json = json }; + } + + public static JsonSource FromUri(Uri uri) + { + return new UriJsonSource { Uri = uri }; + } + + public abstract Task<string> GetJson(); + + public static implicit operator JsonSource(string json) + { + return FromString(json); + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Pages/JsonSourceConverter.cs b/Xamarin.Forms.Pages/JsonSourceConverter.cs new file mode 100644 index 00000000..461c96d9 --- /dev/null +++ b/Xamarin.Forms.Pages/JsonSourceConverter.cs @@ -0,0 +1,22 @@ +using System; + +namespace Xamarin.Forms.Pages +{ + public class JsonSourceConverter : TypeConverter + { + public override object ConvertFromInvariantString(string value) + { + if (value != null) + { + value = value.Trim(); + Uri uri; + if (Uri.TryCreate(value, UriKind.Absolute, out uri) && uri.Scheme != "file") + return new UriJsonSource { Uri = uri }; + if (value.StartsWith("[") || value.StartsWith("{")) + return new StringJsonSource { Json = value }; + } + + throw new InvalidOperationException(string.Format("Cannot convert \"{0}\" into {1}", value, typeof(JsonSource))); + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Pages/ListDataPage.cs b/Xamarin.Forms.Pages/ListDataPage.cs new file mode 100644 index 00000000..2a2585ec --- /dev/null +++ b/Xamarin.Forms.Pages/ListDataPage.cs @@ -0,0 +1,55 @@ +namespace Xamarin.Forms.Pages +{ + public class ListDataPageControl : ListView + { + public ListDataPageControl() + { + SetBinding(ItemTemplateProperty, new TemplateBinding(DataPage.DefaultItemTemplateProperty.PropertyName)); + SetBinding(SelectedItemProperty, new TemplateBinding(ListDataPage.SelectedItemProperty.PropertyName, BindingMode.TwoWay)); + SetBinding(ItemsSourceProperty, new TemplateBinding(DataPage.DataProperty.PropertyName)); + } + } + + public class ListDataPage : DataPage + { + public static readonly BindableProperty DetailTemplateProperty = BindableProperty.Create(nameof(DetailTemplate), typeof(DataTemplate), typeof(ListDataPage), null); + + public static readonly BindableProperty SelectedItemProperty = BindableProperty.Create(nameof(SelectedItem), typeof(object), typeof(ListDataPage), null, BindingMode.TwoWay, + propertyChanged: OnSelectedItemChanged); + + public DataTemplate DetailTemplate + { + get { return (DataTemplate)GetValue(DetailTemplateProperty); } + set { SetValue(DetailTemplateProperty, value); } + } + + public object SelectedItem + { + get { return GetValue(SelectedItemProperty); } + set { SetValue(SelectedItemProperty, value); } + } + + static async void OnSelectedItemChanged(BindableObject bindable, object oldValue, object newValue) + { + var self = (ListDataPage)bindable; + DataTemplate template = self.DetailTemplate; + if (newValue == null) + return; + + Page detailPage; + if (template == null) + { + detailPage = new DataPage(); + } + else + { + detailPage = (Page)template.CreateContent(newValue, self); + } + + detailPage.BindingContext = newValue; + await self.Navigation.PushAsync(detailPage); + + self.SelectedItem = null; + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Pages/ListItemControl.cs b/Xamarin.Forms.Pages/ListItemControl.cs new file mode 100644 index 00000000..d5ba37a1 --- /dev/null +++ b/Xamarin.Forms.Pages/ListItemControl.cs @@ -0,0 +1,45 @@ +namespace Xamarin.Forms.Pages +{ + public class ListItemControl : DataView + { + public static readonly BindableProperty TitleProperty = BindableProperty.Create(nameof(Title), typeof(string), typeof(ListItemControl), default(string)); + + public static readonly BindableProperty DetailProperty = BindableProperty.Create(nameof(Detail), typeof(string), typeof(ListItemControl), default(string)); + + public static readonly BindableProperty ImageSourceProperty = BindableProperty.Create(nameof(ImageSource), typeof(ImageSource), typeof(ListItemControl), default(ImageSource)); + + public static readonly BindableProperty PlaceHolderImageSourceProperty = BindableProperty.Create(nameof(PlaceholderImageSource), typeof(ImageSource), typeof(ListItemControl), default(ImageSource)); + + public static readonly BindableProperty AspectProperty = BindableProperty.Create(nameof(Aspect), typeof(Aspect), typeof(ListItemControl), default(Aspect)); + + public Aspect Aspect + { + get { return (Aspect)GetValue(AspectProperty); } + set { SetValue(AspectProperty, value); } + } + + public string Detail + { + get { return (string)GetValue(DetailProperty); } + set { SetValue(DetailProperty, value); } + } + + public ImageSource ImageSource + { + get { return (ImageSource)GetValue(ImageSourceProperty); } + set { SetValue(ImageSourceProperty, value); } + } + + public ImageSource PlaceholderImageSource + { + get { return (ImageSource)GetValue(PlaceHolderImageSourceProperty); } + set { SetValue(PlaceHolderImageSourceProperty, value); } + } + + public string Title + { + get { return (string)GetValue(TitleProperty); } + set { SetValue(TitleProperty, value); } + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Pages/PersonDetailPage.cs b/Xamarin.Forms.Pages/PersonDetailPage.cs new file mode 100644 index 00000000..9a58e106 --- /dev/null +++ b/Xamarin.Forms.Pages/PersonDetailPage.cs @@ -0,0 +1,90 @@ +namespace Xamarin.Forms.Pages +{ + public class PersonDetailPage : DataPage + { + public static readonly BindableProperty DisplayNameProperty = BindableProperty.Create(nameof(DisplayName), typeof(string), typeof(PersonDetailPage), default(string)); + + public static readonly BindableProperty PhoneNumberProperty = BindableProperty.Create(nameof(PhoneNumber), typeof(string), typeof(PersonDetailPage), default(string)); + + public static readonly BindableProperty ImageProperty = BindableProperty.Create(nameof(Image), typeof(ImageSource), typeof(PersonDetailPage), default(ImageSource)); + + public static readonly BindableProperty EmailProperty = BindableProperty.Create(nameof(Email), typeof(string), typeof(PersonDetailPage), default(string)); + + public static readonly BindableProperty AddressProperty = BindableProperty.Create(nameof(Address), typeof(string), typeof(PersonDetailPage), default(string)); + + public static readonly BindableProperty EmployerProperty = BindableProperty.Create(nameof(Employer), typeof(string), typeof(PersonDetailPage), default(string)); + + public static readonly BindableProperty TwitterProperty = BindableProperty.Create(nameof(Twitter), typeof(string), typeof(PersonDetailPage), default(string)); + + public static readonly BindableProperty FacebookProperty = BindableProperty.Create(nameof(Facebook), typeof(string), typeof(PersonDetailPage), default(string)); + + public static readonly BindableProperty WebsiteProperty = BindableProperty.Create(nameof(Website), typeof(string), typeof(PersonDetailPage), default(string)); + + public PersonDetailPage() + { + SetBinding(DisplayNameProperty, new DataSourceBinding(nameof(DisplayName))); + SetBinding(PhoneNumberProperty, new DataSourceBinding(nameof(PhoneNumber))); + SetBinding(ImageProperty, new DataSourceBinding(nameof(Image))); + SetBinding(EmailProperty, new DataSourceBinding(nameof(Email))); + SetBinding(AddressProperty, new DataSourceBinding(nameof(Address))); + SetBinding(EmployerProperty, new DataSourceBinding(nameof(Employer))); + SetBinding(TwitterProperty, new DataSourceBinding(nameof(Twitter))); + SetBinding(FacebookProperty, new DataSourceBinding(nameof(Facebook))); + SetBinding(WebsiteProperty, new DataSourceBinding(nameof(Website))); + } + + public string Address + { + get { return (string)GetValue(AddressProperty); } + set { SetValue(AddressProperty, value); } + } + + public string DisplayName + { + get { return (string)GetValue(DisplayNameProperty); } + set { SetValue(DisplayNameProperty, value); } + } + + public string Email + { + get { return (string)GetValue(EmailProperty); } + set { SetValue(EmailProperty, value); } + } + + public string Employer + { + get { return (string)GetValue(EmployerProperty); } + set { SetValue(EmployerProperty, value); } + } + + public string Facebook + { + get { return (string)GetValue(FacebookProperty); } + set { SetValue(FacebookProperty, value); } + } + + public ImageSource Image + { + get { return (ImageSource)GetValue(ImageProperty); } + set { SetValue(ImageProperty, value); } + } + + public string PhoneNumber + { + get { return (string)GetValue(PhoneNumberProperty); } + set { SetValue(PhoneNumberProperty, value); } + } + + public string Twitter + { + get { return (string)GetValue(TwitterProperty); } + set { SetValue(TwitterProperty, value); } + } + + public string Website + { + get { return (string)GetValue(WebsiteProperty); } + set { SetValue(WebsiteProperty, value); } + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Pages/Properties/AssemblyInfo.cs b/Xamarin.Forms.Pages/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..a7150fb3 --- /dev/null +++ b/Xamarin.Forms.Pages/Properties/AssemblyInfo.cs @@ -0,0 +1,30 @@ +using System.Reflection; +using System.Resources; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. + +[assembly: AssemblyTitle("Xamarin.Forms.Pages")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Xamarin.Forms.Pages")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: NeutralResourcesLanguage("en")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] + +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")]
\ No newline at end of file diff --git a/Xamarin.Forms.Pages/StringJsonSource.cs b/Xamarin.Forms.Pages/StringJsonSource.cs new file mode 100644 index 00000000..79e59e62 --- /dev/null +++ b/Xamarin.Forms.Pages/StringJsonSource.cs @@ -0,0 +1,20 @@ +using System.Threading.Tasks; + +namespace Xamarin.Forms.Pages +{ + public class StringJsonSource : JsonSource + { + public static readonly BindableProperty JsonProperty = BindableProperty.Create(nameof(Json), typeof(string), typeof(StringJsonSource), null); + + public string Json + { + get { return (string)GetValue(JsonProperty); } + set { SetValue(JsonProperty, value); } + } + + public override Task<string> GetJson() + { + return Task.FromResult(Json); + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Pages/UriJsonSource.cs b/Xamarin.Forms.Pages/UriJsonSource.cs new file mode 100644 index 00000000..d732e25c --- /dev/null +++ b/Xamarin.Forms.Pages/UriJsonSource.cs @@ -0,0 +1,34 @@ +using System; +using System.IO; +using System.Net; +using System.Net.Http; +using System.Threading.Tasks; + +namespace Xamarin.Forms.Pages +{ + public class UriJsonSource : JsonSource + { + public static readonly BindableProperty UriProperty = BindableProperty.Create(nameof(Uri), typeof(Uri), + typeof(UriJsonSource), null); + + public Uri Uri + { + get { return (Uri)GetValue(UriProperty); } + set { SetValue(UriProperty, value); } + } + + public override async Task<string> GetJson() + { + var webClient = new HttpClient(new ModernHttpClient.NativeMessageHandler()); + try + { + string json = await webClient.GetStringAsync(Uri); + return json; + } + catch + { + return null; + } + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Pages/Xamarin.Forms.Pages.csproj b/Xamarin.Forms.Pages/Xamarin.Forms.Pages.csproj new file mode 100644 index 00000000..15c8e1cd --- /dev/null +++ b/Xamarin.Forms.Pages/Xamarin.Forms.Pages.csproj @@ -0,0 +1,105 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>Xamarin.Forms.Pages</RootNamespace> + <AssemblyName>Xamarin.Forms.Pages</AssemblyName> + <DefaultLanguage>en-US</DefaultLanguage> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <TargetFrameworkProfile>Profile259</TargetFrameworkProfile> + <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <!-- A reference to the entire .NET Framework is automatically included --> + <ProjectReference Include="..\Xamarin.Forms.Core\Xamarin.Forms.Core.csproj"> + <Project>{57b8b73d-c3b5-4c42-869e-7b2f17d354ac}</Project> + <Name>Xamarin.Forms.Core</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <Compile Include="BaseDataSource.cs" /> + <Compile Include="CardView.cs" /> + <Compile Include="CompoundCollection.cs" /> + <Compile Include="DataItem.cs" /> + <Compile Include="DataPage.cs" /> + <Compile Include="DataSourceBinding.cs" /> + <Compile Include="DataSourceBindingExtension.cs" /> + <Compile Include="DataSourceList.cs" /> + <Compile Include="DataView.cs" /> + <Compile Include="DirectoryPage.cs" /> + <Compile Include="HeroImage.cs" /> + <Compile Include="IDataItem.cs" /> + <Compile Include="IDataSource.cs" /> + <Compile Include="IDataSourceProvider.cs" /> + <Compile Include="JsonSource.cs" /> + <Compile Include="JsonDataSource.cs" /> + <Compile Include="JsonSourceConverter.cs" /> + <Compile Include="ListDataPage.cs" /> + <Compile Include="ListItemControl.cs" /> + <Compile Include="PersonDetailPage.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="StringJsonSource.cs" /> + <Compile Include="UriJsonSource.cs" /> + </ItemGroup> + <ItemGroup> + <Reference Include="ModernHttpClient, Version=2.4.2.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\modernhttpclient.2.4.2\lib\Portable-Net45+WinRT45+WP8+WPA81\ModernHttpClient.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="System.Net.Http, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="System.Net.Http.Extensions, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Extensions.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="System.Net.Http.Primitives, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\portable-net40+sl4+win8+wp71+wpa81\System.Net.Http.Primitives.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Newtonsoft.Json"> + <HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\portable-net45+wp80+win8+wpa81+dnxcore50\Newtonsoft.Json.dll</HintPath> + </Reference> + </ItemGroup> + <ItemGroup> + <None Include="packages.config" /> + </ItemGroup> + <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" /> + <Import Project="..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" /> + <Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''"> + <Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" /> + <Error Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" /> + </Target> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project>
\ No newline at end of file diff --git a/Xamarin.Forms.Pages/packages.config b/Xamarin.Forms.Pages/packages.config new file mode 100644 index 00000000..1861a33d --- /dev/null +++ b/Xamarin.Forms.Pages/packages.config @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="Microsoft.Bcl" version="1.1.10" targetFramework="portable45-net45+win8+wp8+wpa81" /> + <package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="portable45-net45+win8+wp8+wpa81" /> + <package id="Microsoft.Net.Http" version="2.2.29" targetFramework="portable45-net45+win8+wp8+wpa81" /> + <package id="modernhttpclient" version="2.4.2" targetFramework="portable45-net45+win8+wp8+wpa81" /> + <package id="Newtonsoft.Json" version="8.0.3" targetFramework="portable-net45+win+wpa81+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarintvos10+xamarinwatchos10+xamarinios10" /> +</packages>
\ No newline at end of file diff --git a/Xamarin.Forms.Platform.Android.AppLinks/AndroidAppLinks.cs b/Xamarin.Forms.Platform.Android.AppLinks/AndroidAppLinks.cs new file mode 100644 index 00000000..b1639da7 --- /dev/null +++ b/Xamarin.Forms.Platform.Android.AppLinks/AndroidAppLinks.cs @@ -0,0 +1,115 @@ +using System; +using System.Threading.Tasks; +using Android.Content; +using Android.Gms.AppIndexing; +using Android.Gms.Common.Apis; +using Android.Runtime; +using IndexingAction = Android.Gms.AppIndexing.Action; +using Android.App; + +namespace Xamarin.Forms.Platform.Android.AppLinks +{ + [Preserve(AllMembers = true)] + public class AndroidAppLinks : IAppLinks, IDisposable + { + readonly GoogleApiClient _client; + + bool _disposed; + + public static bool IsInitialized { get; private set; } + + public static Context Context { get; private set; } + + public static void Init(Activity activity) + { + if (IsInitialized) + return; + IsInitialized = true; + + Context = activity; + } + + public AndroidAppLinks(Context context) + { + _client = new GoogleApiClient.Builder(context).AddApi(AppIndex.API).Build(); + _client.Connect(); + } + + public void DeregisterLink(IAppLinkEntry appLink) + { + RemoveFromIndexItemAsync(appLink.AppLinkUri.ToString()); + } + + public void DeregisterLink(Uri appLinkUri) + { + RemoveFromIndexItemAsync(appLinkUri.ToString()); + } + + public async void RegisterLink(IAppLinkEntry appLink) + { + await IndexItemAsync(appLink); + } + + public void Dispose() + { + Dispose(true); + } + + protected virtual void Dispose(bool isDisposing) + { + if (isDisposing && !_disposed) + { + _disposed = true; + _client.Disconnect(); + _client.Dispose(); + } + } + + static IndexingAction BuildIndexAction(IAppLinkEntry appLink) + { + Thing item = new Thing.Builder().SetName(appLink.Title).SetDescription(appLink.Description).SetUrl(global::Android.Net.Uri.Parse(appLink.AppLinkUri.AbsoluteUri)).Build(); + Thing thing = new IndexingAction.Builder(IndexingAction.TypeView).SetObject(item).SetActionStatus(IndexingAction.StatusTypeCompleted).Build(); + var indexAction = thing.JavaCast<IndexingAction>(); + return indexAction; + } + + async Task IndexItemAsync(IAppLinkEntry appLink) + { + IndexingAction indexAction = BuildIndexAction(appLink); + + if (_client.IsConnected && appLink.IsLinkActive) + { + Statuses resultStart = await AppIndex.AppIndexApi.StartAsync(_client, indexAction); + if (resultStart.IsSuccess) + { + var aL = appLink as AppLinkEntry; + if (aL != null) + { + aL.PropertyChanged += async (sender, e) => + { + if (e.PropertyName == AppLinkEntry.IsLinkActiveProperty.PropertyName) + { + if (appLink.IsLinkActive) + { + Statuses resultStartAgain = await AppIndex.AppIndexApi.StartAsync(_client, indexAction); + } + else + { + Statuses resultEnd = await AppIndex.AppIndexApi.EndAsync(_client, indexAction); + } + } + }; + } + } + } + } + + void RemoveFromIndexItemAsync(string identifier) + { + if (_client.IsConnected) + { + } + } + } +} + diff --git a/Xamarin.Forms.Platform.Android.AppLinks/Properties/AssemblyInfo.cs b/Xamarin.Forms.Platform.Android.AppLinks/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..330d609a --- /dev/null +++ b/Xamarin.Forms.Platform.Android.AppLinks/Properties/AssemblyInfo.cs @@ -0,0 +1,27 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("Xamarin.Forms.Platform.Android.AppLinks")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("Xamarin")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("1.0.0")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] + diff --git a/Xamarin.Forms.Platform.Android.AppLinks/Resources/AboutResources.txt b/Xamarin.Forms.Platform.Android.AppLinks/Resources/AboutResources.txt new file mode 100644 index 00000000..10f52d46 --- /dev/null +++ b/Xamarin.Forms.Platform.Android.AppLinks/Resources/AboutResources.txt @@ -0,0 +1,44 @@ +Images, layout descriptions, binary blobs and string dictionaries can be included +in your application as resource files. Various Android APIs are designed to +operate on the resource IDs instead of dealing with images, strings or binary blobs +directly. + +For example, a sample Android app that contains a user interface layout (main.axml), +an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) +would keep its resources in the "Resources" directory of the application: + +Resources/ + drawable/ + icon.png + + layout/ + main.axml + + values/ + strings.xml + +In order to get the build system to recognize Android resources, set the build action to +"AndroidResource". The native Android APIs do not operate directly with filenames, but +instead operate on resource IDs. When you compile an Android application that uses resources, +the build system will package the resources for distribution and generate a class called "R" +(this is an Android convention) that contains the tokens for each one of the resources +included. For example, for the above Resources layout, this is what the R class would expose: + +public class R { + public class drawable { + public const int icon = 0x123; + } + + public class layout { + public const int main = 0x456; + } + + public class strings { + public const int first_string = 0xabc; + public const int second_string = 0xbcd; + } +} + +You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main +to reference the layout/main.axml file, or R.strings.first_string to reference the first +string in the dictionary file values/strings.xml. diff --git a/Xamarin.Forms.Platform.Android.AppLinks/Resources/values/Strings.xml b/Xamarin.Forms.Platform.Android.AppLinks/Resources/values/Strings.xml new file mode 100644 index 00000000..08334fa4 --- /dev/null +++ b/Xamarin.Forms.Platform.Android.AppLinks/Resources/values/Strings.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <string name="library_name">Xamarin.Forms.Platform.Android.AppLinks</string> +</resources> diff --git a/Xamarin.Forms.Platform.Android.AppLinks/Xamarin.Forms.Platform.Android.AppLinks.csproj b/Xamarin.Forms.Platform.Android.AppLinks/Xamarin.Forms.Platform.Android.AppLinks.csproj new file mode 100644 index 00000000..08864b51 --- /dev/null +++ b/Xamarin.Forms.Platform.Android.AppLinks/Xamarin.Forms.Platform.Android.AppLinks.csproj @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ProjectGuid>{42DB052E-0909-45D2-8240-187F99F393FB}</ProjectGuid> + <OutputType>Library</OutputType> + <RootNamespace>Xamarin.Forms.Platform.Android.AppLinks</RootNamespace> + <MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix> + <MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix> + <AndroidResgenClass>Resource</AndroidResgenClass> + <AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile> + <AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk> + <AssemblyName>Xamarin.Forms.Platform.Android.AppLinks</AssemblyName> + <TargetFrameworkVersion>v6.0</TargetFrameworkVersion> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug</OutputPath> + <DefineConstants>DEBUG;</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <AndroidLinkMode>None</AndroidLinkMode> + <ConsolePause>false</ConsolePause> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>full</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release</OutputPath> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <AndroidUseSharedRuntime>false</AndroidUseSharedRuntime> + <ConsolePause>false</ConsolePause> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Xml" /> + <Reference Include="System.Core" /> + <Reference Include="Mono.Android" /> + <Reference Include="Xamarin.GooglePlayServices.Basement"> + <HintPath>..\packages\Xamarin.GooglePlayServices.Basement.29.0.0.1\lib\MonoAndroid41\Xamarin.GooglePlayServices.Basement.dll</HintPath> + </Reference> + <Reference Include="Xamarin.GooglePlayServices.Base"> + <HintPath>..\packages\Xamarin.GooglePlayServices.Base.29.0.0.1\lib\MonoAndroid41\Xamarin.GooglePlayServices.Base.dll</HintPath> + </Reference> + <Reference Include="Xamarin.GooglePlayServices.AppIndexing"> + <HintPath>..\packages\Xamarin.GooglePlayServices.AppIndexing.29.0.0.1\lib\MonoAndroid41\Xamarin.GooglePlayServices.AppIndexing.dll</HintPath> + </Reference> + <Reference Include="Xamarin.Android.Support.v4"> + <HintPath>..\packages\Xamarin.Android.Support.v4.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v4.dll</HintPath> + </Reference> + </ItemGroup> + <ItemGroup> + <Compile Include="Resources\Resource.designer.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="AndroidAppLinks.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="Resources\AboutResources.txt" /> + <None Include="packages.config" /> + </ItemGroup> + <ItemGroup> + <AndroidResource Include="Resources\values\Strings.xml" /> + </ItemGroup> + <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> + <ItemGroup> + <ProjectReference Include="..\Xamarin.Forms.Core\Xamarin.Forms.Core.csproj"> + <Project>{57B8B73D-C3B5-4C42-869E-7B2F17D354AC}</Project> + <Name>Xamarin.Forms.Core</Name> + </ProjectReference> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/Xamarin.Forms.Platform.Android.AppLinks/packages.config b/Xamarin.Forms.Platform.Android.AppLinks/packages.config new file mode 100644 index 00000000..b488c682 --- /dev/null +++ b/Xamarin.Forms.Platform.Android.AppLinks/packages.config @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="Xamarin.Android.Support.v4" version="23.3.0" targetFramework="MonoAndroid60" /> + <package id="Xamarin.GooglePlayServices.AppIndexing" version="29.0.0.1" targetFramework="MonoAndroid60" /> + <package id="Xamarin.GooglePlayServices.Base" version="29.0.0.1" targetFramework="MonoAndroid60" /> + <package id="Xamarin.GooglePlayServices.Basement" version="29.0.0.1" targetFramework="MonoAndroid60" /> +</packages>
\ No newline at end of file diff --git a/Xamarin.Forms.Platform.Android/AndroidAppIndexProvider.cs b/Xamarin.Forms.Platform.Android/AndroidAppIndexProvider.cs new file mode 100644 index 00000000..e9b85eec --- /dev/null +++ b/Xamarin.Forms.Platform.Android/AndroidAppIndexProvider.cs @@ -0,0 +1,41 @@ +using Android.Content; +using System; +using System.Reflection; +using System.Linq; +using System.Globalization; + +namespace Xamarin.Forms.Platform.Android +{ + public class AndroidAppIndexProvider : IAppIndexingProvider + { + public AndroidAppIndexProvider(Context context) + { + var assemblyAppLinks = GetAssemblyForAppLinks(AppLinksAssemblyName); + + if (assemblyAppLinks != null) + { + Type type = assemblyAppLinks.GetType($"{AppLinksAssemblyName}.{AppLinksClassName}"); + + if (type != null) + { + var applink = Activator.CreateInstance(type, new object[] { context }, null); + + if (applink != null) + { + AppLinks = applink as IAppLinks; + } + } + } + } + + public IAppLinks AppLinks { get; } + + private Assembly GetAssemblyForAppLinks(string assemblyName) + { + return Device.GetAssemblies().FirstOrDefault(assembly => assembly.GetName().Name == assemblyName); + } + + const string AppLinksAssemblyName = "Xamarin.Forms.Platform.Android.AppLinks"; + const string AppLinksClassName = "AndroidAppLinks"; + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Platform.Android/AppCompat/FormsAppCompatActivity.cs b/Xamarin.Forms.Platform.Android/AppCompat/FormsAppCompatActivity.cs index 8eeeae09..6bd7df2b 100644 --- a/Xamarin.Forms.Platform.Android/AppCompat/FormsAppCompatActivity.cs +++ b/Xamarin.Forms.Platform.Android/AppCompat/FormsAppCompatActivity.cs @@ -119,8 +119,11 @@ namespace Xamarin.Forms.Platform.Android throw new ArgumentNullException("application"); _application = application; + (application as IApplicationController)?.SetAppIndexingProvider(new AndroidAppIndexProvider(this)); Xamarin.Forms.Application.Current = application; + CheckForAppLink(Intent); + application.PropertyChanged += AppOnPropertyChanged; SetMainPage(); @@ -205,6 +208,7 @@ namespace Xamarin.Forms.Platform.Android protected override void OnNewIntent(Intent intent) { base.OnNewIntent(intent); + CheckForAppLink(intent); } protected override void OnPause() @@ -292,6 +296,17 @@ namespace Xamarin.Forms.Platform.Android InternalSetPage(_application.MainPage); } + void CheckForAppLink(Intent intent) + { + string action = intent.Action; + string strLink = intent.DataString; + if (Intent.ActionView != action || string.IsNullOrWhiteSpace(strLink)) + return; + + var link = new Uri(strLink); + _application?.SendOnAppLinkRequestReceived(link); + } + int GetColorPrimaryDark() { FormsAppCompatActivity context = this; diff --git a/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android.csproj b/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android.csproj index f9ee72e9..2dea12eb 100644 --- a/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android.csproj +++ b/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android.csproj @@ -239,6 +239,7 @@ <Compile Include="Renderers\OpenGLViewRenderer.cs" /> <Compile Include="AppCompat\CarouselPageRenderer.cs" /> <Compile Include="AppCompat\FormsFragmentPagerAdapter.cs" /> + <Compile Include="AndroidAppIndexProvider.cs" /> </ItemGroup> <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. diff --git a/Xamarin.Forms.Platform.iOS/FormsApplicationDelegate.cs b/Xamarin.Forms.Platform.iOS/FormsApplicationDelegate.cs index a4342473..78dc6dca 100644 --- a/Xamarin.Forms.Platform.iOS/FormsApplicationDelegate.cs +++ b/Xamarin.Forms.Platform.iOS/FormsApplicationDelegate.cs @@ -5,10 +5,12 @@ using System.Text; #if __UNIFIED__ using Foundation; using UIKit; +using CoreSpotlight; #else using MonoTouch.Foundation; using MonoTouch.UIKit; +using MonoTouch.CoreSpotlight; #endif namespace Xamarin.Forms.Platform.iOS @@ -25,6 +27,7 @@ namespace Xamarin.Forms.Platform.iOS public override bool ContinueUserActivity(UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { + CheckForAppLink(userActivity); return true; } @@ -77,6 +80,7 @@ namespace Xamarin.Forms.Platform.iOS public override void UserActivityUpdated(UIApplication application, NSUserActivity userActivity) { + CheckForAppLink(userActivity); } // from background to foreground, not yet active @@ -121,6 +125,7 @@ namespace Xamarin.Forms.Platform.iOS Application.Current = application; _application = application; + (application as IApplicationController)?.SetAppIndexingProvider(new IOSAppIndexingProvider()); application.PropertyChanged += ApplicationOnPropertyChanged; } @@ -131,6 +136,29 @@ namespace Xamarin.Forms.Platform.iOS UpdateMainPage(); } + void CheckForAppLink(NSUserActivity userActivity) + { + var strLink = string.Empty; + + switch (userActivity.ActivityType) + { + case "NSUserActivityTypeBrowsingWeb": + strLink = userActivity.WebPageUrl.AbsoluteString; + break; + case "com.apple.corespotlightitem": + if (userActivity.UserInfo.ContainsKey(CSSearchableItem.ActivityIdentifier)) + strLink = userActivity.UserInfo.ObjectForKey(CSSearchableItem.ActivityIdentifier).ToString(); + break; + default: + if (userActivity.UserInfo.ContainsKey(new NSString("link"))) + strLink = userActivity.UserInfo[new NSString("link")].ToString(); + break; + } + + if (!string.IsNullOrEmpty(strLink)) + _application.SendOnAppLinkRequestReceived(new Uri(strLink)); + } + void SetMainPage() { UpdateMainPage(); diff --git a/Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.Classic.csproj b/Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.Classic.csproj index cc6aa44c..1fc4340b 100644 --- a/Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.Classic.csproj +++ b/Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.Classic.csproj @@ -144,6 +144,8 @@ <Compile Include="$(MSBuildThisFileDirectory)Renderers\ToolbarRenderer.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Renderers\WebViewRenderer.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Properties\AssemblyInfo.cs" /> + <Compile Include="iOSAppIndexingProvider.cs" /> + <Compile Include="iOSAppLinks.cs" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Resources\StringResources.ar.resx" /> diff --git a/Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.csproj b/Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.csproj index 62993b4a..dde9103e 100644 --- a/Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.csproj +++ b/Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.csproj @@ -144,6 +144,8 @@ <DependentUpon>StringResources.resx</DependentUpon> </Compile> <Compile Include="ViewInitializedEventArgs.cs" /> + <Compile Include="IOSAppIndexingProvider.cs" /> + <Compile Include="IOSAppLinks.cs" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="Resources\StringResources.ar.resx" /> diff --git a/Xamarin.Forms.Platform.iOS/iOSAppIndexingProvider.cs b/Xamarin.Forms.Platform.iOS/iOSAppIndexingProvider.cs new file mode 100644 index 00000000..88e43e54 --- /dev/null +++ b/Xamarin.Forms.Platform.iOS/iOSAppIndexingProvider.cs @@ -0,0 +1,9 @@ +using System; + +namespace Xamarin.Forms.Platform.iOS +{ + public class IOSAppIndexingProvider : IAppIndexingProvider + { + public IAppLinks AppLinks => new IOSAppLinks(); + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Platform.iOS/iOSAppLinks.cs b/Xamarin.Forms.Platform.iOS/iOSAppLinks.cs new file mode 100644 index 00000000..de5876b4 --- /dev/null +++ b/Xamarin.Forms.Platform.iOS/iOSAppLinks.cs @@ -0,0 +1,190 @@ +using System; +using System.Threading.Tasks; +#if __UNIFIED__ +using Foundation; +using CoreSpotlight; +using UIKit; + +#else +using MonoTouch.Foundation; +using MonoTouch.UIKit; +using MonoTouch.CoreSpotlight; +#endif + +namespace Xamarin.Forms.Platform.iOS +{ + internal class IOSAppLinks : IAppLinks + { + public async void DeregisterLink(IAppLinkEntry appLink) + { + if (string.IsNullOrWhiteSpace(appLink.AppLinkUri?.ToString())) + throw new ArgumentNullException("AppLinkUri"); + await RemoveLinkAsync(appLink.AppLinkUri?.ToString()); + } + + public async void DeregisterLink(Uri uri) + { + if (string.IsNullOrWhiteSpace(uri?.ToString())) + throw new ArgumentNullException(nameof(uri)); + await RemoveLinkAsync(uri.ToString()); + } + + public async void RegisterLink(IAppLinkEntry appLink) + { + if (string.IsNullOrWhiteSpace(appLink.AppLinkUri?.ToString())) + throw new ArgumentNullException("AppLinkUri"); + await AddLinkAsync(appLink); + } + + public async void DeregisterAll() + { + await ClearIndexedDataAsync(); + } + + static async Task AddLinkAsync(IAppLinkEntry deepLinkUri) + { + var appDomain = NSBundle.MainBundle.BundleIdentifier; + string contentType, associatedWebPage; + bool shouldAddToPublicIndex; + + //user can provide associatedWebPage, contentType, and shouldAddToPublicIndex + TryGetValues(deepLinkUri, out contentType, out associatedWebPage, out shouldAddToPublicIndex); + + //our unique identifier will be the only content that is common to spotlight search result and a activity + //this id allows us to avoid duplicate search results from CoreSpotlight api and NSUserActivity + //https://developer.apple.com/library/ios/technotes/tn2416/_index.html + var id = deepLinkUri.AppLinkUri.ToString(); + + var searchableAttributeSet = await GetAttributeSet(deepLinkUri, contentType, id); + var searchItem = new CSSearchableItem(id, appDomain, searchableAttributeSet); + //we need to make sure we index the item in spotlight first or the RelatedUniqueIdentifier will not work + await IndexItemAsync(searchItem); + +#if __UNIFIED__ + var activity = new NSUserActivity($"{appDomain}.{contentType}"); +#else + var activity = new NSUserActivity (new NSString($"{appDomain}.{contentType}")); +#endif + activity.Title = deepLinkUri.Title; + activity.EligibleForSearch = true; + + //help increase your website url index rating + if (!string.IsNullOrEmpty(associatedWebPage)) + activity.WebPageUrl = new NSUrl(associatedWebPage); + + //make this search result available to Apple and to other users thatdon't have your app + activity.EligibleForPublicIndexing = shouldAddToPublicIndex; + + activity.UserInfo = GetUserInfoForActivity(deepLinkUri); + activity.ContentAttributeSet = searchableAttributeSet; + + //we don't need to track if the link is active iOS will call ResignCurrent + if (deepLinkUri.IsLinkActive) + activity.BecomeCurrent(); + + var aL = deepLinkUri as AppLinkEntry; + if (aL != null) + { + aL.PropertyChanged += (sender, e) => + { + if (e.PropertyName == AppLinkEntry.IsLinkActiveProperty.PropertyName) + { + if (aL.IsLinkActive) + activity.BecomeCurrent(); + else + activity.ResignCurrent(); + } + }; + } + } + + static Task<bool> ClearIndexedDataAsync() + { + var tcs = new TaskCompletionSource<bool>(); + if (CSSearchableIndex.IsIndexingAvailable) + CSSearchableIndex.DefaultSearchableIndex.DeleteAll(error => tcs.TrySetResult(error == null)); + else + tcs.TrySetResult(false); + return tcs.Task; + } + + static async Task<CSSearchableItemAttributeSet> GetAttributeSet(IAppLinkEntry deepLinkUri, string contentType, string id) + { + var searchableAttributeSet = new CSSearchableItemAttributeSet(contentType) + { + RelatedUniqueIdentifier = id, + Title = deepLinkUri.Title, + ContentDescription = deepLinkUri.Description, + Url = new NSUrl(deepLinkUri.AppLinkUri.ToString()) + }; + + var source = deepLinkUri.Thumbnail; + IImageSourceHandler handler; + if (source != null && (handler = Registrar.Registered.GetHandler<IImageSourceHandler>(source.GetType())) != null) + { + UIImage uiimage; + try + { + uiimage = await handler.LoadImageAsync(source); + } + catch (OperationCanceledException) + { + uiimage = null; + } + searchableAttributeSet.ThumbnailData = uiimage.AsPNG(); + uiimage.Dispose(); + } + + return searchableAttributeSet; + } + + static NSMutableDictionary GetUserInfoForActivity(IAppLinkEntry deepLinkUri) + { + //this info will only appear if not from a spotlight search + var info = new NSMutableDictionary(); + info.Add(new NSString("link"), new NSString(deepLinkUri.AppLinkUri.ToString())); + foreach (var item in deepLinkUri.KeyValues) + info.Add(new NSString(item.Key), new NSString(item.Value)); + return info; + } + + static Task<bool> IndexItemAsync(CSSearchableItem searchItem) + { + var tcs = new TaskCompletionSource<bool>(); + if (CSSearchableIndex.IsIndexingAvailable) + { + CSSearchableIndex.DefaultSearchableIndex.Index(new[] { searchItem }, error => tcs.TrySetResult(error == null)); + } + else + tcs.SetResult(false); + return tcs.Task; + } + + static Task<bool> RemoveLinkAsync(string identifier) + { + var tcs = new TaskCompletionSource<bool>(); + if (CSSearchableIndex.IsIndexingAvailable) + CSSearchableIndex.DefaultSearchableIndex.Delete(new[] { identifier }, error => tcs.TrySetResult(error == null)); + else + tcs.SetResult(false); + return tcs.Task; + } + + //Parse the KeyValues because user can provide associatedWebPage, contentType, and shouldAddToPublicIndex options + static void TryGetValues(IAppLinkEntry deepLinkUri, out string contentType, out string associatedWebPage, out bool shouldAddToPublicIndex) + { + contentType = string.Empty; + associatedWebPage = string.Empty; + shouldAddToPublicIndex = false; + var publicIndex = string.Empty; + + if (!deepLinkUri.KeyValues.TryGetValue(nameof(contentType), out contentType)) + contentType = "View"; + + if (deepLinkUri.KeyValues.TryGetValue(nameof(publicIndex), out publicIndex)) + bool.TryParse(publicIndex, out shouldAddToPublicIndex); + + deepLinkUri.KeyValues.TryGetValue(nameof(associatedWebPage), out associatedWebPage); + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.sln b/Xamarin.Forms.sln index d88f6492..1dd56212 100644 --- a/Xamarin.Forms.sln +++ b/Xamarin.Forms.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.24720.0 +VisualStudioVersion = 14.0.25123.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Xamarin.Forms", "Xamarin.Forms", "{9AD757F5-E57A-459D-A0A7-E0675E045B84}" EndProject @@ -43,11 +43,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{29583A EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuspec", ".nuspec", "{7E12C50D-A570-4DF1-94E1-8599843FA87C}" ProjectSection(SolutionItems) = preProject + .nuspec\Xamarin.Forms.AppLinks.nuspec = .nuspec\Xamarin.Forms.AppLinks.nuspec .nuspec\Xamarin.Forms.Debug.targets = .nuspec\Xamarin.Forms.Debug.targets .nuspec\Xamarin.Forms.Maps.nuspec = .nuspec\Xamarin.Forms.Maps.nuspec .nuspec\Xamarin.Forms.Maps.props = .nuspec\Xamarin.Forms.Maps.props .nuspec\Xamarin.Forms.Maps.targets = .nuspec\Xamarin.Forms.Maps.targets .nuspec\Xamarin.Forms.nuspec = .nuspec\Xamarin.Forms.nuspec + .nuspec\Xamarin.Forms.Pages.nuspec = .nuspec\Xamarin.Forms.Pages.nuspec .nuspec\Xamarin.Forms.targets = .nuspec\Xamarin.Forms.targets EndProjectSection EndProject @@ -141,6 +143,22 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Forms.Maps.WinRT.Ta EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Forms.Core.Windows.UITests", "Xamarin.Forms.Core.Windows.UITests\Xamarin.Forms.Core.Windows.UITests.csproj", "{0A39A74B-6F7A-4D41-84F2-B0CCDCE899DF}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Forms.Pages", "Xamarin.Forms.Pages\Xamarin.Forms.Pages.csproj", "{D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Forms.Pages.UnitTests", "Xamarin.Forms.Pages.UnitTests\Xamarin.Forms.Pages.UnitTests.csproj", "{447DC60E-C485-4427-8CF7-50074C6B61DE}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Pages Gallery", "Pages Gallery", "{80BAC3FB-357A-4D05-A050-9F234DF49C97}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PagesGallery", "PagesGallery\PagesGallery\PagesGallery.csproj", "{7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PagesGallery.Droid", "PagesGallery\PagesGallery.Droid\PagesGallery.Droid.csproj", "{5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PagesGallery.iOS", "PagesGallery\PagesGallery.iOS\PagesGallery.iOS.csproj", "{392156B2-760A-4EE3-A822-CABD3238A21D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PagesGallery.UWP", "PagesGallery\PagesGallery.UWP\PagesGallery.UWP.csproj", "{95FEB8D4-D57E-4B96-A8D8-59D241C0501B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Forms.Platform.Android.AppLinks", "Xamarin.Forms.Platform.Android.AppLinks\Xamarin.Forms.Platform.Android.AppLinks.csproj", "{42DB052E-0909-45D2-8240-187F99F393FB}" +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution docs\APIDocs.projitems*{dc1f3933-ac99-4887-8b09-e13c2b346d4f}*SharedItemsImports = 13 @@ -1471,6 +1489,207 @@ Global {0A39A74B-6F7A-4D41-84F2-B0CCDCE899DF}.Release|Templates.Build.0 = Release|Any CPU {0A39A74B-6F7A-4D41-84F2-B0CCDCE899DF}.Release|x64.ActiveCfg = Release|Any CPU {0A39A74B-6F7A-4D41-84F2-B0CCDCE899DF}.Release|x86.ActiveCfg = Release|Any CPU + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}.Debug|ARM.ActiveCfg = Debug|Any CPU + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}.Debug|ARM.Build.0 = Debug|Any CPU + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}.Debug|iPhone.Build.0 = Debug|Any CPU + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}.Debug|Templates.ActiveCfg = Debug|Any CPU + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}.Debug|Templates.Build.0 = Debug|Any CPU + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}.Debug|x64.ActiveCfg = Debug|Any CPU + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}.Debug|x64.Build.0 = Debug|Any CPU + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}.Debug|x86.ActiveCfg = Debug|Any CPU + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}.Debug|x86.Build.0 = Debug|Any CPU + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}.Release|Any CPU.Build.0 = Release|Any CPU + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}.Release|ARM.ActiveCfg = Release|Any CPU + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}.Release|ARM.Build.0 = Release|Any CPU + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}.Release|iPhone.ActiveCfg = Release|Any CPU + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}.Release|iPhone.Build.0 = Release|Any CPU + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}.Release|Templates.ActiveCfg = Release|Any CPU + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}.Release|Templates.Build.0 = Release|Any CPU + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}.Release|x64.ActiveCfg = Release|Any CPU + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}.Release|x64.Build.0 = Release|Any CPU + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}.Release|x86.ActiveCfg = Release|Any CPU + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31}.Release|x86.Build.0 = Release|Any CPU + {447DC60E-C485-4427-8CF7-50074C6B61DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {447DC60E-C485-4427-8CF7-50074C6B61DE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {447DC60E-C485-4427-8CF7-50074C6B61DE}.Debug|ARM.ActiveCfg = Debug|Any CPU + {447DC60E-C485-4427-8CF7-50074C6B61DE}.Debug|ARM.Build.0 = Debug|Any CPU + {447DC60E-C485-4427-8CF7-50074C6B61DE}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {447DC60E-C485-4427-8CF7-50074C6B61DE}.Debug|iPhone.Build.0 = Debug|Any CPU + {447DC60E-C485-4427-8CF7-50074C6B61DE}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {447DC60E-C485-4427-8CF7-50074C6B61DE}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {447DC60E-C485-4427-8CF7-50074C6B61DE}.Debug|Templates.ActiveCfg = Debug|Any CPU + {447DC60E-C485-4427-8CF7-50074C6B61DE}.Debug|Templates.Build.0 = Debug|Any CPU + {447DC60E-C485-4427-8CF7-50074C6B61DE}.Debug|x64.ActiveCfg = Debug|Any CPU + {447DC60E-C485-4427-8CF7-50074C6B61DE}.Debug|x64.Build.0 = Debug|Any CPU + {447DC60E-C485-4427-8CF7-50074C6B61DE}.Debug|x86.ActiveCfg = Debug|Any CPU + {447DC60E-C485-4427-8CF7-50074C6B61DE}.Debug|x86.Build.0 = Debug|Any CPU + {447DC60E-C485-4427-8CF7-50074C6B61DE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {447DC60E-C485-4427-8CF7-50074C6B61DE}.Release|Any CPU.Build.0 = Release|Any CPU + {447DC60E-C485-4427-8CF7-50074C6B61DE}.Release|ARM.ActiveCfg = Release|Any CPU + {447DC60E-C485-4427-8CF7-50074C6B61DE}.Release|ARM.Build.0 = Release|Any CPU + {447DC60E-C485-4427-8CF7-50074C6B61DE}.Release|iPhone.ActiveCfg = Release|Any CPU + {447DC60E-C485-4427-8CF7-50074C6B61DE}.Release|iPhone.Build.0 = Release|Any CPU + {447DC60E-C485-4427-8CF7-50074C6B61DE}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {447DC60E-C485-4427-8CF7-50074C6B61DE}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {447DC60E-C485-4427-8CF7-50074C6B61DE}.Release|Templates.ActiveCfg = Release|Any CPU + {447DC60E-C485-4427-8CF7-50074C6B61DE}.Release|Templates.Build.0 = Release|Any CPU + {447DC60E-C485-4427-8CF7-50074C6B61DE}.Release|x64.ActiveCfg = Release|Any CPU + {447DC60E-C485-4427-8CF7-50074C6B61DE}.Release|x64.Build.0 = Release|Any CPU + {447DC60E-C485-4427-8CF7-50074C6B61DE}.Release|x86.ActiveCfg = Release|Any CPU + {447DC60E-C485-4427-8CF7-50074C6B61DE}.Release|x86.Build.0 = Release|Any CPU + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}.Debug|ARM.ActiveCfg = Debug|Any CPU + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}.Debug|ARM.Build.0 = Debug|Any CPU + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}.Debug|iPhone.Build.0 = Debug|Any CPU + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}.Debug|Templates.ActiveCfg = Debug|Any CPU + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}.Debug|Templates.Build.0 = Debug|Any CPU + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}.Debug|x64.ActiveCfg = Debug|Any CPU + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}.Debug|x64.Build.0 = Debug|Any CPU + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}.Debug|x86.ActiveCfg = Debug|Any CPU + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}.Debug|x86.Build.0 = Debug|Any CPU + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}.Release|Any CPU.Build.0 = Release|Any CPU + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}.Release|ARM.ActiveCfg = Release|Any CPU + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}.Release|ARM.Build.0 = Release|Any CPU + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}.Release|iPhone.ActiveCfg = Release|Any CPU + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}.Release|iPhone.Build.0 = Release|Any CPU + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}.Release|Templates.ActiveCfg = Release|Any CPU + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}.Release|Templates.Build.0 = Release|Any CPU + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}.Release|x64.ActiveCfg = Release|Any CPU + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}.Release|x64.Build.0 = Release|Any CPU + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}.Release|x86.ActiveCfg = Release|Any CPU + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41}.Release|x86.Build.0 = Release|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Debug|ARM.ActiveCfg = Debug|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Debug|ARM.Build.0 = Debug|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Debug|ARM.Deploy.0 = Debug|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Debug|iPhone.Build.0 = Debug|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Debug|iPhone.Deploy.0 = Debug|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Debug|Templates.ActiveCfg = Debug|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Debug|Templates.Build.0 = Debug|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Debug|Templates.Deploy.0 = Debug|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Debug|x64.ActiveCfg = Debug|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Debug|x64.Build.0 = Debug|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Debug|x64.Deploy.0 = Debug|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Debug|x86.ActiveCfg = Debug|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Debug|x86.Build.0 = Debug|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Debug|x86.Deploy.0 = Debug|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Release|Any CPU.Build.0 = Release|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Release|Any CPU.Deploy.0 = Release|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Release|ARM.ActiveCfg = Release|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Release|ARM.Build.0 = Release|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Release|ARM.Deploy.0 = Release|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Release|iPhone.ActiveCfg = Release|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Release|iPhone.Build.0 = Release|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Release|iPhone.Deploy.0 = Release|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Release|Templates.ActiveCfg = Release|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Release|Templates.Build.0 = Release|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Release|Templates.Deploy.0 = Release|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Release|x64.ActiveCfg = Release|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Release|x64.Build.0 = Release|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Release|x64.Deploy.0 = Release|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Release|x86.ActiveCfg = Release|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Release|x86.Build.0 = Release|Any CPU + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2}.Release|x86.Deploy.0 = Release|Any CPU + {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator + {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator + {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|ARM.ActiveCfg = Debug|iPhone + {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|iPhone.ActiveCfg = Debug|iPhone + {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|iPhone.Build.0 = Debug|iPhone + {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator + {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator + {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|Templates.ActiveCfg = Debug|iPhone + {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|x64.ActiveCfg = Debug|iPhone + {392156B2-760A-4EE3-A822-CABD3238A21D}.Debug|x86.ActiveCfg = Debug|iPhone + {392156B2-760A-4EE3-A822-CABD3238A21D}.Release|Any CPU.ActiveCfg = Release|iPhone + {392156B2-760A-4EE3-A822-CABD3238A21D}.Release|ARM.ActiveCfg = Release|iPhone + {392156B2-760A-4EE3-A822-CABD3238A21D}.Release|iPhone.ActiveCfg = Release|iPhone + {392156B2-760A-4EE3-A822-CABD3238A21D}.Release|iPhone.Build.0 = Release|iPhone + {392156B2-760A-4EE3-A822-CABD3238A21D}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator + {392156B2-760A-4EE3-A822-CABD3238A21D}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {392156B2-760A-4EE3-A822-CABD3238A21D}.Release|Templates.ActiveCfg = Release|iPhone + {392156B2-760A-4EE3-A822-CABD3238A21D}.Release|x64.ActiveCfg = Release|iPhone + {392156B2-760A-4EE3-A822-CABD3238A21D}.Release|x86.ActiveCfg = Release|iPhone + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Debug|Any CPU.ActiveCfg = Debug|x86 + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Debug|Any CPU.Build.0 = Debug|x86 + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Debug|Any CPU.Deploy.0 = Debug|x86 + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Debug|ARM.ActiveCfg = Debug|ARM + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Debug|ARM.Build.0 = Debug|ARM + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Debug|ARM.Deploy.0 = Debug|ARM + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Debug|iPhone.ActiveCfg = Debug|x86 + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Debug|iPhoneSimulator.ActiveCfg = Debug|x86 + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Debug|Templates.ActiveCfg = Debug|x86 + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Debug|x64.ActiveCfg = Debug|x64 + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Debug|x64.Build.0 = Debug|x64 + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Debug|x64.Deploy.0 = Debug|x64 + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Debug|x86.ActiveCfg = Debug|x86 + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Debug|x86.Build.0 = Debug|x86 + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Debug|x86.Deploy.0 = Debug|x86 + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Release|Any CPU.ActiveCfg = Release|x86 + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Release|ARM.ActiveCfg = Release|ARM + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Release|ARM.Build.0 = Release|ARM + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Release|ARM.Deploy.0 = Release|ARM + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Release|iPhone.ActiveCfg = Release|x86 + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Release|iPhoneSimulator.ActiveCfg = Release|x86 + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Release|Templates.ActiveCfg = Release|x86 + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Release|x64.ActiveCfg = Release|x64 + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Release|x64.Build.0 = Release|x64 + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Release|x64.Deploy.0 = Release|x64 + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Release|x86.ActiveCfg = Release|x86 + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Release|x86.Build.0 = Release|x86 + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B}.Release|x86.Deploy.0 = Release|x86 + {42DB052E-0909-45D2-8240-187F99F393FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {42DB052E-0909-45D2-8240-187F99F393FB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {42DB052E-0909-45D2-8240-187F99F393FB}.Debug|ARM.ActiveCfg = Debug|Any CPU + {42DB052E-0909-45D2-8240-187F99F393FB}.Debug|ARM.Build.0 = Debug|Any CPU + {42DB052E-0909-45D2-8240-187F99F393FB}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {42DB052E-0909-45D2-8240-187F99F393FB}.Debug|iPhone.Build.0 = Debug|Any CPU + {42DB052E-0909-45D2-8240-187F99F393FB}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {42DB052E-0909-45D2-8240-187F99F393FB}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {42DB052E-0909-45D2-8240-187F99F393FB}.Debug|Templates.ActiveCfg = Debug|Any CPU + {42DB052E-0909-45D2-8240-187F99F393FB}.Debug|Templates.Build.0 = Debug|Any CPU + {42DB052E-0909-45D2-8240-187F99F393FB}.Debug|x64.ActiveCfg = Debug|Any CPU + {42DB052E-0909-45D2-8240-187F99F393FB}.Debug|x64.Build.0 = Debug|Any CPU + {42DB052E-0909-45D2-8240-187F99F393FB}.Debug|x86.ActiveCfg = Debug|Any CPU + {42DB052E-0909-45D2-8240-187F99F393FB}.Debug|x86.Build.0 = Debug|Any CPU + {42DB052E-0909-45D2-8240-187F99F393FB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {42DB052E-0909-45D2-8240-187F99F393FB}.Release|Any CPU.Build.0 = Release|Any CPU + {42DB052E-0909-45D2-8240-187F99F393FB}.Release|ARM.ActiveCfg = Release|Any CPU + {42DB052E-0909-45D2-8240-187F99F393FB}.Release|ARM.Build.0 = Release|Any CPU + {42DB052E-0909-45D2-8240-187F99F393FB}.Release|iPhone.ActiveCfg = Release|Any CPU + {42DB052E-0909-45D2-8240-187F99F393FB}.Release|iPhone.Build.0 = Release|Any CPU + {42DB052E-0909-45D2-8240-187F99F393FB}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {42DB052E-0909-45D2-8240-187F99F393FB}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {42DB052E-0909-45D2-8240-187F99F393FB}.Release|Templates.ActiveCfg = Release|Any CPU + {42DB052E-0909-45D2-8240-187F99F393FB}.Release|Templates.Build.0 = Release|Any CPU + {42DB052E-0909-45D2-8240-187F99F393FB}.Release|x64.ActiveCfg = Release|Any CPU + {42DB052E-0909-45D2-8240-187F99F393FB}.Release|x64.Build.0 = Release|Any CPU + {42DB052E-0909-45D2-8240-187F99F393FB}.Release|x86.ActiveCfg = Release|Any CPU + {42DB052E-0909-45D2-8240-187F99F393FB}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1528,5 +1747,12 @@ Global {2633AF57-F2CB-442A-AC19-F97BD8A06571} = {132FB9A4-613F-44CE-95D5-758D32D231DD} {E5C4698D-FB57-4EEC-98C0-89E620F6920A} = {132FB9A4-613F-44CE-95D5-758D32D231DD} {0A39A74B-6F7A-4D41-84F2-B0CCDCE899DF} = {D4D57221-71D6-4031-A6F4-EC66AF0929D9} + {D6133DBD-6C60-4BD5-BEA2-07E0A3927C31} = {9AD757F5-E57A-459D-A0A7-E0675E045B84} + {447DC60E-C485-4427-8CF7-50074C6B61DE} = {33A20844-7EF4-441D-83DA-2ACAF5E1CDFA} + {7B5F9E6A-6334-4C74-9B77-A55B3DA60E41} = {80BAC3FB-357A-4D05-A050-9F234DF49C97} + {5EB6EB6B-A412-4F41-A89B-D7C9AAD237F2} = {80BAC3FB-357A-4D05-A050-9F234DF49C97} + {392156B2-760A-4EE3-A822-CABD3238A21D} = {80BAC3FB-357A-4D05-A050-9F234DF49C97} + {95FEB8D4-D57E-4B96-A8D8-59D241C0501B} = {80BAC3FB-357A-4D05-A050-9F234DF49C97} + {42DB052E-0909-45D2-8240-187F99F393FB} = {29AC50BF-B4FB-450B-9386-0C5AD4B84226} EndGlobalSection EndGlobal diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms/AppLinkEntry.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms/AppLinkEntry.xml new file mode 100644 index 00000000..fdf39732 --- /dev/null +++ b/docs/Xamarin.Forms.Core/Xamarin.Forms/AppLinkEntry.xml @@ -0,0 +1,243 @@ +<Type Name="AppLinkEntry" FullName="Xamarin.Forms.AppLinkEntry"> + <TypeSignature Language="C#" Value="public class AppLinkEntry : Xamarin.Forms.Element, Xamarin.Forms.IAppLinkEntry" /> + <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit AppLinkEntry extends Xamarin.Forms.Element implements class Xamarin.Forms.IAppLinkEntry" /> + <AssemblyInfo> + <AssemblyName>Xamarin.Forms.Core</AssemblyName> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <Base> + <BaseTypeName>Xamarin.Forms.Element</BaseTypeName> + </Base> + <Interfaces> + <Interface> + <InterfaceName>Xamarin.Forms.IAppLinkEntry</InterfaceName> + </Interface> + </Interfaces> + <Docs> + <summary>To be added.</summary> + <remarks>To be added.</remarks> + </Docs> + <Members> + <Member MemberName=".ctor"> + <MemberSignature Language="C#" Value="public AppLinkEntry ();" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" /> + <MemberType>Constructor</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <Parameters /> + <Docs> + <summary>To be added.</summary> + <remarks>To be added.</remarks> + </Docs> + </Member> + <Member MemberName="AppLinkUri"> + <MemberSignature Language="C#" Value="public Uri AppLinkUri { get; set; }" /> + <MemberSignature Language="ILAsm" Value=".property instance class System.Uri AppLinkUri" /> + <MemberType>Property</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.Uri</ReturnType> + </ReturnValue> + <Docs> + <summary>To be added.</summary> + <value>To be added.</value> + <remarks>To be added.</remarks> + </Docs> + </Member> + <Member MemberName="AppLinkUriProperty"> + <MemberSignature Language="C#" Value="public static readonly Xamarin.Forms.BindableProperty AppLinkUriProperty;" /> + <MemberSignature Language="ILAsm" Value=".field public static initonly class Xamarin.Forms.BindableProperty AppLinkUriProperty" /> + <MemberType>Field</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>Xamarin.Forms.BindableProperty</ReturnType> + </ReturnValue> + <Docs> + <summary>To be added.</summary> + <remarks>To be added.</remarks> + </Docs> + </Member> + <Member MemberName="Description"> + <MemberSignature Language="C#" Value="public string Description { get; set; }" /> + <MemberSignature Language="ILAsm" Value=".property instance string Description" /> + <MemberType>Property</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.String</ReturnType> + </ReturnValue> + <Docs> + <summary>To be added.</summary> + <value>To be added.</value> + <remarks>To be added.</remarks> + </Docs> + </Member> + <Member MemberName="DescriptionProperty"> + <MemberSignature Language="C#" Value="public static readonly Xamarin.Forms.BindableProperty DescriptionProperty;" /> + <MemberSignature Language="ILAsm" Value=".field public static initonly class Xamarin.Forms.BindableProperty DescriptionProperty" /> + <MemberType>Field</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>Xamarin.Forms.BindableProperty</ReturnType> + </ReturnValue> + <Docs> + <summary>To be added.</summary> + <remarks>To be added.</remarks> + </Docs> + </Member> + <Member MemberName="FromUri"> + <MemberSignature Language="C#" Value="public static Xamarin.Forms.AppLinkEntry FromUri (Uri uri);" /> + <MemberSignature Language="ILAsm" Value=".method public static hidebysig class Xamarin.Forms.AppLinkEntry FromUri(class System.Uri uri) cil managed" /> + <MemberType>Method</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>Xamarin.Forms.AppLinkEntry</ReturnType> + </ReturnValue> + <Parameters> + <Parameter Name="uri" Type="System.Uri" /> + </Parameters> + <Docs> + <param name="uri">To be added.</param> + <summary>To be added.</summary> + <returns>To be added.</returns> + <remarks>To be added.</remarks> + </Docs> + </Member> + <Member MemberName="IsLinkActive"> + <MemberSignature Language="C#" Value="public bool IsLinkActive { get; set; }" /> + <MemberSignature Language="ILAsm" Value=".property instance bool IsLinkActive" /> + <MemberType>Property</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.Boolean</ReturnType> + </ReturnValue> + <Docs> + <summary>To be added.</summary> + <value>To be added.</value> + <remarks>To be added.</remarks> + </Docs> + </Member> + <Member MemberName="IsLinkActiveProperty"> + <MemberSignature Language="C#" Value="public static readonly Xamarin.Forms.BindableProperty IsLinkActiveProperty;" /> + <MemberSignature Language="ILAsm" Value=".field public static initonly class Xamarin.Forms.BindableProperty IsLinkActiveProperty" /> + <MemberType>Field</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>Xamarin.Forms.BindableProperty</ReturnType> + </ReturnValue> + <Docs> + <summary>To be added.</summary> + <remarks>To be added.</remarks> + </Docs> + </Member> + <Member MemberName="KeyValues"> + <MemberSignature Language="C#" Value="public System.Collections.Generic.IDictionary<string,string> KeyValues { get; }" /> + <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IDictionary`2<string, string> KeyValues" /> + <MemberType>Property</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.Collections.Generic.IDictionary<System.String,System.String></ReturnType> + </ReturnValue> + <Docs> + <summary>To be added.</summary> + <value>To be added.</value> + <remarks>To be added.</remarks> + </Docs> + </Member> + <Member MemberName="Thumbnail"> + <MemberSignature Language="C#" Value="public Xamarin.Forms.ImageSource Thumbnail { get; set; }" /> + <MemberSignature Language="ILAsm" Value=".property instance class Xamarin.Forms.ImageSource Thumbnail" /> + <MemberType>Property</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>Xamarin.Forms.ImageSource</ReturnType> + </ReturnValue> + <Docs> + <summary>To be added.</summary> + <value>To be added.</value> + <remarks>To be added.</remarks> + </Docs> + </Member> + <Member MemberName="ThumbnailProperty"> + <MemberSignature Language="C#" Value="public static readonly Xamarin.Forms.BindableProperty ThumbnailProperty;" /> + <MemberSignature Language="ILAsm" Value=".field public static initonly class Xamarin.Forms.BindableProperty ThumbnailProperty" /> + <MemberType>Field</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>Xamarin.Forms.BindableProperty</ReturnType> + </ReturnValue> + <Docs> + <summary>To be added.</summary> + <remarks>To be added.</remarks> + </Docs> + </Member> + <Member MemberName="Title"> + <MemberSignature Language="C#" Value="public string Title { get; set; }" /> + <MemberSignature Language="ILAsm" Value=".property instance string Title" /> + <MemberType>Property</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.String</ReturnType> + </ReturnValue> + <Docs> + <summary>To be added.</summary> + <value>To be added.</value> + <remarks>To be added.</remarks> + </Docs> + </Member> + <Member MemberName="TitleProperty"> + <MemberSignature Language="C#" Value="public static readonly Xamarin.Forms.BindableProperty TitleProperty;" /> + <MemberSignature Language="ILAsm" Value=".field public static initonly class Xamarin.Forms.BindableProperty TitleProperty" /> + <MemberType>Field</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>Xamarin.Forms.BindableProperty</ReturnType> + </ReturnValue> + <Docs> + <summary>To be added.</summary> + <remarks>To be added.</remarks> + </Docs> + </Member> + <Member MemberName="ToString"> + <MemberSignature Language="C#" Value="public override string ToString ();" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance string ToString() cil managed" /> + <MemberType>Method</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.String</ReturnType> + </ReturnValue> + <Parameters /> + <Docs> + <summary>To be added.</summary> + <returns>To be added.</returns> + <remarks>To be added.</remarks> + </Docs> + </Member> + </Members> +</Type> diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms/Application.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms/Application.xml index 51257c11..9f33ae28 100644 --- a/docs/Xamarin.Forms.Core/Xamarin.Forms/Application.xml +++ b/docs/Xamarin.Forms.Core/Xamarin.Forms/Application.xml @@ -1,6 +1,6 @@ <Type Name="Application" FullName="Xamarin.Forms.Application"> - <TypeSignature Language="C#" Value="public class Application : Xamarin.Forms.Element" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit Application extends Xamarin.Forms.Element" /> + <TypeSignature Language="C#" Value="public class Application : Xamarin.Forms.Element, Xamarin.Forms.IApplicationController" /> + <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit Application extends Xamarin.Forms.Element implements class Xamarin.Forms.IApplicationController" /> <AssemblyInfo> <AssemblyName>Xamarin.Forms.Core</AssemblyName> <AssemblyVersion>1.3.0.0</AssemblyVersion> @@ -39,6 +39,22 @@ <remarks>To be added.</remarks> </Docs> </Member> + <Member MemberName="AppLinks"> + <MemberSignature Language="C#" Value="public Xamarin.Forms.IAppLinks AppLinks { get; }" /> + <MemberSignature Language="ILAsm" Value=".property instance class Xamarin.Forms.IAppLinks AppLinks" /> + <MemberType>Property</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>Xamarin.Forms.IAppLinks</ReturnType> + </ReturnValue> + <Docs> + <summary>To be added.</summary> + <value>To be added.</value> + <remarks>To be added.</remarks> + </Docs> + </Member> <Member MemberName="Current"> <MemberSignature Language="C#" Value="public static Xamarin.Forms.Application Current { get; }" /> <MemberSignature Language="ILAsm" Value=".property class Xamarin.Forms.Application Current" /> @@ -151,6 +167,25 @@ <remarks>To be added.</remarks> </Docs> </Member> + <Member MemberName="OnAppLinkRequestReceived"> + <MemberSignature Language="C#" Value="protected virtual void OnAppLinkRequestReceived (Uri uri);" /> + <MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void OnAppLinkRequestReceived(class System.Uri uri) cil managed" /> + <MemberType>Method</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.Void</ReturnType> + </ReturnValue> + <Parameters> + <Parameter Name="uri" Type="System.Uri" /> + </Parameters> + <Docs> + <param name="uri">To be added.</param> + <summary>To be added.</summary> + <remarks>To be added.</remarks> + </Docs> + </Member> <Member MemberName="OnParentSet"> <MemberSignature Language="C#" Value="protected override void OnParentSet ();" /> <MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void OnParentSet() cil managed" /> @@ -281,6 +316,14 @@ <AssemblyVersion>1.5.0.0</AssemblyVersion> <AssemblyVersion>2.0.0.0</AssemblyVersion> </AssemblyInfo> + <Attributes> + <Attribute> + <AttributeName>System.Diagnostics.DebuggerStepThrough</AttributeName> + </Attribute> + <Attribute> + <AttributeName>System.Runtime.CompilerServices.AsyncStateMachine(typeof(Xamarin.Forms.Application/<SavePropertiesAsync>d__50))</AttributeName> + </Attribute> + </Attributes> <ReturnValue> <ReturnType>System.Threading.Tasks.Task</ReturnType> </ReturnValue> @@ -291,5 +334,24 @@ <remarks>To be added.</remarks> </Docs> </Member> + <Member MemberName="Xamarin.Forms.IApplicationController.SetAppIndexingProvider"> + <MemberSignature Language="C#" Value="void IApplicationController.SetAppIndexingProvider (Xamarin.Forms.IAppIndexingProvider provider);" /> + <MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance void Xamarin.Forms.IApplicationController.SetAppIndexingProvider(class Xamarin.Forms.IAppIndexingProvider provider) cil managed" /> + <MemberType>Method</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.Void</ReturnType> + </ReturnValue> + <Parameters> + <Parameter Name="provider" Type="Xamarin.Forms.IAppIndexingProvider" /> + </Parameters> + <Docs> + <param name="provider">To be added.</param> + <summary>To be added.</summary> + <remarks>To be added.</remarks> + </Docs> + </Member> </Members> </Type> diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms/IAppIndexingProvider.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms/IAppIndexingProvider.xml new file mode 100644 index 00000000..06c9baff --- /dev/null +++ b/docs/Xamarin.Forms.Core/Xamarin.Forms/IAppIndexingProvider.xml @@ -0,0 +1,31 @@ +<Type Name="IAppIndexingProvider" FullName="Xamarin.Forms.IAppIndexingProvider"> + <TypeSignature Language="C#" Value="public interface IAppIndexingProvider" /> + <TypeSignature Language="ILAsm" Value=".class public interface auto ansi abstract IAppIndexingProvider" /> + <AssemblyInfo> + <AssemblyName>Xamarin.Forms.Core</AssemblyName> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <Interfaces /> + <Docs> + <summary>To be added.</summary> + <remarks>To be added.</remarks> + </Docs> + <Members> + <Member MemberName="AppLinks"> + <MemberSignature Language="C#" Value="public Xamarin.Forms.IAppLinks AppLinks { get; }" /> + <MemberSignature Language="ILAsm" Value=".property instance class Xamarin.Forms.IAppLinks AppLinks" /> + <MemberType>Property</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>Xamarin.Forms.IAppLinks</ReturnType> + </ReturnValue> + <Docs> + <summary>To be added.</summary> + <value>To be added.</value> + <remarks>To be added.</remarks> + </Docs> + </Member> + </Members> +</Type> diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms/IAppLinkEntry.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms/IAppLinkEntry.xml new file mode 100644 index 00000000..e92f892a --- /dev/null +++ b/docs/Xamarin.Forms.Core/Xamarin.Forms/IAppLinkEntry.xml @@ -0,0 +1,111 @@ +<Type Name="IAppLinkEntry" FullName="Xamarin.Forms.IAppLinkEntry"> + <TypeSignature Language="C#" Value="public interface IAppLinkEntry" /> + <TypeSignature Language="ILAsm" Value=".class public interface auto ansi abstract IAppLinkEntry" /> + <AssemblyInfo> + <AssemblyName>Xamarin.Forms.Core</AssemblyName> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <Interfaces /> + <Docs> + <summary>To be added.</summary> + <remarks>To be added.</remarks> + </Docs> + <Members> + <Member MemberName="AppLinkUri"> + <MemberSignature Language="C#" Value="public Uri AppLinkUri { get; set; }" /> + <MemberSignature Language="ILAsm" Value=".property instance class System.Uri AppLinkUri" /> + <MemberType>Property</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.Uri</ReturnType> + </ReturnValue> + <Docs> + <summary>To be added.</summary> + <value>To be added.</value> + <remarks>To be added.</remarks> + </Docs> + </Member> + <Member MemberName="Description"> + <MemberSignature Language="C#" Value="public string Description { get; set; }" /> + <MemberSignature Language="ILAsm" Value=".property instance string Description" /> + <MemberType>Property</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.String</ReturnType> + </ReturnValue> + <Docs> + <summary>To be added.</summary> + <value>To be added.</value> + <remarks>To be added.</remarks> + </Docs> + </Member> + <Member MemberName="IsLinkActive"> + <MemberSignature Language="C#" Value="public bool IsLinkActive { get; set; }" /> + <MemberSignature Language="ILAsm" Value=".property instance bool IsLinkActive" /> + <MemberType>Property</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.Boolean</ReturnType> + </ReturnValue> + <Docs> + <summary>To be added.</summary> + <value>To be added.</value> + <remarks>To be added.</remarks> + </Docs> + </Member> + <Member MemberName="KeyValues"> + <MemberSignature Language="C#" Value="public System.Collections.Generic.IDictionary<string,string> KeyValues { get; }" /> + <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IDictionary`2<string, string> KeyValues" /> + <MemberType>Property</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.Collections.Generic.IDictionary<System.String,System.String></ReturnType> + </ReturnValue> + <Docs> + <summary>To be added.</summary> + <value>To be added.</value> + <remarks>To be added.</remarks> + </Docs> + </Member> + <Member MemberName="Thumbnail"> + <MemberSignature Language="C#" Value="public Xamarin.Forms.ImageSource Thumbnail { get; set; }" /> + <MemberSignature Language="ILAsm" Value=".property instance class Xamarin.Forms.ImageSource Thumbnail" /> + <MemberType>Property</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>Xamarin.Forms.ImageSource</ReturnType> + </ReturnValue> + <Docs> + <summary>To be added.</summary> + <value>To be added.</value> + <remarks>To be added.</remarks> + </Docs> + </Member> + <Member MemberName="Title"> + <MemberSignature Language="C#" Value="public string Title { get; set; }" /> + <MemberSignature Language="ILAsm" Value=".property instance string Title" /> + <MemberType>Property</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.String</ReturnType> + </ReturnValue> + <Docs> + <summary>To be added.</summary> + <value>To be added.</value> + <remarks>To be added.</remarks> + </Docs> + </Member> + </Members> +</Type> diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms/IAppLinks.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms/IAppLinks.xml new file mode 100644 index 00000000..9ae31b08 --- /dev/null +++ b/docs/Xamarin.Forms.Core/Xamarin.Forms/IAppLinks.xml @@ -0,0 +1,72 @@ +<Type Name="IAppLinks" FullName="Xamarin.Forms.IAppLinks"> + <TypeSignature Language="C#" Value="public interface IAppLinks" /> + <TypeSignature Language="ILAsm" Value=".class public interface auto ansi abstract IAppLinks" /> + <AssemblyInfo> + <AssemblyName>Xamarin.Forms.Core</AssemblyName> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <Interfaces /> + <Docs> + <summary>To be added.</summary> + <remarks>To be added.</remarks> + </Docs> + <Members> + <Member MemberName="DeregisterLink"> + <MemberSignature Language="C#" Value="public void DeregisterLink (Uri appLinkUri);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void DeregisterLink(class System.Uri appLinkUri) cil managed" /> + <MemberType>Method</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.Void</ReturnType> + </ReturnValue> + <Parameters> + <Parameter Name="appLinkUri" Type="System.Uri" /> + </Parameters> + <Docs> + <param name="appLinkUri">To be added.</param> + <summary>To be added.</summary> + <remarks>To be added.</remarks> + </Docs> + </Member> + <Member MemberName="DeregisterLink"> + <MemberSignature Language="C#" Value="public void DeregisterLink (Xamarin.Forms.IAppLinkEntry appLink);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void DeregisterLink(class Xamarin.Forms.IAppLinkEntry appLink) cil managed" /> + <MemberType>Method</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.Void</ReturnType> + </ReturnValue> + <Parameters> + <Parameter Name="appLink" Type="Xamarin.Forms.IAppLinkEntry" /> + </Parameters> + <Docs> + <param name="appLink">To be added.</param> + <summary>To be added.</summary> + <remarks>To be added.</remarks> + </Docs> + </Member> + <Member MemberName="RegisterLink"> + <MemberSignature Language="C#" Value="public void RegisterLink (Xamarin.Forms.IAppLinkEntry appLink);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void RegisterLink(class Xamarin.Forms.IAppLinkEntry appLink) cil managed" /> + <MemberType>Method</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.Void</ReturnType> + </ReturnValue> + <Parameters> + <Parameter Name="appLink" Type="Xamarin.Forms.IAppLinkEntry" /> + </Parameters> + <Docs> + <param name="appLink">To be added.</param> + <summary>To be added.</summary> + <remarks>To be added.</remarks> + </Docs> + </Member> + </Members> +</Type> diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms/IApplicationController.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms/IApplicationController.xml index ca78927c..47ba7923 100644 --- a/docs/Xamarin.Forms.Core/Xamarin.Forms/IApplicationController.xml +++ b/docs/Xamarin.Forms.Core/Xamarin.Forms/IApplicationController.xml @@ -11,5 +11,24 @@ <remarks>To be added.</remarks> </Docs> <Members> + <Member MemberName="SetAppIndexingProvider"> + <MemberSignature Language="C#" Value="public void SetAppIndexingProvider (Xamarin.Forms.IAppIndexingProvider appIndexing);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void SetAppIndexingProvider(class Xamarin.Forms.IAppIndexingProvider appIndexing) cil managed" /> + <MemberType>Method</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.Void</ReturnType> + </ReturnValue> + <Parameters> + <Parameter Name="appIndexing" Type="Xamarin.Forms.IAppIndexingProvider" /> + </Parameters> + <Docs> + <param name="appIndexing">To be added.</param> + <summary>To be added.</summary> + <remarks>To be added.</remarks> + </Docs> + </Member> </Members> </Type> diff --git a/docs/Xamarin.Forms.Core/index.xml b/docs/Xamarin.Forms.Core/index.xml index 6c678c8c..70d5da75 100644 --- a/docs/Xamarin.Forms.Core/index.xml +++ b/docs/Xamarin.Forms.Core/index.xml @@ -139,6 +139,7 @@ <Type Name="Animation" Kind="Class" /> <Type Name="AnimationExtensions" Kind="Class" /> <Type Name="Application" Kind="Class" /> + <Type Name="AppLinkEntry" Kind="Class" /> <Type Name="Aspect" Kind="Enumeration" /> <Type Name="BackButtonPressedEventArgs" Kind="Class" /> <Type Name="BaseMenuItem" Kind="Class" /> @@ -230,7 +231,10 @@ <Type Name="HtmlWebViewSource" Kind="Class" /> <Type Name="IAnimatable" Kind="Interface" /> <Type Name="ICarouselViewController" Kind="Interface" /> + <Type Name="IAppIndexingProvider" Kind="Interface" /> <Type Name="IApplicationController" Kind="Interface" /> + <Type Name="IAppLinkEntry" Kind="Interface" /> + <Type Name="IAppLinks" Kind="Interface" /> <Type Name="IDefinition" Kind="Interface" /> <Type Name="IEffectControlProvider" Kind="Interface" /> <Type Name="IElementController" Kind="Interface" /> diff --git a/update-docs-windows.bat b/update-docs-windows.bat index c7838795..40d1fa60 100644 --- a/update-docs-windows.bat +++ b/update-docs-windows.bat @@ -25,5 +25,13 @@ del tmpFile IF NOT "%RESULT%" == "Members Added: 0, Members Deleted: 0" (exit 1) +echo "Updating Xamarin.Forms.Pages" +tools\mdoc\mdoc update --delete Xamarin.Forms.Pages\bin\Debug\Xamarin.Forms.Pages.dll -L "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile\Profile259" --out docs\Xamarin.Forms.Pages | findstr /r "^Members.Added:..," > tmpFile +set /p RESULT= < tmpFile +echo "%RESULT%" +del tmpFile + +IF NOT "%RESULT%" == "Members Added: 0, Members Deleted: 0" (exit 1) + exit 0 |