This repository was archived by the owner on Jan 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.fs
More file actions
executable file
·87 lines (72 loc) · 2.37 KB
/
Program.fs
File metadata and controls
executable file
·87 lines (72 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
open System
open System.Diagnostics
open BackPanel
open BackPanel.Document
type Model = {
Switch1 : bool
Switch2 : bool
Text : string
}
type Event =
| SwitchedOne
| SwitchedTwo
| InputChanged of string
let model = {
Switch1 = false
Switch2 = true
Text = ""
}
let update (model: Model) = function
| SwitchedOne -> { model with Switch1 = not model.Switch1 }
| SwitchedTwo -> { model with Switch2 = not model.Switch2 }
| InputChanged str -> { model with Text = str }
let view (model: Model) =
section [!!"BackPanel Example"] [
section [!!"Status"] []
section [!!"Settings"] [
row [
column [
checkbox [!!"Setting 1"] model.Switch1 SwitchedOne
checkbox [!!"Setting 2"] model.Switch2 SwitchedTwo
button Primary [!!"Toggle Setting 2"] SwitchedTwo
]
column [
checkbox [!!"Setting 1"] model.Switch1 SwitchedOne
checkbox [!!"Setting 2"] model.Switch2 SwitchedTwo
]
]
row [
column [
input InputType.Enabled "Enter Text" model.Text InputChanged
para [!!model.Text]
]
]
]
section [!!"Tables"] [
section [!!"With Header"] [
table [[!!"Firstname"]; [!!"Lastname"]; [!!"Email"]] [
[[!!"John"]; [!!"Doe"]; [!!"john@example.com"] ]
[[!!"May"]; [!!"Moe"]; [!!"mary@example.com" ] ]
[[!!"July"]; [!!"Dooley"]; [!!"july@example.com"] ]
]
]
section [!!"Without Header"] [
table [] [
[[!!"John"]; [!!"Doe"]; [!!"john@example.com"] ]
[[!!"May"]; [!!"Moe"]; [!!"mary@example.com" ] ]
[[!!"July"]; [!!"Dooley"]; [!!"july@example.com"] ]
]
]
]
]
[<EntryPoint>]
let main argv =
let configuration = {
BackPanel.defaultConfiguration with
Title = "BackPanel Example"
Page = BackPanel.page model update view
}
use panel = BackPanel.startLocallyAt 8181 configuration
Process.Start("http://localhost:8181") |> ignore
Console.ReadKey true |> ignore
0