This repository has been archived by the owner on Nov 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 562
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/jamessdixon/xamarin-forms…
…-book-samples into jamessdixon-master
- Loading branch information
Showing
38 changed files
with
978 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Autosave files | ||
*~ | ||
|
||
# build | ||
[Oo]bj/ | ||
[Bb]in/ | ||
packages/ | ||
TestResults/ | ||
|
||
# globs | ||
Makefile.in | ||
*.DS_Store | ||
*.sln.cache | ||
*.suo | ||
*.cache | ||
*.pidb | ||
*.userprefs | ||
*.usertasks | ||
config.log | ||
config.make | ||
config.status | ||
aclocal.m4 | ||
install-sh | ||
autom4te.cache/ | ||
*.user | ||
*.tar.gz | ||
tarballs/ | ||
test-results/ | ||
Thumbs.db | ||
.vs/ | ||
|
||
# Mac bundle stuff | ||
*.dmg | ||
*.app | ||
|
||
# resharper | ||
*_Resharper.* | ||
*.Resharper | ||
|
||
# dotCover | ||
*.dotCover |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 2012 | ||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "DisplayPlatformInfo", "DisplayPlatformInfo\DisplayPlatformInfo.shproj", "{F9A4A10A-9582-4579-9B0F-451F8D57C850}" | ||
EndProject | ||
Project("{f2a71f9b-5d33-465a-a702-920d77279786}") = "DisplayPlatformInfo.iOS", "iOS\DisplayPlatformInfo.iOS.fsproj", "{B79B9A0C-926D-4848-B3B1-62A54E0931DA}" | ||
EndProject | ||
Project("{f2a71f9b-5d33-465a-a702-920d77279786}") = "DisplayPlatformInfo.Droid", "Droid\DisplayPlatformInfo.Droid.fsproj", "{C0486668-642D-467E-9879-84C32B1D2933}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|iPhoneSimulator = Debug|iPhoneSimulator | ||
Release|iPhone = Release|iPhone | ||
Release|iPhoneSimulator = Release|iPhoneSimulator | ||
Debug|iPhone = Debug|iPhone | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{B79B9A0C-926D-4848-B3B1-62A54E0931DA}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator | ||
{B79B9A0C-926D-4848-B3B1-62A54E0931DA}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator | ||
{B79B9A0C-926D-4848-B3B1-62A54E0931DA}.Release|iPhone.ActiveCfg = Release|iPhone | ||
{B79B9A0C-926D-4848-B3B1-62A54E0931DA}.Release|iPhone.Build.0 = Release|iPhone | ||
{B79B9A0C-926D-4848-B3B1-62A54E0931DA}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator | ||
{B79B9A0C-926D-4848-B3B1-62A54E0931DA}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator | ||
{B79B9A0C-926D-4848-B3B1-62A54E0931DA}.Debug|iPhone.ActiveCfg = Debug|iPhone | ||
{B79B9A0C-926D-4848-B3B1-62A54E0931DA}.Debug|iPhone.Build.0 = Debug|iPhone | ||
{B79B9A0C-926D-4848-B3B1-62A54E0931DA}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator | ||
{B79B9A0C-926D-4848-B3B1-62A54E0931DA}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator | ||
{B79B9A0C-926D-4848-B3B1-62A54E0931DA}.Release|Any CPU.ActiveCfg = Release|iPhone | ||
{B79B9A0C-926D-4848-B3B1-62A54E0931DA}.Release|Any CPU.Build.0 = Release|iPhone | ||
{C0486668-642D-467E-9879-84C32B1D2933}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU | ||
{C0486668-642D-467E-9879-84C32B1D2933}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU | ||
{C0486668-642D-467E-9879-84C32B1D2933}.Release|iPhone.ActiveCfg = Release|Any CPU | ||
{C0486668-642D-467E-9879-84C32B1D2933}.Release|iPhone.Build.0 = Release|Any CPU | ||
{C0486668-642D-467E-9879-84C32B1D2933}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU | ||
{C0486668-642D-467E-9879-84C32B1D2933}.Release|iPhoneSimulator.Build.0 = Release|Any CPU | ||
{C0486668-642D-467E-9879-84C32B1D2933}.Debug|iPhone.ActiveCfg = Debug|Any CPU | ||
{C0486668-642D-467E-9879-84C32B1D2933}.Debug|iPhone.Build.0 = Debug|Any CPU | ||
{C0486668-642D-467E-9879-84C32B1D2933}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{C0486668-642D-467E-9879-84C32B1D2933}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{C0486668-642D-467E-9879-84C32B1D2933}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{C0486668-642D-467E-9879-84C32B1D2933}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
EndGlobal |
6 changes: 6 additions & 0 deletions
6
Chapter09/FS/DisplayPlatformInfo/DisplayPlatformInfo/App.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Application xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="DisplayPlatformInfo.App"> | ||
<Application.Resources> | ||
<!-- Application resource dictionary --> | ||
</Application.Resources> | ||
</Application> |
6 changes: 6 additions & 0 deletions
6
Chapter09/FS/DisplayPlatformInfo/DisplayPlatformInfo/App.xaml.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace DisplayPlatformInfo | ||
|
||
open Xamarin.Forms | ||
|
||
type App() = | ||
inherit Application(MainPage = MainPage()) |
24 changes: 24 additions & 0 deletions
24
Chapter09/FS/DisplayPlatformInfo/DisplayPlatformInfo/DisplayPlatformInfo.projitems
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects> | ||
<HasSharedItems>true</HasSharedItems> | ||
<SharedGUID>{F9A4A10A-9582-4579-9B0F-451F8D57C850}</SharedGUID> | ||
</PropertyGroup> | ||
<PropertyGroup Label="Configuration"> | ||
<Import_RootNamespace>DisplayPlatformInfo</Import_RootNamespace> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)MainPage.xaml" /> | ||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)App.xaml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildThisFileDirectory)IPlatformInfo.fs" /> | ||
<Compile Include="$(MSBuildThisFileDirectory)MainPage.xaml.fs"> | ||
<DependentUpon>MainPage.xaml</DependentUpon> | ||
</Compile> | ||
<Compile Include="$(MSBuildThisFileDirectory)App.xaml.fs"> | ||
<DependentUpon>App.xaml</DependentUpon> | ||
</Compile> | ||
</ItemGroup> | ||
</Project> |
11 changes: 11 additions & 0 deletions
11
Chapter09/FS/DisplayPlatformInfo/DisplayPlatformInfo/DisplayPlatformInfo.shproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<ProjectGuid>{F9A4A10A-9582-4579-9B0F-451F8D57C850}</ProjectGuid> | ||
</PropertyGroup> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" /> | ||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" /> | ||
<Import Project="DisplayPlatformInfo.projitems" Label="Shared" /> | ||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.FSharp.targets" /> | ||
</Project> |
5 changes: 5 additions & 0 deletions
5
Chapter09/FS/DisplayPlatformInfo/DisplayPlatformInfo/IPlatformInfo.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
namespace DisplayPlatformInfo | ||
|
||
type public IPlatformInfo = | ||
abstract member GetModel : unit -> string | ||
abstract member GetVersion : unit -> string |
24 changes: 24 additions & 0 deletions
24
Chapter09/FS/DisplayPlatformInfo/DisplayPlatformInfo/MainPage.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
x:Class="DisplayPlatformInfo.MainPage"> | ||
<StackLayout Padding="20"> | ||
<StackLayout VerticalOptions="CenterAndExpand"> | ||
<Label Text="Device Model:" /> | ||
<ContentView Padding="50, 0, 0, 0"> | ||
<Label x:Name="modelLabel" | ||
FontSize="Large" | ||
FontAttributes="Bold" /> | ||
</ContentView> | ||
</StackLayout> | ||
|
||
<StackLayout VerticalOptions="CenterAndExpand"> | ||
<Label Text="Operating System Version:" /> | ||
<ContentView Padding="50, 0, 0, 0"> | ||
<Label x:Name="versionLabel" | ||
FontSize="Large" | ||
FontAttributes="Bold" /> | ||
</ContentView> | ||
</StackLayout> | ||
</StackLayout> | ||
</ContentPage> |
25 changes: 25 additions & 0 deletions
25
Chapter09/FS/DisplayPlatformInfo/DisplayPlatformInfo/MainPage.xaml.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
namespace DisplayPlatformInfo | ||
|
||
open Xamarin.Forms | ||
open Xamarin.Forms.Xaml | ||
|
||
type MainPage() = | ||
inherit ContentPage() | ||
let _ = base.LoadFromXaml(typeof<MainPage>) | ||
let platformInfo = DependencyService.Get<IPlatformInfo>() | ||
let baseStack = base.Content :?> StackLayout | ||
let stack0 = baseStack.Children.[0] :?> StackLayout | ||
let stack1 = baseStack.Children.[1] :?> StackLayout | ||
let contentView0 = stack0.Children.[1] :?> ContentView | ||
let contentView1 = stack1.Children.[1] :?> ContentView | ||
let label0 = contentView0.Children.[0] :?> Label | ||
let label1 = contentView1.Children.[0] :?> Label | ||
|
||
do | ||
label0.Text <- platformInfo.GetModel() | ||
label1.Text <- platformInfo.GetVersion(); | ||
|
||
|
||
|
||
|
||
|
19 changes: 19 additions & 0 deletions
19
Chapter09/FS/DisplayPlatformInfo/Droid/Assets/AboutAssets.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 your 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"); |
Oops, something went wrong.