Transferring an WPF Application to Mobile c#

后端 未结 2 352
我在风中等你
我在风中等你 2021-01-12 18:20

I\'m just wondering the easiest way to transfer my application into a mobile friendly version that I would be able to put onto android phones. Any help and pointers would be

2条回答
  •  失恋的感觉
    2021-01-12 18:58

    Xamarin - it's the best way. Keeps your code in C# with loads of code re-use.

    Assuming you developed your WPF app using the MVVM design pattern then porting it to Android might not be that hard. You just need to ensure all your non-UI code is portable (as in it uses the subset of the .Net framework that is available to a portable class library) and move anything device specific to an Android library. If you have been using dependency injection/IoC then this should be relatively simple.

    The other option with Xamarin is Xamarin.Forms. Like WPF you define your UI in Xaml and there are controls available from the big control vendors like DevExpress. The output of Xamarin.Forms is a cross platform app so will run on Android, iOS and UWP depending on what platform specific features you need to use - and there are plenty of plug-ins to help with all this.

    Once you have the core business logic (the VM and M of MVVM) in a portable class library then you just need to write the UI layer on Android, and from there it's not too hard to add a, iOS or UWP UI layer as well.

    Also if you are using MVVM how have you implemented it? If you are using PRISM, MVVMCross or MVVMLight then these support Xamarin apps.

    A good blog post showing how to do something similar is on the Xamarin Blog here: https://blog.xamarin.com/porting-existing-net-apps-to-android/

提交回复
热议问题