Created
March 24, 2009 14:14
-
-
Save ArtemGr/84110 to your computer and use it in GitHub Desktop.
Simple ".NET compact framework" application for Windows Mobile
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
#light | |
open System | |
open System.Drawing | |
open System.Windows.Forms | |
let main = | |
let form = new Form (Text = "Current time", Visible = true) | |
let addButton text x y fnc = | |
let but = new Button (Text = text) in but.Location <- new Point (x, y); but.Click.Add (fnc); form.Controls.Add (but); but | |
let ofs = 2 | |
let but1 = addButton "Exit" ofs ofs (fun ev -> form.Close()) | |
let time = new TextBox () | |
time.Location <- new Point (ofs, but1.Location.Y + but1.Height + ofs) | |
time.ReadOnly <- true | |
form.Controls.Add (time) | |
let rand = new TextBox () | |
rand.Location <- new Point (ofs, time.Location.Y + time.Height + ofs) | |
rand.ReadOnly <- true | |
rand.Width <- 20 | |
form.Controls.Add (rand) | |
let but2 = addButton "Get time" (but1.Location.X + but1.Width + ofs) ofs (fun ev -> | |
time.Text <- DateTime.Now.ToString("hh:mm:ss.f") | |
let prev = if rand.Text.Length.Equals(0) then 0 else int32 rand.Text | |
rand.Text <- ((new Random (int32 DateTime.Now.Ticks ||| prev)) .Next (10)) .ToString() | |
) | |
form | |
do Application.Run (main) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment