什么是Silverlight插件? [英] What's a Silverlight plugin?

查看:76
本文介绍了什么是Silverlight插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请说明什么是Silverlight插件.它是单个xap文件,xaml文件,dll还是什么?请详细说明.

Please explain what a Silverlight plugin is. Is it a single xap file, a xaml file, a dll, or what? Please elaborate.

注意:通过"Silverlight插件",我的意思是一个开发人员将为浏览器创建 ,为Silverlight创建 , Silverlight浏览器插件本身.

Note: by "Silverlight plugin", I mean one a developer would make for the browser and for Silverlight, not the Silverlight browser plugin itself.

推荐答案

现在,我们解决了Silverlight插件与Silverlight应用程序的冲突(请参见Robert Harvey的答案),以下是有关组成一个典型的Silverlight应用程序:

Now that we settled what the Silverlight plug-in is vs. a Silverlight application (see Robert Harvey's answer), here is some more info on what makes up a typical Silverlight application:

应用程序本身将是一个XAP文件(实际上是一个zip),其中包含已编译的程序集.程序集就像常规的.NET程序集一样,但是只能在Silverlight下工作(有多种方法可以构建可以在真实的.NET和Silverlight下工作的单个程序集,但是有很多限制,让我们忽略它).XAP包含您编写的程序集以及您引用的所有程序集.插件下载此XAP,将其打开并运行该代码.通常,每个应用程序只有一个XAP文件.(但是您可以根据需要在其他XAP中下载并加载代码-一些Slightlight框架可以这样做,Prism就是其中之一).

The application itself will be a XAP file (really a zip) that contains compiled assemblies. The assemblies are like regular .NET assemblies, but work only under Silverlight (there are ways to build a single assembly that could work under real .NET and Silverlight, but there a ton's a restrictions, let's just ignore that). The XAP contains assemblies you wrote and all those you've referenced. The plug-in downloads this XAP, opens it up, and runs that code. Normally you have one XAP file per application. (but you can download and load code in other XAPs if you want - some Slightlight frameworks do this, Prism for one).

除了程序集DLL,XAP和其他材料"中还有一个清单文件,您可能希望将它们放在编译后的代码之外.例如,我们的XAP中有一些额外的配置文件.我想这个想法是,您可以在托管网站上解压缩XAP,更改设置,然后将其重新压缩.我不确定人们是否在XAP中放置了其他东西(图像?).我们通常依靠http get调用从主机网站和/或通过Web服务调用下载资料".

Besides the assembly DLLs, there is a manifest file in the XAP and other "stuff" you may want to be outside the complied code. For example, we have some extra configuration files inside our XAP. I guess the idea is that you can unzip the XAP on the hosting web site, change a setting, and rezip it. I'm not sure if people put other things in the XAP (images?). We normally rely on http get calls to download "stuff" from the host web site and/or via web service calls.

您询问了XAML:Silverlight通过视觉元素树(如网页)来呈现UI.通常,您可以通过将XAML标记文件包含/编译到程序集中来定义它(它们在XAP中并不松散).XAML主要是表示形式(如html),但具有一些基本的可编程性"(动画是我能想到的唯一好例子).通常,您将编写程序代码(C#)以使应用程序活跃起来".代码和标记之间的交互是使事情变得有趣的地方(UserControl,Pages,自定义控件,绑定,转换器,行为,触发器).

You asked about XAML: Silverlight renders UI via tree of visual elements (like a web page). Normally you define this by including/compiling XAML markup files into your assemblies (they aren't loose inside the XAP). The XAML is mostly presentation (like html) but has some basic "programmability" (animations is the only good example I can think of). You will normally be writing procedural code (C#) to make the application "come alive". The interaction between the code and markup is where things get interesting (UserControls, Pages, custom Controls, binding, converters, behaviors, triggers).

Visual Studio将生成一个ASP.NET网站来托管您的silverlight应用程序.除了它为您提供了用于设置插件,将其指向您的应用程序的示例代码以及如何为没有该插件的浏览器安装插件的示例代码外,没有什么特别的地方.

Visual Studio will generate an ASP.NET web site to host your silverlight application. There isn't anything special about it other than it provides sample code on you to setup the plug-in, point it to your app, and how to handle installing the plug-in for browsers without it.

这篇关于什么是Silverlight插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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