Skip to content

Commit

Permalink
fixed demo
Browse files Browse the repository at this point in the history
  • Loading branch information
dlucidone committed Apr 19, 2017
1 parent bb40af3 commit ad34c99
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 1 deletion.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
demo/app/*.js
!demo/karma.conf.js
!demo/app/tests/*.js
demo/*.d.ts
!demo/references.d.ts
demo/lib
demo/platforms
demo/node_modules
demo/hooks
node_modules
2 changes: 2 additions & 0 deletions demo/app/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import * as application from 'application';
application.start({ moduleName: "main-page" });
16 changes: 16 additions & 0 deletions demo/app/main-page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import * as observable from 'data/observable';
import * as pages from 'ui/page';
import {HelloWorldModel} from './main-view-model';
import { EventData } from 'data/observable';
import { Page } from 'ui/page';
import { isAndroid, device } from "platform";
import { Color } from "color";
import { android } from "application";
// Event handler for Page 'loaded' event attached in main-page.xml
export function pageLoaded(args: observable.EventData) {
// Get the event sender
let page = <pages.Page>args.object;
page.bindingContext = new HelloWorldModel(page);

}

21 changes: 21 additions & 0 deletions demo/app/main-view-model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import {Observable} from 'data/observable';
import {AndroidIosSwitch} from 'nativescript-android-iosswitch';
import { Page } from 'ui/page';
export class HelloWorldModel extends Observable {

public message: string;
private npb: AndroidIosSwitch;
constructor(mainPage: Page) {
super();
// this.npb = new NumberProgressBar();
this.npb = <AndroidIosSwitch>mainPage.getViewById('sb');

}
public onTrue() {
this.npb.toggleSwitch(true);
}
public onFalse() {
this.npb.setChecked(false);
}
}

0 comments on commit ad34c99

Please sign in to comment.