0

I am new to blackberry 10 cascades development. I want to develop a login screen where user name and password will be asked.

If correct credentials are entered it will be redirected to another screen.

On searching i found NavigationPane to be used. Please tell me how to use Navigation Pane for this purpose. Also share some code if possible.

THanks & Regards,

4

1 回答 1

0

这就像我可以为你做的一样简单。您尚未指定将保存用户名和密码的位置(如果您真的只需要保存哈希,我建议您永远不要在设备上保存实际密码!)。这里缺少一个执行检查的 c++ 方法 (app.checkLogin())。如果需要,您也可以在 QML 中执行此操作。

import bb.cascades 1.0

NavigationPane {
    id: navigationPane
    Page {
        Container {
            Label {
                text: "Please log in"
            }
            TextField {
                id: email
                hintText: "Email address"
            }
            TextField {
                id: password
                hintText: "Password"
                inputMode: TextFieldInputMode.Password
            }
            Button {
                text: "Log in"
                onClicked: {
                    if (email.text == "" || password.text == "") {
                        //display error
                        return;
                    }

                    if (app.checkLogin(email.text, password.text)) {
                        //success
                        navigationPane.push(second.createObject());
                    } else {
                        //display error
                    }
                }
            }
        }
    }
    attachedObjects: [
        ComponentDefinition {
            id: second
            source: "second.qml"
        }
    ]
}
于 2013-11-09T19:22:40.883 回答