Windows 8 & Windows Phone 8

后端 未结 4 1778
有刺的猬
有刺的猬 2021-01-31 12:21

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.

相关标签:
4条回答
  • 2021-01-31 12:50

    There is a good blog post covering this subject here.

    0 讨论(0)
  • 2021-01-31 12:51

    For Windows phone 8 you have to install windows phone sdk which available on microsoft official site,for tablets you don't have to install SDK it is already available in installed projects.

    0 讨论(0)
  • 2021-01-31 12:58

    Some thoughts on how to get high code reuse:

    • 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.
    0 讨论(0)
  • 2021-01-31 13:03

    Yes, but you need to use diffrent project templates. You also need Windows 8 SDK and Windows Phone 8 SDK.

    If you use XAML, you can easily migrate in projects (without phone features and contracts).

    0 讨论(0)
提交回复
热议问题