11

I am trying to port an existing C#-WPF-Project as an iPad-App.

As far as I found out by now, the best way to go would be to use MonoTouch and reuse as much C#-Logic as possible.

As the original project is written with WPF for an actual TabletPC, my question is, if there is any way, to reuse the WPF-sources or at least minimize the part I have to write again.

If there are any good alternatives to MonoTouch, I would appreciate tips too :)

UPDATE: Your comments were helpful, but are not 100% what I was looking for. MonoCross looks nice, but as far as I understand, it just "hides" the iOS-specific part. What I would really love, would be a way to reuse the handwritten "special" WPF-Controls. (Or at least minimize the work/time to transfer them.) This would be awesome.

UPDATE 2: Maybe I should add, that I would also accept some "complicated" three-step-technique. For example, is there a way to translate the XAML-WPF-files to HTML5 (or something equally powerful) and then use Titanium or PhoneGap? The Languages and Frameworks shouldn't be the big problem, I just try to find a way to reuse as much as possible :)

basti
  • 2,649
  • 3
  • 31
  • 46
  • Is there some sort of Web Service layer used in the original WCF app? – gotnull Jan 17 '12 at 09:08
  • No, there is no Web Service layer in the original WPF-app. – basti Jan 17 '12 at 09:11
  • See this related question: http://stackoverflow.com/questions/8755801/anyone-have-experience-with-architecture-for-cross-platform-wp7-android-ios-mobi/8756281#8756281 – ColinE Jan 17 '12 at 09:13
  • 1
    @Chiffre please see the update in my answer following your Update(2). Best regards, – Dr. Andrew Burnett-Thompson Jan 17 '12 at 15:55
  • @Dr.AndrewBurnett-Thompson: Thanks, you are a very big help! I will have a look into this framework! – basti Jan 18 '12 at 09:08
  • @Chffre no problem and glad to be of help. I would suggest that there will be no perfect conversion from WPF to HTML5. Ideally you want to use pure .NET and implement three views or pure HTML5 and use PhoneGap as you previously mentioned. There is no easy way to meet all these requirements! Good luck :) – Dr. Andrew Burnett-Thompson Jan 18 '12 at 09:11

1 Answers1

3

Please see this previous question which is related and may be of interest on creating cross-platform iOS, Android and WP7 applications.

In response to your question, no it is not possible to re-use WPF Guis on iPad, IPhone, Android. Only Windows Phone will support silverlight views. To workaround this you must use a Model View controller architecture (as iOS, Android won't support databinding via MVVM) on all three and create separate views for each architecture.

While this may sound laborious, please note that if you correctly architecture your application so that key business logic and presentation logic is inside the Controller (or services) layers then you can re-use a large proportion of your code. This is the same limitation as if you create cross-platform code to dual deploy to Silverlight and WPF on Windows. The Xaml files often have to be specific to each framework, however often *.cs user controls and viewmodels / code logic can be shared.


UPDATE: Following your Update(2) in question.

Yes, you can use a third party server to translate XAML-WPF-files to HTML5 - the ComponentArt Dashboard Server. This claims to translate WPF/Silverlight applications written using strict MVVM to HTML5/JS for portability across multiple devices. I can't vouch for how effective this is and I do know it is expensive, however if you are seriously stuck and want to port WPF -> HTML5 then it is worth investigating this.

Best regards,

Community
  • 1
  • 1
Dr. Andrew Burnett-Thompson
  • 20,980
  • 8
  • 88
  • 178
  • It's a pitty, because the existing project is written for an touch-enabled TabletPC. The architecture should be just fine already. So the "big" part was/is the UserInterface. – basti Jan 17 '12 at 09:49
  • 1
    @Chiffre yes big shame. However that is the thing with platform specific APIs - apple / google have zero incentive to support WPF. It's only because of the clever hackery of the Monotouch / Monodroid team that we can even use C# on these platforms! If you do find any way of sharing more GUI code, do let me know. It's an area I'm very interested in. Best regards, – Dr. Andrew Burnett-Thompson Jan 17 '12 at 09:52
  • As far as I can see, the "ComponentArt Dashboard Server" only works for the Controls, that are included in the "Framework". I would have needed it for my own created controls. But nevertheless, I will accept that I have to rewrite it and you were very helpful! – basti Jan 31 '12 at 12:48