Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reuse C#-Project on iPad

Tags:

c#

wpf

ipad

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 :)

like image 585
basti Avatar asked Jan 17 '12 09:01

basti


1 Answers

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,

like image 137
Dr. Andrew Burnett-Thompson Avatar answered Oct 01 '22 18:10

Dr. Andrew Burnett-Thompson