将参数传递给lightswitch [英] Passing parameters to lightswitch

查看:107
本文介绍了将参数传递给lightswitch的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是否可以将html初始化参数传递给LightSwitch应用程序而不仅仅是固定数据而是变量 (例如UserId)?

Can I pass from html initialization parameters not just fixed data but variables (eg a UserId) to a LightSwitch app?

谢谢。

 

推荐答案

不直接支持。 但是,LightSwitch应用程序本质上是一个SilverLight应用程序,因此您可以公开脚本对象以与网页进行通信。 您可以通过这种方式传递数据。

It is not directly supported.  However, a LightSwitch application is essentially a SilverLight application, so you can expose script objects to comunicate with the web page.  You may pass data in this way.

如果您确实需要访问SilverLight应用程序的启动参数,(SilverLight框架支持initParams)。有一种解决方法。 打开解决方案资源管理器中的所有文件,您可以在ClientGenerated
项目中找到AppManifest.xml。 此文件声明在LightSwitch运行时启动时加载了Microsoft.LightSwitch.Runtime.Shell.Implementation.App类。 您可以创建自己继承自此类的应用程序类,并将AppManifest.xml
更改为指向您的类。 通过这种方式,您可以挂接StartUp事件,并在该事件中获取初始化参数。 这些值可以保留并在以后使用。

If you really need to access start parameters of the SilverLight application, (initParams supported in the SilverLight framework). There is a workaround.  Turn on showing all files in the solution explorer, you can find AppManifest.xml in the ClientGenerated project.  This file declares that the Microsoft.LightSwitch.Runtime.Shell.Implementation.App class is loaded, when the LightSwitch runtime starts.  You can create your own application class inheriting from this class, and change the AppManifest.xml to point to your class.  In this way, you can hook up the StartUp event, and get the initialization parameters in that event.  Those values can be preserved and used later.

 


这篇关于将参数传递给lightswitch的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆