?? download.xml
字號:
<?xml version="1.0"?><!-- This is an application that shows 4 custom components (2 inside a tab pane). The app is used to make sure that the user is logged in before trying to download a file (which requires that the user is logged in)--><Application> <Window caption="Download the Bindows™ Framework" width="350" height="455" centered="true"/> <Resources> <Script src="stringbundles.js"/> <Script src="CookieManager.js"/> <Script src="RegistrationService.js"/> <Script src="CheckingLoginStateComponent.js"/> <Script src="LoginComponent.js"/> <Script src="RegisterComponent.js"/> <Script src="LogoutComponent.js"/> <Script><![CDATA[function Download() { this.webService = new RegistrationService(); this.stringBundle = new BiStringBundle; this.stringBundle.addBundle("ch", chBundle); this.stringBundle.addBundle("en", enBundle); this.stringBundle.addBundle("es", esBundle); this.stringBundle.addBundle("fr", frBundle); this.stringBundle.addBundle("pt", ptBundle); this.stringBundle.addBundle("sv", svBundle); var languageNames = []; var bundles = this.stringBundle.getBundles(); this.languageLabel = new BiLabel; this.languageCombo = new BiComboBox; var tmp; for (var i = 0; i < bundles.length; i++) { tmp = new BiComboBoxItem(bundles[i].languageName); tmp.languageCode = bundles[i].languageCode; if (this.stringBundle.getLanguage() == bundles[i].languageCode || this.stringBundle.getMajorLanguage() == bundles[i].languageCode) { tmp.setSelected(true); } this.languageCombo.add(tmp); } // select correct item //var s = this.stringBundle.getString( this.stringBundle.getLanguage() ); //var si = this.languageCombo.findString( s); //if (si) si.setSelected(true); this.checkingLoginStateComponent = new CheckingLoginStateComponent(this.stringBundle, this.webService); this.loginComponent = new LoginComponent(this.stringBundle, this.webService); this.registerComponent = new RegisterComponent(this.stringBundle, this.webService); this.logoutComponent = new LogoutComponent(this.stringBundle, this.webService); this.tabPane = new BiTabPane; this.loginPage = new BiTabPage; this.registerPage = new BiTabPage; var w = application.getWindow(); w.add(this.languageLabel); w.add(this.languageCombo); this.tabPane.add(this.loginPage); this.tabPane.add(this.registerPage); this.updateStrings(); this.languageLabel.setLocation(5, 10); this.languageCombo.setTop(8); this.languageCombo.setRight(5); this.tabPane.setLocation(5, 40); this.tabPane.setRight(5); this.tabPane.setBottom(5); this.loginComponent.setLocation(5, 5); this.loginComponent.setRight(5); this.loginComponent.setBottom(5); this.registerComponent.setLocation(5,5); this.registerComponent.setRight(5); this.registerComponent.setBottom(5); this.logoutComponent.setLocation(5, 40); this.logoutComponent.setRight(5); this.logoutComponent.setBottom(5); w.add( this.tabPane ); //this.loginPage.add(this.loginComponent); this.registerPage.add(this.registerComponent); this.registerComponent.layoutAllChildren(); this.checkingLoginStateComponent.setLocation(10, 10); this.checkingLoginStateComponent.setRight(10); this.checkingLoginStateComponent.setBottom(10); //w.add(this.checkingLoginStateComponent); this.setUiState("checking"); //this.checkingLoginStateComponent.layoutAllChildren(); this.checkingLoginStateComponent.check(); this.stringBundle.addEventListener("change", this.updateStrings, this); this.checkingLoginStateComponent.addEventListener("loggedin", this.onServiceResponse, this); this.checkingLoginStateComponent.addEventListener("notloggedin", this.onServiceResponse, this); this.logoutComponent.addEventListener("logout", this.onServiceResponse, this); this.loginComponent.addEventListener("login", this.onServiceResponse, this); this.registerComponent.addEventListener("register", this.onServiceResponse, this); this.tabPane.addEventListener("change", function () { this.setUiState( this.tabPane.getSelectedIndex() == 0 ? "login" : "register" ); }, this); this.languageCombo.addEventListener("change", function (e) { this.stringBundle.setLanguage( this.languageCombo.getSelectedItem().languageCode ); }, this);}_p = Download.prototype;_p._className = "Download";Download.main = function () { new Download();};Download.BASE_URI = "../../../services/download.aspx";// Download.BASE_URI = "http://www.i-see.net/bindows/services/download.aspx";_p.onServiceResponse = function (e) { switch (e.getType()) { case "loggedin": this.setUiState("logout"); this.download(); break; case "notloggedin": this.setUiState("login"); this.loginComponent.loginIfRemembered(); break; case "logout": this.setUiState("login"); break; case "login": case "register": this.setUiState("logout"); this.download(); break; }};_p.setUiState = function (sState) { var w = application.getWindow(); switch (sState) { case "checking": if (this.checkingLoginStateComponent.getParent() == null) application.getWindow().add(this.checkingLoginStateComponent); w.setAcceptButton(null); w.setCancelButton(null); this.tabPane.setVisible(false); this.checkingLoginStateComponent.setVisible(true); this.logoutComponent.setVisible(false); break; case "login": if (this.loginComponent.getParent() == null) this.loginPage.add(this.loginComponent); w.setAcceptButton(this.loginComponent.loginButton); w.setCancelButton(this.loginComponent.cancelButton); this.tabPane.setSelectedIndex(0); this.tabPane.setVisible(true); this.logoutComponent.setVisible(false); this.checkingLoginStateComponent.setVisible(false); this.loginComponent.layoutAllChildren(); break; case "register": this.tabPane.setSelectedIndex(1); if (this.registerComponent.getParent() == null) this.registerPage.add(this.registerComponent); w.setAcceptButton(this.registerComponent.registerButton); w.setCancelButton(this.registerComponent.cancelButton); this.tabPane.setVisible(true); this.logoutComponent.setVisible(false); this.checkingLoginStateComponent.setVisible(false); this.registerComponent.layoutAllChildren(); break; case "logout": if (this.logoutComponent.getParent() == null) application.getWindow().add(this.logoutComponent); w.setAcceptButton(this.logoutComponent.logoutButton); w.setCancelButton(this.logoutComponent.closeButton); this.tabPane.setVisible(false); this.logoutComponent.setVisible(true); this.logoutComponent.layoutAllChildren(); this.checkingLoginStateComponent.setVisible(false); break; }};_p.updateStrings = function () { this.loginPage.getTabButton().setText( this.stringBundle.getString("loginTab") ); this.registerPage.getTabButton().setText( this.stringBundle.getString("registerTab") ); this.languageLabel.setText( this.stringBundle.getString("selectLanguage") ); application.getWindow().setCaption( this.stringBundle.getString("windowCaption") ); this.tabPane.layoutAllChildren();};_p.download = function (){ this.webService.download(); // the logout page listens to download and downloaderror events}; ]]></Script> </Resources></Application>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -