Win8 Metro UI应用的开发是一件非常有趣的事情,特别是它使用了非常奇特的Metro UI设计。如果现有传统UI设计的应用,能够很方便的移植到Win8上,并且也能够充分利用Metro UI的魔力,那么将是非常有有意义的事情。本篇博客就是讲述,在一般情况下,如何将传统UI应用移植成Metro UI应用。
移植工作看上去比较的难,但是按照规律办事,很多事情仅仅是时间和耐心问题。网友不妨使用9步法来完成你的应用移植:
1.
下载并安装Windows 8 Consumer Preview,下载并安装Microsoft Visual Studio 11 Express Beta。
2.
使用Microsoft Visual Studio 11 Express Beta 创建Metro UI应用程序项目,语言可以选择你自己喜欢的C/C++、C#或者Visual Basic等。
3.
将你要重复使用的文件夹、源代码、资源文件等拷贝到你的新项目中,并且在Solution Explorer中选择Show All Filters。
4.
用鼠标右键选择你的文件夹、文件等,将其添加入新项目中。
5.
使用整个项目的查找替换方法,将System.Windows替换成为Windows.UI.Xaml。
Silverlight XAML namespaces
Windows Runtime XAML namespaces
System.Windows
Windows.UI.Xaml
System.Windows.Automation
Windows.UI.Xaml.Automation
System.Windows.Automation.Peers
Windows.UI.Xaml.Automation.Peers
System.Windows.Automation.Provider
Windows.UI.Xaml.Automation.Provider
System.Windows.Automation.Text
Windows.UI.Xaml.Automation.Text
System.Windows.Controls
Windows.UI.Xaml.Controls
System.Windows.Controls.Primitives
Windows.UI.Xaml.Controls.Primitives
System.Windows.Data
Windows.UI.Xaml.Data
System.Windows.Documents
Windows.UI.Xaml.Documents
System.Windows.Input
Windows.UI.Xaml.Input
System.Windows.Interop
Windows.UI.Xaml.Interop
System.Windows.Markup
Windows.UI.Xaml.Markup
System.Windows.Media
Windows.UI.Xaml.Media
System.Windows.Media.Animation
Windows.UI.Xaml.Media.Animation
System.Windows.Media.Imaging
Windows.UI.Xaml.Media.Imaging
System.Windows.Media.Media3D
Windows.UI.Xaml.Media.Media3D
System.Windows.Navigation
Windows.UI.Xaml.Navigation
System.Windows.Printing
Windows.UI.Xaml.Printing
System.Windows.Resources
Windows.UI.Xaml.Resources
System.Windows.Shapes
Windows.UI.Xaml.Shapes
6.
拷贝能够重复使用的XAML代码到项目的XAML文件中去(你可以根据需要创建新的XAML文件)。
7.
编译你的项目,使用错误信息快速定位需要修改的地方。使用Windows Runtime APIs替换元代的.NET APIs。
8.
对不能够简替换的代码部分,使用注释将其暂时屏蔽,以便日后慢慢修改。重复7和8的方法直到整个项目完全编译通过。
9.
对暂时屏蔽的代码部分逐一解决。完成所有相关的修改后,你的移植工作基本完成,下面的工作就是解bugs了。
怎么样?是不是比较简单!还不现在动手试一试J。
原文地址:
http://g.csdn.net/5220269