Created
May 28, 2014 23:13
-
-
Save pillowsoft/f6a5cbb6e27da4c1b266 to your computer and use it in GitHub Desktop.
Simple test of the new Xamarin.Forms using F#...works great!
This file contains hidden or 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
namespace TestAndroid | |
open System | |
open System.ComponentModel | |
open Android.App | |
open Android.Content | |
open Android.OS | |
open Android.Runtime | |
open Android.Views | |
open Android.Widget | |
open Xamarin.Forms | |
open Xamarin.Forms.Platform.Android | |
type ButtonCodePage() as this = | |
inherit ContentPage() | |
let mutable count = 0 | |
let button = new Button(Text = String.Format("Tap for click count!")) | |
do | |
button.Clicked.Add(fun _ -> | |
count <- count + 1 | |
button.Text <- String.Format("{0} click{1}!", count, if count = 1 then "" else "s") | |
) | |
this.Content <- button | |
type App() = | |
static member GetMainPage() = | |
new ButtonCodePage() | |
[<Activity (Label = "TestAndroid", MainLauncher = true)>] | |
type MainActivity () = | |
inherit AndroidActivity () | |
let mutable count:int = 1 | |
override this.OnCreate (bundle) = | |
base.OnCreate (bundle) | |
Xamarin.Forms.Forms.Init(this, bundle); | |
Xamarin.FormsMaps.Init(this, bundle); | |
this.SetPage(App.GetMainPage()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment