[英]How can I determine in silverlight code where the silverlight instance is running?
I have a silverlight app. 我有一个Silverlight应用程序。
When I develop I have it pick up its data from a local URL : 当我进行开发时,我会从本地URL中获取其数据 :
http://localhost/theapp/data/ ... http:// localhost / theapp / data / ...
however, when it is online , I want it to pick up its data from an online URL : 但是,当它处于联机状态时 ,我希望它从联机URL中获取其数据 :
Currently I have a variable which I switch before I compile and upload: 目前,我有一个在编译和上传之前要切换的变量 :
bool silverlightAppIsLive = true;
which I use to determine whether or not to get data from the first or second URL above. 我用它来确定是否从上面的第一个或第二个URL中获取数据。
Is there a way for me to determine this automatically in code without setting the variable manually? 有没有一种方法可以自动确定代码中的代码而无需手动设置变量?
Can you not use this which will give you the location the silverlight control was loaded from and thus determine if you need to load from the internet or localhost? 您是否可以使用此方法为您提供Silverlight控件的加载位置,从而确定是否需要从Internet或本地主机加载? This assumes obviously you are hosting the control in different places for development and for live deployment. 显然,这假定您将控件托管在不同的位置以进行开发和实时部署。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.