| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 44dba1a commit 540b2b4
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,46 +1,61 @@ | |||
| 1 | 1 | import { Page } from "tns-core-modules/ui/page"; | |
| 2 | 2 | import { Label } from "tns-core-modules/ui/label"; | |
| 3 | 3 | ||
| 4 | + function createCloseCallback(label: Label, context?: string): (username: string, password: string) => void { | ||
| 5 | + return function (username: string, password: string) { | ||
| 6 | + let result = username + "/" + password; | ||
| 7 | + result = context ? context + "/" + result : result; | ||
| 8 | + console.log(result); | ||
| 9 | + label.text = result; | ||
| 10 | + } | ||
| 11 | + } | ||
| 12 | + | ||
| 13 | + function openModal(page: Page, label: Label, context: string) { | ||
| 14 | + page.showModal("ui-tests-app/modal-view/login-page", { | ||
| 15 | + context, | ||
| 16 | + closeCallback: createCloseCallback(label, context), | ||
| 17 | + fullscreen: false, | ||
| 18 | + }); | ||
| 19 | + } | ||
| 20 | + | ||
| 4 | 21 | export function onTap(args) { | |
| 5 | 22 | const page = <Page>args.object.page; | |
| 6 | 23 | const label = page.getViewById<Label>("label"); | |
| 7 | 24 | var fullscreen = (<any>args.object).text.indexOf("(full-screen)") !== -1; | |
| 8 | - page.showModal("ui-tests-app/modal-view/login-page", "context", function (username: string, password: string) { | ||
| 9 | - console.log(username + "/" + password); | ||
| 10 | - label.text = username + "/" + password; | ||
| 11 | - }, fullscreen); | ||
| 25 | + | ||
| 26 | + page.showModal("ui-tests-app/modal-view/login-page", { | ||
| 27 | + context: "context", | ||
| 28 | + closeCallback: createCloseCallback(label), | ||
| 29 | + fullscreen | ||
| 30 | + }); | ||
| 12 | 31 | } | |
| 13 | 32 | ||
| 14 | 33 | export function onTapStretched(args) { | |
| 15 | 34 | const page = <Page>args.object.page; | |
| 16 | 35 | const label = page.getViewById<Label>("label"); | |
| 17 | - var fullscreen = false; | ||
| 18 | - var stretched = true; | ||
| 19 | - | ||
| 20 | - page.showModal("ui-tests-app/modal-view/login-page", "context", function (username: string, password: string) { | ||
| 21 | - console.log(username + "/" + password); | ||
| 22 | - label.text = username + "/" + password; | ||
| 23 | - }, fullscreen, false, stretched); | ||
| 24 | - } | ||
| 25 | 36 | ||
| 26 | - function openModal(page: Page, label: Label, context: string) { | ||
| 27 | - page.showModal("ui-tests-app/modal-view/login-page", context, function (username: string, password: string) { | ||
| 28 | - const result = context + "/" + username + "/" + password; | ||
| 29 | - console.log(result); | ||
| 30 | - label.text = result; | ||
| 31 | - }, false); | ||
| 37 | + page.showModal("ui-tests-app/modal-view/login-page", { | ||
| 38 | + context: "context", | ||
| 39 | + closeCallback: createCloseCallback(label), | ||
| 40 | + fullscreen: false, | ||
| 41 | + animated: false, | ||
| 42 | + stretched: true | ||
| 43 | + }); | ||
| 32 | 44 | } | |
| 33 | 45 | ||
| 34 | 46 | export function onTapSecondModalInCB(args) { | |
| 35 | 47 | const page = <Page>args.object.page; | |
| 36 | 48 | const label = page.getViewById<Label>("label"); | |
| 37 | - page.showModal("ui-tests-app/modal-view/login-page", "First", function (username: string, password: string) { | ||
| 38 | - const result = "First/" + username + "/" + password; | ||
| 39 | - console.log(result); | ||
| 40 | - label.text = result; | ||
| 49 | + page.showModal("ui-tests-app/modal-view/login-page", { | ||
| 50 | + context: "First", | ||
| 51 | + closeCallback: (username: string, password: string) => { | ||
| 52 | + const result = "First/" + username + "/" + password; | ||
| 53 | + console.log(result); | ||
| 54 | + label.text = result; | ||
| 41 | 55 | ||
| 42 | - // Open second modal in the close callback of the first one. | ||
| 43 | - openModal(page, label, "Second"); | ||
| 56 | + // Open second modal in the close callback of the first one. | ||
| 57 | + openModal(page, label, "Second"); | ||
| 58 | + } | ||
| 44 | 59 | }); | |
| 45 | 60 | } | |
| 46 | 61 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments