今天,在学习silverLight ,突然发现,这个demo可以安装到计算机,于是就在整个demo中找代码,最后,什么都没发现,很纠结...实在没办法了,只有最后的手段google呀,于是发现:
右击"项目"->选择"属性(ALT+ENTER)"->选择"silverLight"选项卡->勾选"允许在浏览器外运行应用程序".
"Project" -> "Properties"->"silverLight"->"Enable running application out of the browser"
保存,会在项目的Properties文件夹下,生成一个"OutOfBrowserSettings.xml" 文件里面为我们刚刚配置的内容.
编译项目,ok,就有安装到计算机了,当然到这里只是设置让silverLight程序可以在脱离浏览器运行,那么,如果判断是否脱离浏览器了呢?
这是使用 App.Current.IsRunningOutOfBrowser && App.Current.HasElevatedPermissions 来判断silverLight程序运行的环境
IsRunningOutOfBrowser: 如果应用程序从浏览器外状态启动,则为 true;如果应用程序从其宿主网页启动,则为 false。
Gets a value that indicates whether the application was launched from the out-of-browser state.
Return:
true if the application was launched from the out-of-browser state;
false if the application was launched from within its host Web page.
HasElevatedPermissions: 如果应用程序正使用提升的权限在浏览器外部运行,则为 true;否则为 false。
Gets a value that indicates whether the application is running outside the browser with elevated permissions.
Returns:
true if the application is running outside the browser with elevated permissions;
otherwise, false.
然后就可以设置或变相相关的代码了