コード例 #1
0
        public void _onRouteMatched([email protected] <sap.ui.core.routing.Route.MatchedInfo> oEvent, object oData)
        {
            var oArgs      = oEvent.getParameterFor(p => p.arguments);
            var oView      = this.getView();
            var employeeId = oArgs["employeeId"];

            oView.bindElement(new sap.ui.core.Element.BindElementInfo()
            {
                path   = $"/Employees({employeeId})",
                events = new
                {
                    change        = (sap.ui.model.Binding.ChangeDelegate)(this._onBindingChange),
                    dataRequested = ([email protected])((oEvt, unused) => {
                        oView.setBusy(true);
                    }),
                    dataReceived = ([email protected])((oEvt, unused) => {
                        oView.setBusy(false);
                    }),
                }
            });

            var oQuery = oArgs["?query"];

            if (!Glue.IsNullOrUndefined(oQuery) && _aValidTabKeys.Contains(oQuery["tab"]))
            {
                oView.getModelFor <ViewModel>("view").setPropertyFor(m => m.selectedTabKey, oQuery["tab"]);

                // support lazy loading for the hobbies and notes tab
                if (oQuery["tab"].As <string>() == "Hobbies" || oQuery["tab"].As <string>() == "Notes")
                {
                    // the target is either "resumeTabHobbies" or "resumeTabNotes"
                    this.getRouter().getTargets().display("resumeTab" + oQuery["tab"]);
                }
            }
            else
            {
                // the default query param should be visible at all time
                this.getRouter().navTo("employeeResume", new {
                    employeeId = oArgs["employeeId"],
                    query      = new {
                        tab = _aValidTabKeys[0]
                    }
                }, true /*no history*/);
            }
        }