思归呓语

衣带渐宽终不悔,为伊消得人憔悴
随笔 - 413, 评论 - 2972, 引用 - 245

导航

关于

标签

每月存档

最新留言

广告

【第1页/共2页,29条】
首页
前页
1

John Lam的动态Silverlight讲座

Mr.“IronRuby” John Lam在他的博客上登出了三篇贴子,其内容是他在MIX08大会上做的讲座的文字版
Microsoft Silverlight and Dynamic Languages
http://visitmix.com/blogs/2008Sessions/T28/

讲座录像的MP4版: http://msstudios.vo.llnwd.net/o21/mix08/08_MP4s/T28.mp4 (57.6MB)
讲座录像的WMV版: http://msstudios.vo.llnwd.net/o21/mix08/08_WMVs/T28.wmv (84.1MB)

演示代码可以在这里下载:
http://dynamicsilverlight.net/

在第一篇《Dynamic Silverlight Part 1: Hello, World! in Dynamic Silverlight》中,主要介绍随Silverlight 2 Beta 1一起发布的Chiron.exe命令行工具。这个工具有2大主要功能,一是可以帮你把应用的文件,资源,程序集等转换压制成.xap文件,二是提供一个简单的web服务器的功能,让你使用文件系统就能开发Silverlight应用。由于Chiron是动态生成.xap文件的,你对文件做变动后,只要刷新浏览器就可以获得新的.xap文件,不用重启Chiron或浏览器,提供了很好的交互开发体验。

在第二篇《Dynamic Silverlight Part 2: Managed JScript and flickr》中,示范了如何使用托管的JScript (与我们在浏览器中的客户端Javascript不同) 与Flickr API做交互,让用户查询相关主题的照片,并将照片显示在Silverlight中。还演示了在Silverlight中,原封不动地使用Peter Norvig(AI大师)用Python编写的Spelling Corrector(拼写纠错器),提示用户输入的主题可能有错。

在第三篇《Dynamic Silverlight Part 3: Integrating Silverlight with ASP.NET MVC 》中,示范了如何与ASP.NET MVC应用做集成。通过Chiron生成.xap文件,用IronRuby在客户端动态生成WPF元素,使用WebClient与服务器端做交互等。

posted on 2008-03-12 01:09:46 by saucer  评论(2) 阅读(5029)

【翻译】使用动态语言的Silverlight编程

【原文地址】Programming Silverlight with Dynamic Languages

 

 

介绍

这个快速入门例程展示了如何创建使用了托管代码和动态语言的基于微软的Silverlight的应用,以及如何在Visual Studio 2008中调试应用。

Visual Studio 2008之Siverlight工具Beta 1版本包含了动态语言运行时(DLR)和三门动态语言(IronPython, IronRuby, 和托管JScript)的快照。Visual Studio 2008目前还不提供动态语言的项目模板,但你可以使用Chiron.exe 工具来建造,运行和调试你的应用。

DLR和动态语言目前在Codeplex网站,尚处于开发之中。你可以在那里找到有关的详细信息,包括新的版本,源代码,和另外的Silverlight例程。新的版本会经常地发布出来。

 

本文讨论了下述主题:

  • 创建一个基于Silverlight的动态语言应用,并用Chiron.exe运行该应用

  • 创建一个.xap部署文件

  • 访问托管程序集中的类库

  • 使用Chiron.exe和Visual Studio调试基于Silverlight的动态语言应用

软件要求 (可从 Silverlight下载网站获取):

  • Silverlight 2 Beta 1版本

  • Visual Studio 2008

  • Visual Studio 2008之Silverlight 工具Beta 1版本

用动态语言创建基于Silverlight的应用

一个使用动态语言的基于Silverlight的简单应用包括下列组成部分:

  • 根目录的HTML或.aspx文件,作为浏览器的入口点

  • app.xaml文件,定义了你的基于Siliverlight应用的用户界面

  • app.py, app.rb, 或app.jsx 文件,内含在运行时处理事件的动态语言代码。对动态语言来说,这个文件是不被编译成一个程序集的,动态语言的代码是在运行时在客户端计算机上编译和执行的

    动态语言引擎和DLR程序集是包含在由Chiron.exe 生成的.xap 文件中,并下载到客户端计算机的。你不需要在你的项目中包含它们。

使用动态语言创建和运行基于Silverlight的应用

  1. 为你的应用创建一个文件夹.

  2. In the application folder, create two folders named app and assets. Use the assets folder for bitmaps and additional XAML files.在应用的文件夹中,创建2个子文件夹,分别名为app和 assets。用assets存放位图和另外的XAML文件。

    如果你想使用silverlight.js来在应用启动时做更大的控制,assets文件夹是存放silverlight.js的好所在。本例程中的应用不使用silverlight.js。你的应用不必局限于这个简单的文件夹结构。这只是一个可为Chiron.exe所用,不用指定任何特别参数的基本的结构。你的应用程序可以访问任意复杂的文件夹结构,可以包含任意数目的动态语言代码文件。

  3. 在app文件夹中,创建app.xaml。这个文件包含你的应用的根可视元素。一个简单的基于UserControl的app.xaml文件看上去也许会象这样:

    <UserControl
       xmlns="http://schemas.microsoft.com/client/2007"
       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
       x:Class="System.Windows.Controls.UserControl"
       x:Name="Page" 
       >
       
       <TextBlock x:Name="TextBlock1" TextWrapping="Wrap" 
          Foreground="Black" Text="Click Me." />
    </UserControl>

    将根可视元素基于UserControl是推荐的做法,使用本文一开始的“查看源码”按钮看一下另外一个app.xaml的例子。

  4. 在app文件夹中,创建一个动态语言源码文件,内含你的应用代码。下面的代码展示了一个响应鼠标按钮事件的非常简单的应用。

    jsx

    Import("System.Windows.*");
    Import("System.Windows.Controls.*");
    
    xaml = Application.Current.LoadRootVisual(new UserControl(), 'app.xaml')
    
    xaml.TextBlock1.MouseLeftButtonUp += function (sender, args) {
        sender.FontSize *= 2
    }
    
    

    py

    from System.Windows import Application
    from System.Windows.Controls import UserControl
    
    def OnClick (sender, args):
        sender.FontSize *= 2
    
    scene = Application.Current.LoadRootVisual(UserControl(), 'app.xaml')
    scene.TextBlock1.MouseLeftButtonUp += OnClick
    
    

    rb

    include System::Windows
    include System::Windows::Controls
    
    scene = Application.current.load_root_visual UserControl.new, 'app.xaml'
    
    scene.find_name('TextBlock1').mouse_left_button_up do |sender, args|
       sender.font_size = sender.font_size * 2
    end
    
    

    代码调用了LoadRootVisual(DependencyObject, Uri)方法,来设置一个根可视对象,你必须提供一个正确类型的对象,DLR会确保调用了正确的重载方法,并且提供所需的代码上下文。

    使用本文一开始的“查看源码”按钮,得到一个定义了App类的更复杂的例子。

    在随Visual Studio 2008之Silverlight工具Beta 1版本发布的IronRuby版本中,对每个给定的事件(例如MouseLeftButtonUp)只能连接一个事件处理函数。关于语言开发和更新版的详情,请参考Codeplex网站

  5. 在你的应用文件中,创建一个HTML页面来启动你的应用。使用“查询源码”按钮,拷贝为所有三门语言所用的Default.html文件。如果你遵循了本步骤中的命名约定,不做任何改动,你就可以使用这个Default.html文件。

    Default.html 中最重要的一行是指定了app.xap 文件的这一行,该文件包含你的源代码和DLR程序集。

        <object data="data:application/x-silverlight," 
          type="application/x-silverlight-2-b1" 
          width="100%" height="100%">
          <param name="source" value="app.xap"/>

    Default.html还有另外的特性,包括在你调试你的应用时,一个用以显示错误信息的<div>。

  6. 如果你以前没用过Chiron.exe ,将它的路径加到路径环境变量中。

    Chiron.exe位于SDK安装的Tools文件夹之中。如果你使用了默认的安装路径,这个文件夹在\Program Files\Microsoft SDKs\Silverlight\v2.0\Tools。

  7. 要运行你的应用,使用命令行窗口,以/browser (/b)选项运行Chiron.exe。从应用文件中运行Chiron.exe。

    Chiron.exe 将你的应用文件夹中的内容提供给浏览器。

    在默认情形下,Chiron.exe使用“app”作为包含你的入口代码的文件夹,你可以使用/directory (/d)来改变这个默认选项。

    Chiron.exe 会一直在命令行窗口中运行,显示状态消息。

  8. 在浏览器中,点击Default.html来运行应用。

    Chiron.exe 会按需生成.xap文件。你的Silverlight的应用就会打开,点击其中的文字就会增加字体大小。将浏览器开着。

  9. 为表示.xap文件确实是按需生成的,编辑源码文件。改动增加字体大小的那行代码,将它变成减小透明度:

    jsx

    sender.Opacity /= 2
    
    

    py

    sender.Opacity /= 2
    
    

    rb

    sender.opacity = sender.opacity / 2
    
    
  10. 在浏览器中,刷新网页。

    Default.html请求app.xap,Chiron.exe会生成一个新的app.xap文件。应用会重启,点击控件,注意文字的透明度现在会减小。 你可以使用这个技术反复编辑和测试你的应用,而不用重启Chiron.exe。在后面的一个步骤中,你将看到在用Visual Studio调试时,如何进行同类的迭代开发。

  11. 关闭浏览器。

  12. 在命令行窗口中,按CTRL+C中止Chiron.exe。

创建一个.xap部署文件

要部署你的应用,你必须创建一个.xap文件,内含你的动态语言源码,manifest,XAML,以及象位图,语言编辑器,和DLR程序集等资源。Chiron.exe能做此功能。

创建.xap文件

  1. 使用命令行窗口,使用 /directory (/d) 和 /zipdlr (/z)选项运行Chiron.exe。从应用的文件夹中运行Chiron.exe ,就象你在开发和测试应用时做的那样。

    /directory 选项指定了包含应用入口点的目录,而/zipdlr 选项指定了.xap文件的名称。对在上面开发的应用,所用的命令看上去象这样:

    Chiron.exe /directory:app /zipdlr:app.xap
  2. 把Copy Default.html和app.xap拷贝到想要的地点去。

Chiron.exe有个命令行帮助,列出了所有的选项,或者你也可以在Chiron.exe同个文件夹中的Readme.txt文件中找到列出的这些选项。Readme.txt 文件还包含了如何配置Chiron.exe 来使用其他动态语言的信息。

访问类库

要编写基于Silverlight的应用,你需要访问Silverlight类库,加上任何你想用的其他基于Silverlight的类库。在默认情形下,DLR提供了对下列程序集的引用:

  • mscorlib.dll

  • System.dll

  • System.Windows.dll

  • System.Windows.Browser.dll

  • System.Net.dll

 

对这些程序集,你可以略过添加程序集引用的步骤。你还可以访问DLR程序集,Microsoft.Scripting.dll 和 Microsoft.Scripting.Silverlight.dll。你不用导入Microsoft.Scripting.Silverlight 命名空间。

从IronPython中访问基于Silverlight的类库

  1. 使用import语句装载clr模块

    import clr
  2. 使用clr.AddReference函数装载程序集,使它们的内容可作import之用

    clr.AddReference("MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b17a5c561934e089")
  3. 使用import语句,向当前的上下文添加命名空间或装载模板。 你必须在使用命名空间前先将它们导入

    import System.Windows
    import System
    import MyPythonModule
  4. 使用from … import语句将一个命名空间或模板的内容加到当前上下文

    from System.Windows import *
    from System.Windows.Controls import UserControl*

     

从托管JScript中访问基于Silverlight的类库

  1. 使用AddReference函数装载程序集,使它们的内容可作导入之用

    AddReference("MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b17a5c561934e089")
  2. 使用Import函数把命名空间导入到当前上下文,你必须在使用命名空间前先将它们导入

    Import("System.Windows")
    Import("System")
  3. 使用Import函数将一个命名空间的内容导入到当前上下文

    Import("System.Windows.*")
    Import("System.*")

    除了搞乱全局上下文外,加入System中的所有类型还会把托管JScript的Array类型替换成System.Array,你也可以导入特定的类型。

  4. 使用ImportAlias函数以别名将一个命名空间或类型导入到当前上下文中

    SW = ImportAlias("System.Windows")
  5. 使用LoadModule和LoadModuleFromFile函数装载模板,这些方法返回装载的模板,LoadModuleFromFile的第二个参数指定了模板的类型,"js" 或 "py"

    util = LoadModule("MyUtilities")
    util = LoadModuleFromFile("MyUtilities", "py")

     

从IronRuby中访问基于Silverlight的类库

  1. 使用require语句装载程序集,使它们的内容可作包含之用

    require MyAssembly
  2. 使用include 语句将命名空间加到当前上下文

    include System.Windows
    

使用Chiron.exe和Visual Studio调试基于Silverlight的应用

在Visual Studio 2008之Silverlight工具Beta 1版本中,你可以使用Visual Studio 2008来调试用了动态语言的基于Silverlight应用。你的基于 Silverlight的应用必须下载到浏览器里才能运行,调试器必须在代码下载后才能启动。你可以在调试外改动你的代码,重新装载代码而不用重新连接浏览器进程。

调试动态语言应用

  1. 把你要调试的动态语言文件装载进Visual Studio,设置断点

  2. 从应用文件夹中,以/browser (/b)选项运行Chiron.exe,将目录内容提供给浏览器

  3. 在浏览器中,点击Default.html启动应用

    Chiron.exe会按需生成.xap文件,应用的启动代码将运行

  4. 在Visual Studio中,在Debug菜单上,点击Attach to Process(连接到进程)

    因为你的应用是在浏览器中运行的,你必须连接到浏览器进程中才能调试

  5. 在Attach to Process对话框中,在Available Processes列表中,在Process一列,点击选择适当的浏览器实例

    如果你有打开着的其他的浏览器实例,给Default.html一个标题,使之可从Title一列中易于识别

  6. 点击Attach.

  7. 转到浏览器,点击F5刷新Default.html

    你的应用将在调试器中重新装载,你现在就可以开始调试了。你在起始代码中设置的任何断点就会在应用重新装载时触发。

    重要注意事项

    你必须在连接打调试器之后,刷新页面,重载你的应用。如果你没有先刷新页面,就开始与你的应用做交互,你的断点一个也不会被触发的。

  8. 使用第二个 Visual Studio实例或另一个编辑器,对你的代码做改动,然后将其保存。

    你不能在连接到浏览器进程的Visual Studio实例中对代码做改动。【译注:好像是可以的】

  9. 在浏览器中,刷新你的HTML页面

    Chiron.exe会生成一个新的.xap文件,你的应用的起始代码会运行。如果你在起始代码中有断点,它们就会被触发。

  10. Visual Studio会告诉你源码文件被作了改动,询问是否要重新装载。点击Yes,重新装载文件,继续你的Visual Studio调试会话。

     

    如果你在另外的编辑器里保存你的改动时,你的Visual Studio调试会话正处于一个断点在单步调试进代码时,你无法转换到浏览器。而是转到你的Visual Studio调试会话,你会被询问是否要重新装载源码文件。然后你必须刷新浏览器。

    你可以继承在调试和改动代码之间转换,而不用中止浏览器或Chiron.exe。

  11. 调试完毕后,脱离进程。关闭浏览器,使用CTRL+C 中止Chiron.exe。

     

调试特性的状况

包含在Visual Studio 2008之Silverlight工具Beta 1版本中的 DLR和动态语言快照支持大多数的调试特性。例如,你可以使用F10和F11跳过或步入代码。使用 Locals 窗口查看变量数值,以及在Immediate窗口中设置变量数值或执行代码。

在IronPython中,但你使用F10,超过函数的结尾,控制返回到浏览器时,Visual Studio 2008会显示一个对话框告诉你没有可用的源代码。点击OK关闭对话框,然后点击F5继续。

一些语言中的支持会比另外一些语言中的好。调试支持将会随语言的开发继续扩充。欲知最新的信息,请访问Codeplex网站

posted on 2008-03-09 13:42:37 by saucer  评论(4) 阅读(7207)

MIX08的录像

已经可以直接观看或下载了:

http://sessions.visitmix.com/

Luciano Evaristo Guerche先生在博客里列出了一些录像的直接链接:

Mix 2008, 65 presentations so far (WMV direct links)
http://weblogs.asp.net/guerchele/archive/2008/03/07/mix-2008-65-presentations-so-far-wmv-direct-links.aspx

 

跟Silverlight有关的录像,

Keynote I (第一天的主题演讲)
Dean Hachamovitch, Ray Ozzie, Scott Guthrie
http://msstudios.vo.llnwd.net/o21/mix08/08_WMVs/KYN0801.wmv

Building AOL's High Performance, Enterprise Wide Mail Application With Silverlight 2
Eric Hoffman, Marc Katchay, Stefan Gal
http://msstudios.vo.llnwd.net/o21/mix08/08_WMVs/BT01.wmv


Building Rich Internet Applications Using Microsoft Silverlight 2, Part 1
Joe Stegman, Mike Harsh

http://msstudios.vo.llnwd.net/o21/mix08/08_WMVs/CT01.wmv

Building Rich Internet Applications Using Microsoft Silverlight 2, Part 2
Joe Stegman, Mike Harsh

http://msstudios.vo.llnwd.net/o21/mix08/08_WMVs/CT02.wmv

Creating Rich, Dynamic User Interfaces with Silverlight 2
Karen Corby

http://msstudios.vo.llnwd.net/o21/mix08/08_WMVs/T20.wmv

Encoding Video for Microsoft Silverlight
Ben Waggoner
http://msstudios.vo.llnwd.net/o21/mix08/08_WMVs/BCT07.wmv

Exploring Moonlight: Novell's Implementation of Silverlight on Linux
Miguel de Icaza

http://msstudios.vo.llnwd.net/o21/mix08/08_WMVs/T31.wmv

From Flash to Silverlight: A Rosetta Stone
Rick Barazza
http://msstudios.vo.llnwd.net/o21/mix08/08_WMVs/T30.wmv

Integrating Media in Silverlight Applications
Ed Maia
http://msstudios.vo.llnwd.net/o21/mix08/08_WMVs/BCT05.wmv

Internationalizing XAML Applications in Windows Presentation Foundation and Microsoft Silverlight
Ken Azuma, Laurence Moroney, Ted Kitamura

http://msstudios.vo.llnwd.net/o21/mix08/08_WMVs/T15.wmv

Mobile Devices and Microsoft Silverlight: A Primer on the New Technology
Amit Chopra, David Kline
http://msstudios.vo.llnwd.net/o21/mix08/08_WMVs/T12.wmv

Real World Design: Working with Silverlight and WPF in the Design Studio
Beau Ambur, Chip Aubry, Chris Bernard, Nathan Dunlap, Rich Weston
http://msstudios.vo.llnwd.net/o21/mix08/08_WMVs/PNL16.wmv

Silverlight and Advertising
Eric Schmidt
http://msstudios.vo.llnwd.net/o21/mix08/08_WMVs/BT06.wmv

Silverlight as a Gaming Platform
Joel Neubeck, Scott McAndrew

http://msstudios.vo.llnwd.net/o21/mix08/08_WMVs/CT03.wmv

The Business of Microsoft Silverlight
Danny Riddell
http://msstudios.vo.llnwd.net/o21/mix08/08_WMVs/B01.wmv

Using Microsoft Silverlight for Creating Rich Mobile User Experiences
Giorgio Sardo
http://msstudios.vo.llnwd.net/o21/mix08/08_WMVs/C02.wmv

Working with Data and Web Services in Microsoft Silverlight 2
Eugene Osovetsky

http://msstudios.vo.llnwd.net/o21/mix08/08_WMVs/T13.wmv

posted on 2008-03-08 05:15:07 by saucer  评论(1) 阅读(4119)

Jesse Liberty的Silverlight教程

Jesse Liberty,the Silverlight Geek,正在silverlight.net上发表一个《Silverlight教程系列》。目前已经发表了四篇,看上去很不错:

教程0: 路线图

教程1: 控件

教程2: 数据绑定

教程3: 样式和模板

posted on 2008-03-07 06:04:47 by saucer  评论(2) 阅读(5611)

Silverlight 2 Beta 1, IE 8 Beta 1, ASP.NET MVC 预览版2 可以下载了

1. Microsoft Silverlight Tools Beta 1 for Visual Studio 2008
http://www.microsoft.com/downloads/details.aspx?FamilyID=e0bae58e-9c0b-4090-a1db-f134d9f095fd&DisplayLang=en

内含:
  • Silverlight 2 Beta 1
  • Silverlight 2 SDK Beta 1
  • KB949325 for Visual Studio 2008
  • Silverlight Tools Beta 1 for Visual Studio 2008

Silverlight控件示范页:
http://silverlight.net/Samples/2b1/SilverlightControls/run/default.html

这里有一个贴子,列出了可以单独下载的组件的详细链接:
http://silverlight.net/forums/t/10586.aspx

Mr. “IronRuby” John Lam 有一个贴子,展示如何在Silverlight中使用IronRuby(还没有下载链接):
Dynamic Silverlight Part 1: Hello, World!
http://www.iunknown.com/2008/03/dynamic-silverl.html

 

2. Expresssion Blend 2.5三月份预览版:
Microsoft Expression Blend 2.5 March 2008 Preview
http://www.microsoft.com/downloads/details.aspx?FamilyID=32a3e916-e681-4955-bc9f-cfba49273c7c&DisplayLang=en

 

3. 这次MIX08大会主题演讲还宣布了IE8 Beta1的发布,可以在这里下载:
http://www.microsoft.com/windows/products/winfamily/ie/ie8/readiness/Install.htm

其中的2个新功能是ActivitiesWebSlices! 这里有个演示:
First Look at IE8 Activities and WebSlices
http://visitmix.com/blogs/Joshua/IE8-Activities-With-Jane-Kim/

 

4. ASP.NET 3.5 Extensions Preview 2 (包括 ASP.NET MVC Preview 2):
http://www.microsoft.com/downloads/details.aspx?FamilyID=a9c6bc06-b894-4b11-8300-35bd2f8fc908&DisplayLang=en

 

5. ASP.NET MVC Preview 2的单独下载:
http://www.microsoft.com/downloads/details.aspx?FamilyID=38cc4cf1-773a-47e1-8125-ba3369bf54a3&displaylang=en

posted on 2008-03-06 03:41:06 by saucer  评论(6) 阅读(6821)

Video.Show public beta - 一个Silverlight样例

【来源:Tim Sneath】 如果你在学习Silverlight或者想建造一个录像网站,那么Tim Sneath推荐的这个刚刚在CodePlex上发布的项目,Video.Show,是个非常有参考价值的项目。这个项目使用了微软最新的技术和产品,.NET Framework 3.5, ASP.NET AJAX, LINQ, Silverlight, Expression Encoder 和 Silverlight Streaming等。它提供了录像上传,编码,添加tag,观看和评论录像的功能,下面是一些该项目的特性:

1.用以浏览录像的录像墙,把鼠标移到录像图标上面可以预览录像
2.基于时间标记的评论系统,可以把录像暂停在某个有趣的时刻,添加评论,这些评论在回放时就会出现
3.使用ASP.NET的网站成员功能,用来登录,生成自定义的用户信息,添加书签和tag,上传录像等
4.针对没安装Silverlight的用户的初次体验,示范了检测和安装Silverlight的最佳实践
5.使用Web服务实现索取录像目录,以及tag和书签等功能
6.使用Expression Encoder对录像进行编码以及上传到Silverlight Streaming等后台批处理任务

该项目是以源码的形式,在Microsoft Public License许可下发布的,你完全可以使用这些源码推出你自己的录像网站。

posted on 2007-11-13 03:18:00 by saucer  评论(7) 阅读(6843)

下一个Silverlight 1.1 CTP版本将支持IronRuby

微软动态语言组的John Lam在博客《IronRuby on Silverlight at RubyConf》里说,

“。。。。once we (DLR) sync up with the next CTP of Silverlight, you'll be able to run IronRuby in your browser. Fun times.”
(一旦DLR与下一个Silverlight CTP版本代码同步后,你将能在浏览器里运行IronRuby,好玩的时候就开始了。。。)

在评语部分,Jeremy问,
当你说:“在浏览器里运行IronRuby”,这意味着我们可以通过Ruby来对DOM进行操作么?因为依我来看,那才是真正开始好玩的时候。

John Lam的答复是,
对,那肯定是Silverlight通过HTML桥(HTML bridge)支持的一个情形。在RubyConf大会上,有些家伙有些非常有趣的想法,想在Ruby里建造一个独立于浏览器(browser-agnostic)的DOM+WPF编程层 (DOM + WPF programming layer in Ruby)。

posted on 2007-11-06 22:30:00 by saucer  评论(0) 阅读(4112)

Game Programming With Silverlight

Silverlight.Net有一些,其他的网上资源:


1. Silverlight Games 101 (Silverlight 1.1),从头开始教你如何开发一个太空游戏,涉及如何组织代码,游戏循环,怎么测试碰撞等。他们还在CodePlex上发布了一个物理引擎

2. David Anson的数独游戏

3. Bill Reiss的 Dr. Popper游戏 (Silverlight 1.1)

4. SilverlightFan网站汇集了N个游戏,包括Tetris,Virtual Earth,Zero Gravity,Bouncing Balls等等

5. SilverlightAddict的SilverLander (Silverlight 1.1)

6. Dr. DobbSparkle Ball游戏(Silverlight 1.1)

7. Game of Life in Silverlight and F# (Silverlight 1.1)

8. Vincent Vergonjeanne的Bubble Factory (Silverlight 1.1)

9. Tim Stall的Truck Wars Strategy Game v1.1 (Silverlight 1.1)

10. Zero Gravity (Silverlight 1.1)

11. Chris Cavanagh的物理模拟器 (Silverlight 1.1)

12. Scott Allen的Swinging Rope

13. A Silverlight graph visualizer (Silverlight 1.1)

14. Tim Sneath的50大Silverlight应用列表 (有些链接与上面有重复)

posted on 2007-11-06 05:24:00 by saucer  评论(3) 阅读(5570)

Silverlight开发工具安装一览表

在 Mike Henderson 的博客上看到这个一览表(他建议你按顺序安装):

1. IIS5.1 (XP) / IIS6 (Server 2003) / IIS7 (Vista) - 你也可使用Visual Studio中内置的Cassini 服务器

2. Visual Studio 2005

Service Pack 1 for Visual Studio 2005
Vista update for VS2005 (如果你在使用Vista做开发的话)

3. Visual Studio 2008, Beta 2

4. Windows Update - 确认你安装了所有的近期更新

5. AJAX策略更新 - 这确保你在VS2005里建造基于AJAX的应用时不会导致程序集依赖于VS2008/.NET 3.5

6. Silverlight 1.0运行时

7. Silverlight 1.0 SDK

8. Silverlight 1.1 Alpha Refresh 运行时

9. Silverlight 1.1 Alpha Refresh SDK (2007年9月更新版)

10. Silverlight Tools for Visual Studio 2008 Beta 2

11. * .NET 3.0 SDK (不是一定需要,但如果要做.NET 3.0 开发,一定需要,而且里面包括了一个可以做快速原型开发的工具:XamlPad)。

12. Expression Blend 2 九月更新版 (不是一定需要,但设计Silverlight内容时极其有用)

13. ASP.NET Ajax Extensions 1.0

14. ASP.NET Futures (包含基于ASP.NET的Silverlight控件)

全部下载的话,要下载7.6个小时!同时,你也许需要下列工具:
Expression Media Encoder
Silverlight Quickstarts
ASP.NET AJAX Controls
Windows Server 2008 RC0 SDK

 

至此,如果你还没发晕的话。。。就让我们开始Silverlight开发吧!

posted on 2007-10-25 01:58:00 by saucer  评论(10) 阅读(9891)

WPF图书大战

目前市面上有4本引人注目的WPF图书,

在Windows平台上编过程的,大概没人不知道Charles Petzold的大名,知道Adam Nathan的大概不多,但他的前一本书《.NET and COM》被奉为相关主题的权威著作。Chris Anderson是WPF的架构师,而Chris Sells在技术界也广为人知,最新著作包括《Windows Forms 2.0 Programming (第二版)》和《ATL Internals》。

 今年四月份,《Coding Horror》博客的作者Jeff Atwood以《How Not To Write a Technical Book(不应该这样写技术图书)》为名,比较了前两本图书,引起轩然大波,不少重量级的人物,包括作者本人,都加入了辩论。

Jeff Atwood认为,Nathan的书是绝对的赢家,理由大概翻译如下:

“。。。。
(Nathan的书)全书满是图表,屏幕截图和插图,辅助说明代码的涵义

书中文字间穿插了许多有用的彩色侧栏,例如深究(digging deeper),常见问题(FAQ),和警告(warning)等。

代码/标识片断较短,比较容易消化,而不是长篇累牍的文字占上好几页

慷慨使用了大量的列表,表格,副标题等文本元素,提供了极好的可扫描性(scannability)

有一种幽默感,不令人讨厌或倒胃口

全书全彩印刷

Nathan的书是出色的佳作,读上去象博客,可以跟网上能找到的任何东西一较长短。而相比之下,Petzold的书是没完没了的文字和冗长的代码的灰色的海洋。书中图表寥寥无几,每次遇上个图表,都会让人喜出望外。还有,该书还将代码和标识人工分开,前半本书都是C#代码,直到下半本书,你才能看到任何XAML标识,尽管XAML是WPF中最重要的新特性之一,且是开发人员最不熟悉的特性。

我猜这样老派做法是Petzold的典型风格。从一个认为Visual Studio腐蚀了软件开发人员的脑子的人那里,你还能期待什么呢? 任何人打开过这2本书的话,其手法之不同,一目了然。一本书看上去令人注目,充满乐趣,引人入胜,另一本书看上去很痛苦的,教科书式的苦差,相当于用记事本编写代码一样。Petzold是个优秀的作者,但写作本身并不能弥补他的书布局设计上的严重不足。

真是很可惜,我非常喜欢Petzold前面一本书《代码(Code)》,充满了美妙的插图,整个就是对个人计算机的情书。虽然我非常尊敬Petzold,你应该避开他的WPF一书,而是买Nathan的那本书,你会喜欢它的。出版商注意了,如果技术书都象这本书一样,我肯定还会买许许多多本这样的书的。

。。。”

Charles Petzold对这样的批评并不以为然,甚至说出了气话:“Prose is dead. PowerPoint has won (传统写作方式已经死了,PowerPoint赢了)”。

Don Box则指出,作为图书的“消费者”,如果一门技术仅仅是为了完成手头的工作,那么他是绝对不会买什么书的。他大概会使用Reflector钻研一下相关技术,也会在网上搜寻一下,花上半个小时看一下搜索结果。对这类任务,他大概会一边做一边学习如何使用相关技术。

但如果一门技术与他要打造的东西息息相关,那么他会购买很多相关的图书,认为在将来总会从其中得到收获。

那么他会选择什么样的图书呢? 他会阅读相关主题最简短的书,他的理由是,1,他没时间。2,他发现如果一本书长到千页,很多时候是这些书的作者没有略去不相关的细节,或者包含了太多非中心的主题。3,一本简短的书反应出书的作者对相关技术做了去粗取精的工作,书中内容往往切中要害,极富深知灼见。

在随后的一个贴子《技术书还是以内容为主,对么?(Content is Still King, Right? Right? (Please?))》里Charles Petzold作了解释,主要对Jeff Atwood的技术图书的标准不以为然,认为不应该以颜色论短长,而应该用具体内容作为标准。

Don Box为后两本书做了同样的序,他说,“This book has taught me a whole lot more. Now that it's all shipped, let the light blinking begin!” Chris Anderson一书的另一个序作者是Chris Sells,Chris Sells一书的另一个序作者则是Chris Anderson,既是好友,又是竞争者,是多么美妙的事!

posted on 2007-10-08 09:56:00 by saucer  评论(2) 阅读(6153)

Jesse Liberty成为The Silverlight Guy

【来源:Joe Stagner】 多产技术作家Jesse Liberty最近加入了微软的Silverlight开发团队,他的工作方向是“建造开发者社区(building Developer Community)”。

这里是他在silverlight.net上的博客地址:
http://silverlight.net/blogs/jesseliberty/

他开始了一个使用silverlight.net上的资源从头开始学习Silverlight的博客系列,

The Great Asynchronous Learning Experiment - Day 0
http://silverlight.net/blogs/jesseliberty/archive/2007/08/06/the-great-asynchronous-learning-experiment-day-0.aspx

The Great Asynchronous Learning Experiment - Day 1
http://silverlight.net/blogs/jesseliberty/archive/2007/08/06/the-great-asynchronous-learning-experiment-day-1.aspx

The Great Asynchronous Learning Experiment - Day 1 Revisited - S.L. 1.0 vs. 1.1
http://silverlight.net/blogs/jesseliberty/archive/2007/08/08/the-great-asynchronous-learning-experiment-day-1-revisited-s-l-1-0-vs-1-1.aspx

The Great Asynchronous Learning Experiment - Day 2
http://silverlight.net/blogs/jesseliberty/archive/2007/08/07/the-great-asynchronous-learning-experiment-day-2.aspx

Joe Stagner的贴子里还提到一个非常详尽的Silverlight资源列表

What is Microsoft Silverlight? Silverlight Resources, Articles and Tutorials
http://www.plentyofcode.com/2007/07/what-is-microsoft-silverlight.html

posted on 2007-08-09 03:25:00 by saucer  评论(3) 阅读(6568)

Silverlight相关链接 - Reflector插件,Silverlight控件等

1. Ernie Booth的Reflector Silverlight Browser

View Source Reflector tool for .NET Silverlight Sites
http://blogs.msdn.com/ebooth/archive/2007/05/19/view-source-reflector-tool-for-net-silverlight-sites.aspx

允许你在Reflector下查看任何Silverlight应用的代码,无论是托管代码还是Javascript,可以极大地帮助你理解别人的Silverlight应用是怎么工作的

2. Dave Relyea的C#布局控件

Silverlight 1.1 Alpha Layout System and Controls Framework
http://blogs.msdn.com/devdave/archive/2007/05/17/silverlight-1-1-alpha-layout-system-and-controls-framework.aspx

Dave Relyea发表了他编写的布局控件框架项目,补充了Silverlight 1.1中现有控件框架的不足,内容包括

  • 布局框架
  • LayoutControl,LayoutContainerControl控件基类
  • Border
  • StackPanel
  • Grid
  • Label
  • Button
  • TextBox

示范网址:
http://www.simplegeek.com/mharsh/layout/

3. Joe Stegman的博客贴子

Some V1.0 Breaking Changes
http://blogs.msdn.com/jstegman/archive/2007/05/21/some-v1-0-breaking-changes.aspx

提到了V1.0版本中将出现的几个非兼容性变动,包括

  • 接连事件处理函数时不再需要“javascript:” ,他提供了一个更新过的silverlight.js
  • 插件名称从“WPFe Plug-In”改成“Silverlight Plug-In”
  • 动画标识现在要求TargetName和TargetProperty属性

4. Desperately Seeking Love of Sophie(绝望地渴求苏菲之爱)的博客对Silverlight Alpha以及控件样例做了系统的介绍

Basics of Silverlight Alpha Application
http://vivekdalvi.wordpress.com/2007/05/15/basics-of-silverlight-alpha-application/

Using Browser Host to Resize the Page Size
http://vivekdalvi.wordpress.com/2007/05/16/using-browser-host-to-resize-the-page-size/

Silverlight Toolbar
http://vivekdalvi.wordpress.com/2007/05/14/silverlight-toolbar/

Basics of Custom Control in Silverlight
http://vivekdalvi.wordpress.com/2007/05/02/basics-of-custom-control-in-silverlight/

Using ListBox
http://vivekdalvi.wordpress.com/2007/05/10/using-listbox/

Fix for Button control
http://vivekdalvi.wordpress.com/2007/05/18/fix-for-button-control/

相关链接也可以在下面博客上找到
http://blogs.msdn.com/vivekd/default.aspx

5. Jaime Rodriguez的Snoop for Silverlight 1.0
http://blogs.msdn.com/jaimer/archive/2007/05/17/early-version-of-snoop-for-silverlight-1-0.aspx

这个工具可以帮助你理解Silverlight视觉树里元素的组成结构以及元素的属性,跟踪鼠标事件导致的属性变化等。这个工具的示范网页在这里
http://jaimersamples.members.winisp.net/silverlight/10/snoopsample/default.html

6. US ISV Developer Evangelism Team的移植WPF到Silverlight系列,目前发表了4个部分

Porting WPF to Silverlight 1.1 - 1st of a series...
http://blogs.msdn.com/usisvde/archive/2007/05/16/porting-wpf-to-silverlight-1-1-1st-of-a-series.aspx

Porting WPF to Silverlight 1.1 - 2nd of a series...
http://blogs.msdn.com/usisvde/archive/2007/05/19/porting-wpf-to-silverlight-1-1-2nd-of-a-series.aspx

Porting WPF to Silverlight - 3rd of a series...
http://blogs.msdn.com/usisvde/archive/2007/05/19/porting-wpf-to-silverlight-3rd-of-a-series.aspx

Porting WPF to Silverlight - 4th of a series...
http://blogs.msdn.com/usisvde/archive/2007/05/20/porting-wpf-to-silverlight-4th-of-a-series.aspx

7. Mike Harsh的博客上还介绍了一堆很酷的样例
http://blogs.msdn.com/mharsh/default.aspx

posted on 2007-05-22 00:43:00 by saucer  评论(18) 阅读(8506)

微软推出Popfly,一个面向大众的基于Silverlight的web mashup builder应用

Popfly的宗旨是给非专业人员提供一个软件开发工具, 根据Popfly网站

http://www.popfly.ms/Overview/

Popfly可以让大家轻松建造和共享mashups,gadgets, 网页和应用。 Popfly 由两部分组成:

1。 Popfly Creator 是一套建造网页和mashup的在线视觉化工具
2。 Popfly Space 是个在线creators社区,用户可以存放和共享自己的作品,评论和修改其他用户的作品

Popfly提供了一堆预制/连接好的web服务/编程模块可为用户所用,它支持JavaScript/AJAX,Popfly还提供了与Visual Studio的集成

Channel 9 有个采访开发团队和开发人员示范的录像
http://channel9.msdn.com/showpost.aspx?postid=308460

Adam Natham提供了一个screencast录像链接,进一步展示了Popfly的功能
http://go.microsoft.com/fwlink/?LinkID=91175

该项目目前还处于alpha测试阶段,还没有向大众开放。

posted on 2007-05-19 03:14:00 by saucer  评论(13) 阅读(9145)

Silverlight资源链接

今天在MSDN博客上,有个广为传抄 Asli Bilgin 编篡的 Silverlight resources 列表,这是小气的神博客上相关贴子的链接:

Silverlight Resources
http://blogs.msdn.com/ccboy/archive/2007/05/15/silverlight-resources.aspx

posted on 2007-05-16 01:13:00 by saucer  评论(6) 阅读(6685)

Silverlight 相关链接

1. 如果你真对Silverlight感兴趣的话,Mike Harsh的博客不可不读。他最新的一篇博客是关于他的SilverlightPad的,它允许你在浏览器里编写和运行XAML/Javascript代码

SilverlightPad - Now with Javascript Editing and Preview
http://blogs.msdn.com/mharsh/archive/2007/05/14/updated-silverlightpad-now-with-javascript-editing-and-preview.aspx

2. Ian Blackburn的Silverlight Mindmap

图片版本
http://www.bbits.co.uk/playground/silverlight/index.html

Silverlight版本
http://www.bbits.co.uk/playground/silverlight/silverlight_mind_map.htm

3. .NET Security博客发表了4篇关于Silverlight安全模型的贴子

The Silverlight Security Model
http://blogs.msdn.com/shawnfa/archive/2007/05/09/the-silverlight-security-model.aspx

Silverlight Security II: What Makes a Method Critical
http://blogs.msdn.com/shawnfa/archive/2007/05/10/silverlight-security-ii-what-makes-a-method-critical.aspx

Silverlight Security III: Inheritance
http://blogs.msdn.com/shawnfa/archive/2007/05/11/silverlight-security-iii-inheritance.aspx

Silverlight Security Cheat Sheet
http://blogs.msdn.com/shawnfa/archive/2007/05/14/silverlight-security-cheat-sheet.aspx

最后这篇贴子里面,列出了Silverlight安全模型的要点:(其中提到的平台程序集,platform assemblies,是指那些被Microsoft的特别公钥签过名的程序集)

  • 所有Silverlight应用都是security transparent(安全透明的),这意味着它们不能:
    • 含有无法校验的代码
    • 直接调用native代码
  • Silverlight应用可以访问平台程序集呈示的公开方法,只要它们是:
    • Security transparent (所用类或方法没有任何安全特性(security attributes))
    • Security safe critical (所用方法带有SecuritySafeCriticalAttribute特性)
  • Silverlight应用可以含有继承自下述类型的类型:
    • 当前应用中的其他类型
    • 由平台程序集定义的非密封的(Unsealed),而且是公开的,security transparent的类型和接口
  • Silverlight中的类型可以覆盖符合下述条件的虚拟方法或实现接口方法:
    • 当前应用本身定义的方法
    • 由平台程序集定义的,是security transparent或safe critical的方法

4. Reflector作者Lutz Roeder的三个Silverlight 1.1 Alpha样例

Monotone,Digger,Inplay
http://www.aisto.com/roeder/silverlight/

5. MSDN杂志六月份期的关于Silverlight的文章

中文版:SILVERLIGHT - 开始在整个网站积累更深入的体验
http://msdn.microsoft.com/msdnmag/issues/07/06/Silverlight/default.aspx?loc=zh

英文版:SILVERLIGHT - Get Started Building A Deeper Experience Across The Web
http://msdn.microsoft.com/msdnmag/issues/07/06/Silverlight/default.aspx?loc=en

6. Jason Zander 显示机器上运行的进程里CLR版本的代码

Code Sample: Is Your Process Using the Silverlight CLR?
http://blogs.msdn.com/jasonz/archive/2007/05/11/code-sample-is-your-process-using-the-silverlight-clr.aspx

7. Wilco Bauwer的Silverlight 1.1异步文件上传控件样例

Silverlight ASP.NET control: AsyncFileUpload
http://www.wilcob.com/Wilco/View.aspx?NewsID=204

8. Silverlight 1.1 文本框控件样例

Silverlight Alpha 1.1 TextBox
http://dotnetjunkies.com/WebLog/appeng/archive/2007/05/07/silverlight_1_1_alpha_textbox_sample.aspx

posted on 2007-05-15 01:36:00 by saucer  评论(8) 阅读(7559)

【第1页/共2页,29条】
首页
前页
1

Powered by: Joycode.MVC引擎 0.5.2.0