-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathmain-view-model.ts
142 lines (122 loc) · 5.57 KB
/
main-view-model.ts
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import {
confirm,
Observable,
ObservableArray,
Utils
} from '@nativescript/core';
export class HelloWorldModel extends Observable {
public data: ObservableArray<DataItem>;
public uberData: ObservableArray<DataItem>;
private _eventLabel: string = 'Click text or checkbox';
private _state: string;
private _eventCount: number;
public status: boolean = false;
constructor() {
super();
this._state = '';
this._eventCount = 0;
this.data = new ObservableArray<DataItem>();
this.data.push(new DataItem('Brad Martin', false, '#eab557'));
this.data.push(new DataItem('Nathan Walker', true, '#57bbed'));
this.data.push(new DataItem('Steve McNiven-Scott', false, '#7559e7'));
this.data.push(new DataItem('Ron Burgundy', true, '#eb5481'));
this.uberData = new ObservableArray<DataItem>();
// Copy\paste ...hacky I know, dont have time to make this elegant atm :)
this.uberData.push(new DataItem('Brad Martin', false, '#eab557'));
this.uberData.push(new DataItem('Nathan Walker', true, '#57bbed'));
this.uberData.push(new DataItem('Steve McNiven-Scott', false, '#7559e7'));
this.uberData.push(new DataItem('Ron Burgundy', true, '#eb5481'));
this.uberData.push(new DataItem('Brad Martin', false, '#eab557'));
this.uberData.push(new DataItem('Nathan Walker', true, '#57bbed'));
this.uberData.push(new DataItem('Steve McNiven-Scott', false, '#7559e7'));
this.uberData.push(new DataItem('Ron Burgundy', true, '#eb5481'));
this.uberData.push(new DataItem('Brad Martin', false, '#eab557'));
this.uberData.push(new DataItem('Nathan Walker', true, '#57bbed'));
this.uberData.push(new DataItem('Steve McNiven-Scott', false, '#7559e7'));
this.uberData.push(new DataItem('Ron Burgundy', true, '#eb5481'));
this.uberData.push(new DataItem('Brad Martin', false, '#eab557'));
this.uberData.push(new DataItem('Nathan Walker', true, '#57bbed'));
this.uberData.push(new DataItem('Steve McNiven-Scott', false, '#7559e7'));
this.uberData.push(new DataItem('Ron Burgundy', true, '#eb5481'));
this.uberData.push(new DataItem('Brad Martin', false, '#eab557'));
this.uberData.push(new DataItem('Nathan Walker', true, '#57bbed'));
this.uberData.push(new DataItem('Steve McNiven-Scott', false, '#7559e7'));
this.uberData.push(new DataItem('Ron Burgundy', true, '#eb5481'));
this.uberData.push(new DataItem('Brad Martin', false, '#eab557'));
this.uberData.push(new DataItem('Nathan Walker', true, '#57bbed'));
this.uberData.push(new DataItem('Steve McNiven-Scott', false, '#7559e7'));
this.uberData.push(new DataItem('Ron Burgundy', true, '#eb5481'));
this.uberData.push(new DataItem('Brad Martin', false, '#eab557'));
this.uberData.push(new DataItem('Nathan Walker', true, '#57bbed'));
this.uberData.push(new DataItem('Steve McNiven-Scott', false, '#7559e7'));
this.uberData.push(new DataItem('Ron Burgundy', true, '#eb5481'));
this.uberData.push(new DataItem('Brad Martin', false, '#eab557'));
this.uberData.push(new DataItem('Nathan Walker', true, '#57bbed'));
this.uberData.push(new DataItem('Steve McNiven-Scott', false, '#7559e7'));
this.uberData.push(new DataItem('Ron Burgundy', true, '#eb5481'));
this.uberData.push(new DataItem('Brad Martin', false, '#eab557'));
this.uberData.push(new DataItem('Nathan Walker', true, '#57bbed'));
this.uberData.push(new DataItem('Steve McNiven-Scott', false, '#7559e7'));
this.uberData.push(new DataItem('Ron Burgundy', true, '#eb5481'));
this.uberData.push(new DataItem('Brad Martin', false, '#eab557'));
this.uberData.push(new DataItem('Nathan Walker', true, '#57bbed'));
this.uberData.push(new DataItem('Steve McNiven-Scott', false, '#7559e7'));
this.uberData.push(new DataItem('Ron Burgundy', true, '#eb5481'));
this.uberData.push(new DataItem('Brad Martin', false, '#eab557'));
this.uberData.push(new DataItem('Nathan Walker', true, '#57bbed'));
this.uberData.push(new DataItem('Steve McNiven-Scott', false, '#7559e7'));
this.uberData.push(new DataItem('Ron Burgundy', true, '#eb5481'));
this.uberData.push(new DataItem('Brad Martin', false, '#eab557'));
this.uberData.push(new DataItem('Nathan Walker', true, '#57bbed'));
this.uberData.push(new DataItem('Steve McNiven-Scott', false, '#7559e7'));
this.uberData.push(new DataItem('Ron Burgundy', true, '#eb5481'));
}
get eventLabel(): string {
return this._eventLabel;
}
set eventLabel(value: string) {
if (this._eventLabel !== value) {
this._eventLabel = value;
this.notifyPropertyChange('eventLabel', value);
}
}
get state(): string {
return this._state;
}
set state(value: string) {
this._state = value;
this.notifyPropertyChange('state', value);
}
public updateMessage(state) {
this._eventCount++;
this.eventLabel =
'Triggered ' + this._eventCount + ' times, current state:' + state;
}
public changed() {
console.log('changed');
}
public nStudioIconTap() {
confirm({
message:
'nStudio, LLC. specializes in custom software applications ranging from mobile, web, desktop, server and more. Would you like to visit nstudio.io?',
okButtonText: 'Yes',
cancelButtonText: 'Close'
}).then(result => {
if (result) {
Utils.openUrl('https://nstudio.io');
}
});
}
}
export class DataItem {
constructor(text: string, checked: boolean, color?: string) {
this.text = text;
this.checked = checked;
if (color) {
this.color = color;
}
}
public text: string;
public checked: boolean;
public color: string;
}