How easy is it to port a Windows Phone 7 applicati

2020-06-12 04:06发布

问题:

I know that Metro on both platforms shares a common “look and feel” and that WinRt makes use of XAMLand C# (or VB.NET) like Silverlight does on Windows Phone 7.

However I also know that WinRT is not Silverlight.

Therefore what is the process of creating an app that will work on both a Windows 8 tablet and a Windows 7 (or 7.5) Phone?

How close is WinRt to Silverlight?

回答1:

Despite certain people in Microsoft claiming it will only require changing a couple of lines of code...

The only possible answer to how difficult it will be to port an app is IT DEPENDS!

  • What does the phone app do?
  • How much of that functionality is also available on Win8?
  • What should be done done when it's not possible to do the same thing on Win8?
  • What should additionally be added (if anything) to the Win8 version?
  • What are you going to do with the extra screen real estate that you have on Win8 compared with the phone?
  • Are you using controls or UI elements on one which don't exist on the other?
  • etc, ....

The parrallels are that:

  • both use XAML
  • both can use the same programming language for the code (probably C#)
  • the design of "metro style" apps on Win8 was INSPIRED by Metro (the design language of WP7)

beyond that it will depend on the app.

You can't create an app which will run on both. At the very least you'll need to recompile as the 2 platforms will require targetting different versions of the .net framework.

Update:
Microsoft have provided some early stage guidance on making such a port. It includes some namespace and API mappings.



回答2:

Looking at the APIs, and ignoring differences in user experience, I'd say: not difficult but not trivial. Or, another way, more difficult than going from WPF to Silverlight but less difficult than WinForms to WPF.

  • Most of the WP/Silverlight controls (minus pivot/panorama) exist, but they exist a different namespace
  • Other features, like inter-application communication and state management, appear to work completely differently.


回答3:

The biggest potential problem I experienced is if you happen to have chosen to develop with XNA/Silverlight on the Windows Phone. In that case you either have to decide to completely rewrite the application or try out an XNA replacement such as MonoGame. Having gone that route myself I can happily say that, at least at this stage, MonoGame seems to support at least 90% of the functionality of XNA and due to the hard work of a few groups of developers and individuals it is now relatively easy to port over the application without too many fundamental changes.

Here is the link to MonoGames website http://monogame.codeplex.com/



回答4:

If you are familiar with the MVVM architecture, you can think about it this way:

  • Both apps can share the same view-model (especially if you made the design choice of not letting the view model know anything about the view)
  • You create a OS-specific view, the one you already have for Windows Phone and a new one for Windows 8 and bind to the same view model.
  • You load the views accordingly, using your choice of compiler directives, app configuration, separated shells/bootstrappers, etc.
  • You may need to introduce some compiler directives to your view-model and other non-view libraries if you use anything which is platform specific.

Following these directives you could have a very platform specific user experience, yet a very unified code base.

I hope this adds valuable information for you in addition to the great answers you already got from the other guys.



回答5:

You can check out http://msdn.microsoft.com/en-us/library/windows/apps/br229571(v=VS.85).aspx and see if that helps.



回答6:

This answer is the same for WP7 & SL.

On a scale of one to ten, it's a six or seven at best.

WinRT is just not the .Net framework, unfortunately. And that's WP7 & SL.

Having said that, if WP7 <-> W8 is a 7, WP8 <-> is a 9.9!

You will NEVER get 100%, by the way. Different form factors need different XAML, at the least.

Just remember, design with MVVM!