WinFX开发手记(本文都是基于WinFX Beta2做出的)
Part1 WinFX概述
作者:张程

WinFX是一种在Microsoft Windows下的托管编程模型。它包含了.NET Framework 2.0、Windows Presentation Foundation、Windows Communication Foundation、Windows WorkFlow Foundation。

.NET Framework
核心API包含了被所有WinFX类型的程序共享的类。它的很大一部分都被包含在System命名空间下。.Net Framework API主要包括以下几个方面:
1、 基本的值类型和引用类型
2、 集合与数据结构
3、 数据
4、 图像和绘画
5、 输入和输出
6、 基本的网络支持
7、 安全
8、 线程和运行时服务
.NET Framework不仅可以用来创建Windows From程序,同样也提供了创建Web应用程序的支持。

Windows Communication Foundation
构建在Web Service协议之上的新的面向服务的基础通信结构。提供了互操作安全、可靠性保证、事务化消息。
Windows Communication Foundation构建在.Net Framework之上的,根本上简化了互联系统的构建工作。对于分布式系统提供了统一的购建化、可扩展的架构,支持多路传输、消息模式、编码、网络拓扑和Hosting模型。可以说是现有的ASP.Net(asmx)、Microsoft Web Service Enhancements for Microsoft .NET(WSE)、.NET Remoting、Enterprise Service和System.Messaging集中统一的下一个版本。
Windows Communication Foundation的类和API大部分都包含在System.ServiceModel命名空间内,提供了对一下技术的支持:
1、 单向和双向消息
2、 同步和异步远程过程调用
3、 回调
4、 会话
5、 多契约服务
6、 基于传输、消息的安全性、可靠性和有序分发
7、 消息队列
8、 事务支持

Windows Presentation Foundation
Windows Presentation Foundation是未来Windows中的图形子系统的统一基础构架。包含了显示引擎和一系列的托管类用以创建令人惊异的应用。引入了XAML这是一种基于声明的模型,可以用来操控Windows Presentation Foundation对象模型。
Windows Presentation Foundation提供的API和类很大一部分都包含在System.Windows命名空间内。主要的组件包括:
1、 一个应用程序模型,包含导航、窗口和对话框
2、 UI数据绑定
3、 丰富的扩展布局和控件对象
4、 2D、3D图形支持
5、 动画
6、 多媒体
7、 文档

Windows WorkFlow Foundation
Windows WorkFlow Foundation是构建在.NET Framework基础上的全新的工作流开发平台。
Windows WorkFlow Foundation为创建和执行多样的、长时间运行的、稳定的工作流应用提供了统一的编程模型。
Windows WorkFlow Foundation提供了简便易用的工作流功能,让开发例如文档管理、商业票据流转、IT管理和其他各种各样的商业应用程序变得更加容易。
应用程序可以方便的载入工作流引擎,并且插入各种各样的运行时组件,因此它具有高度的可扩展性,可以创建适合特定商业领域的工作流组件并实现功能。
Windows WorkFlow Foundation也同时提供了对ASP.NET的支持,因此在IIS(Internet Information Service)/ASP.NET环境下开发工作流程序也变得十分方便。

获取和安装检测WinFX
从微软网站上现在可以方便的获取WinFX Beta2的版本,分为x86、IA64、x64三个版本,下载后参照安装说明就可以完成安装过程。
安装了的朋友可以使用以下HTML代码来确定自己的WinFX版本是多少。

<html>
<head>
    
<title>Test for WinFX Runtime</title>
    
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    
<script language="JavaScript">

<!--
var WinFXRuntimeVersion = "3.0.50727";

function window::onload()
{
if (HasRuntimeVersion(WinFXRuntimeVersion))
{
result.innerText 
= "This machine has the correct version of WinFX Runtime: " + WinFXRuntimeVersion + "." + "\n\nThis machine's userAgent string is: " + navigator.userAgent + ".";
}
 
else
{
document.write(
"This machine does not have the correct version of WinFX Runtime.<br>"
+ "<a href='http://msdn.microsoft.com/windowsvista/default.aspx'>"
+ "Click here to get</a> WinFX now."); }

}


//
//
 Retrieve the version from the user agent string and compare with specified version.
//
function HasRuntimeVersion(versionToCheck)
{
var userAgentString = navigator.userAgent.match(/WinFX RunTime [0-9.]+/g);

if (userAgentString != null)
{
var i;
for (i = 0; i < userAgentString.length; ++i)
{
if (CompareVersions(GetVersion(versionToCheck), GetVersion(userAgentString[i])) <= 0)
return true;
}

}

return false;
}


//
//
 Extract the numeric part of the version string.
//
function GetVersion(versionString)
{
var numericString = versionString.match(/([0-9]+)\.([0-9]+)\.([0-9]+)/i);
return numericString.slice(1);
}


//
//
 Compare the 2 version strings by converting them to numeric format.
//
function CompareVersions(version1, version2)
{
for (i = 0; i < version1.length; ++i)
{
var number1 = new Number(version1[i]);
var number2 = new Number(version2[i]);
if (number1 < number2)
return -1;
if (number1 > number2)
return 1;
}

return 0;
}

-->
    
</script>

</head>
<body>
    
<div id="result" />
</body>
</html>

如果成功安装了WinFX Beta2,那么浏览器会显示以下内容:
This machine has the correct version of WinFX Runtime: 3.0.50727.

This machine's userAgent string is: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; WinFX RunTime 3.0.50727).

posted on 2006-06-12 12:54  NGNGrid  阅读(1196)  评论(3编辑  收藏  举报