为平板电脑和 WindowMobile 开发 winforms 应用程序
我正在为基于 Windows 的平板电脑开发应用程序。 该应用程序几乎是我已经使用 .NET CF 在 Windows Mobile 设备上开发的应用程序的一个端口。 我想利用我在软件开发中获得的所有知识从头开始编写应用程序。
我还想以这样的方式编写这个新应用程序:如果我愿意,我可以修改现有的 Windows Mobile 应用程序以使用新的库。 理想情况下,我将拥有一组共享的业务逻辑和数据访问库,唯一真正的区别是 UI 层 - 用于平板电脑版本的 WPF,以及用于 Windows Mobile 应用程序的标准 CF 接口。
考虑到这一点,我需要确保我创建的所有项目都与 .NET Compact Framework 兼容。 有没有一种简单的方法可以确保这一点? 我的一个想法是为我创建的每个类库使用智能设备项目。
除此之外,我是否可以轻松地从标准 Windows 应用程序引用为 .NET CF 应用程序编写的这些库?
为平板电脑开发应用程序与开发任何普通 Windows 窗体应用程序相同吗? 是否需要考虑不同版本的 .NET Framework,或者平板电脑几乎是标准 Windows 电脑?
I'm developing an application for a Windows based tablet PC. This application is pretty much a port of an application I already developed on a Windows Mobile device using .NET CF. I want to write the application from scratch, taking advantage of all of the knowledge I've gained in software development.
I'd also like to write this new application in such a way that if I so desire, I can modify my existing Windows Mobile app to use the new libraries. Ideally, I'll have a shared set of business logic and data access libraries, with the only real difference being the UI layer - WPF for the tablet version, and just a standard CF interface for the Windows Mobile app.
Taking this into account, I'll need to make sure that all of the projects I create are compatible with the .NET Compact Framework. Is there an easy way to ensure this? One thought I had was to use a Smart Device Project for each class library that I create.
As well as this, is it easy for me to reference these libraries written for a .NET CF application from a standard windows application?
Is developing an application for a tablet PC the same as developing any normal windows forms application? Is there a different version of the .NET Framework to take into account, or are tablets pretty much standard windows pcs?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我见过的平板电脑运行带有“完整”.NET 的标准 Windows,但我希望您也可以获得一些轻量级设备。 一个有趣的可能性可能是“客户端配置文件”(常规“完整”.NET dll 的子集)——但我自己还没有看到它的太多用途。
CF 和常规 .NET 有很多共同点,但最终还是有区别的; 两者都不是另一个的严格子集。 我发现,一般来说,为两个框架编写代码的唯一方法是保持两个框架都处于活动状态...对于 protobuf-net (有这个问题),我为每个框架保留一个项目文件,以便我可以快速测试构建在任何地方都可以工作(即没有丢失的方法等)。
您可能会发现需要使用
#if
块在两个框架上运行略有不同的代码,特别是如果您出于性能原因想要使用“完整”.NET 功能(这些功能在CF版)。 使这变得更容易的一种方法是破解 proj 文件以使用递归文件包含:现在您不必不断向两个项目添加新文件 - 它会自动拾取(警告:在 IDE 中您可能需要卸载/重新加载项目)。
The tablets I've seen are running standard Windows with the "full" .NET, but I expect you can get some light-weight devices, too. One interesting possibility might be "client profile" (a subset of the regular "full" .NET dlls) - but I haven't seen much use of that myself.
CF and regular .NET share a lot of things, but ultimately there are differences; neither is a strict subset of the other. I've found that in general the only way to write code for 2 frameworks is to keep both active... for protobuf-net (which has this problem) I keep a project file for each framework so that I can quickly test that the build works everywhere (i.e. there are no missing methods etc).
You may find you need to use
#if
blocks to run slightly different code on the two frameworks, especially if you want to use "full" .NET features for performance reasons (that don't exist in the CF version). One way of making this easier it to hack the proj files to use recursive file inclusion:Now you don't have to keep adding new files to both projects - it'll get picked up automatically (caveat: in the IDE you may need to unload/reload the project).
没有适用于 Tablet PC 的特殊版本的 .NET Framework。 Windows Mobile 和 Windows 之间共享代码的问题之前已经被问过 并且接受的答案非常好。
There isn't a special version of .NET Framework for Tablet PC. The question of sharing code between Windows Mobile and Windows has been asked before and the accepted answer is excellent.