-
Notifications
You must be signed in to change notification settings - Fork 1
/
contacts_add.js
43 lines (40 loc) · 1.14 KB
/
contacts_add.js
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
// Add Contact page
//
exports.View =
{
title: "New Contact",
elements:
[
{ control: "stackpanel", orientation: "Vertical", contents: [
{ control: "text", value: "First Name:", width: 200, fontsize: 10 },
{ control: "edit", binding: "addFirst", width: 240 },
{ control: "text", value: "Last Name:", width: 200, fontsize: 10 },
{ control: "edit", binding: "addLast", width: 240 },
] },
{ control: "stackpanel", orientation: "Horizontal", contents: [
{ control: "button", caption: "Ok", binding: "add", enabled: "{addLast}" },
{ control: "button", caption: "Cancel", binding: "cancel" },
] },
]
}
exports.InitializeViewModel = function(context, session)
{
var viewModel =
{
addFirst: "",
addLast: "",
}
return viewModel;
}
exports.Commands =
{
add: function(context, session, viewModel)
{
session.addedContact = { first: viewModel.addFirst, last: viewModel.addLast };
Synchro.pop(context);
},
cancel: function(context, session, viewModel)
{
Synchro.pop(context);
},
}