Windows 8 &视窗电话 8 [英] Windows 8 & Windows Phone 8

查看:24
本文介绍了Windows 8 &视窗电话 8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 Visual Studio Professional 2012 为 Windows Phone 8 和 Windows 8(平板电脑)开发应用程序?我希望能够重用大部分代码.

How can I develop an App with Visual Studio Professional 2012 for both Windows Phone 8 and Windows 8 (tablets)? I hope on beeing able to reuse most of the code.

推荐答案

关于如何获得高代码重用的一些想法:

Some thoughts on how to get high code reuse:

  • 目前 XAML 可能是您最好的语言选择...Win8 和 WP8 之间有很多重叠.这是一个 Windows Phone 8 和 Windows 8 之间的 XAML 控件比较.
  • 利用 MVVM 模式.这为您的 UI 和应用程序逻辑提供了很好的解耦.
  • 使用可移植类库(可在 Win8、WP8 等平台).更多信息此处.
  • 或者,使用添加为链接" 从 Win8 和 WP8 引用相同的源文件.这样,您就可以在一处维护源代码,但您的 Win8 和 WP8 应用都会使用它.
  • 使用条件编译.例如,这将使您能够仅针对 Windows 8 编译某些代码块.谨慎使用是很好的,但是如果您发现自己经常使用这种技术,您的代码可能会变得非常难以阅读并且其他人难以维护.
  • 这个关于 如何在 WP8 和 Windows 8 中利用代码的视频来自 BUILD 2012很有帮助.
  • http://aka.ms/ShareCode开始为 Windows Phone 8 和 Windows 8 开发应用程序.
  • 旁注:如果您正在为两者进行开发,那么拥有 Visual Studio Professional 是件好事.您可以使用免费版本进行开发(适用于 Windows 8 的 Visual Studio Express 和适用于 Windows Phone 的 Visual Studio Express,均可在此处下载),但使用 Professional,您可以打开一个 Visual Studio 实例并在同一解决方案中引用这两种类型的项目.
  • Currently XAML may be your best language choice...lots of overlap between Win8 and WP8. Here is a XAML controls comparison between Windows Phone 8 and Windows 8.
  • Leverage the MVVM pattern. This gives a nice decoupling of your UI and application logic.
  • Use portable class libraries (DLLs that can be used across Win8, WP8, and other platforms). More info here.
  • Or, use "Add as link" to reference the same source file from both Win8 and WP8. That way, you are maintaining the source code in one place, but it is used by both your Win8 and WP8 apps.
  • Use conditional compilation. This will enable you to compile certain chunks of code in only for Windows 8, for example. It's nice to use sparingly, but if you find yourself using this technique often, your code can get very difficult to read and for others to maintain.
  • This video on How to Leverage your Code across WP8 and Windows 8 from BUILD 2012 is helpful.
  • There are lots of useful links on http://aka.ms/ShareCode and Getting started developing apps for Windows Phone 8 and Windows 8.
  • SIDE NOTE: it's nice that you have Visual Studio Professional if you're developing for both. You can develop for both using the free versions (Visual Studio Express for Windows 8 and Visual Studio Express for Windows Phone, both available for download here), but with Professional, you can have one instance of Visual Studio open and reference both types of projects in the same solution.

这篇关于Windows 8 &视窗电话 8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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