如何组织的Windows Phone的代码库同时针对7.x和8平台

编程入门 行业动态 更新时间:2024-10-25 08:19:07
本文介绍了如何组织的Windows Phone的代码库同时针对7.x和8平台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我接手一个的Windows Phone 项目这是以前针对WP 7.1的平台,并且与近期新平台的发布,应该针对WP 8也是如此。

I took over a Windows Phone project which was previously targeting WP 7.1 platform, and with the recent announcement of the new platform it should target WP 8 as well.

我的 VS 2010解决方案由几个项目(数据访问,型号,测试和WP7客户端应用程序),我游荡如何包括WP8支持。

My VS 2010 solution consists on several projects (Data access, Model, Tests and WP7 client app) and i am wandering on how to include support for WP8.

我必须注意的是,代码库是不与WP8兼容,由于工具包的控制和其它针对WP7.1具体地说第三方库的使用。

I have to note that the code-base is not compatible with WP8, due to usage of Toolkit controls and other 3rd party libraries targeted for WP7.1 specifically.

也有是与Visual Studio版本的另一个问题 - WP7.1可以用VS 2010的工作,但WP8需要VS 2012的我应该整个代码库移到VS 2012?

Also there is another problem with the Visual Studio versions - WP7.1 can work with VS 2010, but WP8 requires VS 2012. Should i move the whole code-base to VS 2012?

如何在最有意义的方式,以避免重复和可能的痛苦维护组织的代码库有什么好的建议吗?

Any good advice on how to organize code-base in a most meaningful way in order to avoid duplication and possible painful maintenance?

我的一个解决方案之间的思考 - 多个项目与多种解决方案 - 可重复使用的项目的办法。重复代码(如两个单独的文件夹/解决方案)应该是最可行的方法(后备)。

I am thinking between one solution - multiple projects vs. multiple solutions - reusable projects approach. Code duplication (like two separate folders/solutions) should be the least possible approach (fallback).

推荐答案

最好的事情要做是你,以便能够同时支持WP版本(你仍然能够打开VS2010的WP7项目,尽管它是一个VS2012的解决方案,因为它是向后兼容)升级所有项目VS2012。

The best thing to do is for you to upgrade all the projects to VS2012 in order to be able to support both WP versions (you'll still be able to open the WP7 project in VS2010 despite it being a VS2012 solution, 'cause it's backward compatible).

关于组织代码库的最佳方式,在我看来,你应该创建一个可移植库,同时支持WP7和WP8,并得到所有的公共代码库有(可能是主要的业务逻辑,特别好,如果你正在使用模式,如MVVM)。不要忘记对控制问题,你应该有一些WP8不同控件导致屏幕尺寸是不一样的,你可以得到一些更多的信息可用,并使用不同的控制。如果你仍然想使用相同的XAML代码,只有一个文件中的一个项目,并添加相同的文件作为链接中的其他项目,你想重新使用它。

Regarding the best way to organize the code base, in my opinion you should create a Portable Library that supports both WP7 and WP8 and get all the common code base there (probably mainly the business logic, specially good if you're using a pattern such as MVVM). Not forgetting about the controls issue, you should probably have some different controls for WP8 'cause the screen sizes are not the same and you could get some more info available and use different controls. If you still want to use the same XAML code, have just one file in one of the projects and add that same file "As Link" in the other project you want to re-use it.

最后,你可以,也或许应该,通过使用#if指令的使用一些有条件的代码编译。

Finally, you can, and also probably should, use some conditional code compilation by making use of the #if directive.

希望这个信息帮助,以及是否需要任何代码示例,只是这么说,我会尽力搜集的东西了。

Hope that this information helps, and if any code sample is needed, just say so and I'll try to gather something up.

更多推荐

如何组织的Windows Phone的代码库同时针对7.x和8平台

本文发布于:2023-11-03 12:55:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1555189.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:代码   组织   平台   Phone   Windows

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!