Mono - Native UI on each platform? - user-interface

Is it possible to have one core dll written in mono and 3 separated native UIs on Linux, Mac and Windows? If yes, what are the options I have?
Let's assume I have written a GUI with WPF (Windows) and now I want to connect the mono dll to the WPF Form so I can use it's exported functions and classes. Same on Mac OS X: GUI written in Cocoa and connected to a mono core dll?
Do you guys know any example projects, which uses that approach?

Well, you can use a PCL library that contains your logic, combined with the Xamarin.Mac framework on OSX, GtkSharp on Linux, and WPF on Windows. As for using raw Cocoa, that'd be tougher; you'd have to host the Mono runtime (which is not impossible but also not easy).
Edit: I should add that you could also try for a "write once" UI and use GtkSharp for all three.

I found a possible solution: https://github.com/picoe/Eto
It does exactly what I was looking for!

Related

Is there a Nuget package for Mac SQLite.Net PCL Platform (SQLite.Net.Platform)

I see that there's a Nuget Platform implementation for the following
Win32 - SQLite.Net.Platform.Win32 XamarinIOS -
SQLite.Net.Platform.XamarinIOS XamarinAndroid -
SQLite.Net.Platform.XamarinAndroid
But is there one availabe for Mac / OSX?
I'm developing using the Xamarin Studio and wish to eventually write a Mac app too, but to start with I want to write NUnit tests on the Mac and therefore I believe that I need a Mac version?
Unfortunately I have not had time to create any more platform implementations.
That said, they are fairly easy to do, you should be able to basically reuse the Win32 class implementation.
The one change you will have to do is to include a Mac/OS X compatible binary of sqlite and change the DllImport statements so that they actually reference that file instead.
The Win32 platform implementation also does some fancy stuff to dynamically load the correct 32/64-bit version of the sqlite binary, using a Win32 function called LoadLibrary.
I'm not sure how this would work of OS X, but I guess there would be an equivalent function you can pinvoke. If you don't want to mess with that just reference the 64- (or 32-) bit sqlite binary directly and make sure the tests run as the same.
If you do go through with this I would love to see a pull request on github:)

Easy GUI programming in Mac OS X. Targeting Windows Platform

I have a friend who has an entry-level background in programming and is looking for a free GUI framework (IDE, GUI toolkit and GUI designer ) that:
He can use on Mac OS X to build Windows applications
It's very easy to use.
He is not interested in becoming a programmer, but would like to build an application for his work (not CS-related).
What are some good GUI frameworks/prog. languages he can use?
Qt including Qt Creater and Qt Designer is worth a try.
Especially, if your app should finally run cross-platform, on phones or on other embedded devices. Qt natively supports C++, but can also be used with 3rd-party extensions with Python (PyQt) and probably other languages.
On a Mac I have to recommend making Cocoa applications in Xcode written in Objective-C. Xcode is free to download and use, you pay if you want to submit applications to the Mac App Store.
I personally use Xcode every day and I think it's a great IDE. Currently has compiler support for Obj-C, C++, C and maybe more (not sure). More importantly for your needs, Xcode does a great job of integrating your code with its build in "interface builder" to help you quickly and easily create a nice UI.
NOTE: Xcode includes a new compiler feature (ARC) Automatic Reference Counting which is create for a new user. You can learn the language without having to worry about manual memory management.
Your friend should consider using PySide, a Python binding for the Qt GUI framework already mentioned.
With PySide you can use the Qt tools to create GUI elements interactively
and code your application logic in Python, which is a language often appreciated by non-programmers (and programmers too!) for its simplicity and intuitiveness.
Xcode includes a WYSIWYG editor for native controls and views. This was formerly a separate program called Interface Builder, but the editor was moved into the Xcode IDE at version 4.
AppKit is the framework it uses in most cases -- that's Objective-C. It's well supported. Your friend can also use it for source code editing and building and debugging apps. If he wants to write UIs programmatically, Xcode and AppKit are also good options.

Is it possible to write shared libraries between iPhone, Android, Blackberry, Mac and Windows?

I'm tasked with "porting" a few apps from a Windows environment to various mobile platforms and Mac as well.
I plan on writing MVC patterned apps in which I write as many controllers as I can in some sort of universal library, probably in C or C++. Then writing the views in various choice languages (Objective C, Java, .NET, whatever) for the target OSes.
I've never attempted anything like this before, so my questions are: Is it possible to write and compile one library that can be used on iPhone, Android, Blackberry, Windows and Mac? Is it even wise to try this?
I understand that certain native methods simply won't be available on each platform.
You can create a library whose source code is portable, assuming that you properly abstract away any platform-dependent calls. You can't, however, create such a library, compile it, then use it anywhere; you'll have to compile it for each platform.
Your should take a look at the Mono Project. http://www.mono-project.com
...more specifically at :
MonoTouch: To develop iPhone applications in .NET
MonoDroid (BETA): To develop Android applications in .NET
Mono plugin for MeeGo: To develop MeeGo applications in .NET
And you know that you can develop on Windows Mobile in .NET already.
I've haven't found anything related to BlackBerry yet.
There are services like Rhomobile and Appcelerator which will allow you to do this sort of cross compiling.
I've never used either however.

Mac/Windows MIDI application programming language

What is the best programming language for writing MIDI-interactive musical application that would be run on MAC and on Windows?
I've written cross platform (Mac OS X and Windows) MIDI applications using C++. I used the RtMidi for MIDI I/O which was incredibly easy to get going (on every platform just it just worked out of the box). The advantage of C++ is that you can use native GUIs on each platform, but if you're not already into C++ I'd say a cross platform project is a pretty ambitious first project.
One possibility is .NET (C# or VB.Net), which runs on Windows (of course) and Mac (thanks to Mono). The downside is that .NET does not have any native support for MIDI, so you'd have to tap into two different native APIs for MIDI.
Java is another possibility, since it has a number of MIDI-supporting libraries available. Your UI is bound to look pretty terrible, though.
Python has substantial support for MIDI and runs on Mac and Win.
pygame.midi
PyPortMidi
PythonMIDI
pyrtmidi
For both mac and windows I would suggest Java. Midi is just a protocol so any language can do it. A good framework will speed things up a lot. Java has frameworks to work with Midi and other multimedia sources.
PortMidi is another popular cross-platform MIDI library. Qt is a nice cross-platform Framework, GUI and utility library.
It's an old thread, but nowdays you can use .NET. I mean official cross-platform .NET from Microsoft, not Mono. In this case I can recommend my library – DryWetMIDI. Its core part (working with MIDI files, processing MIDI data and so on) is cross-platform for any OS supported by .NET.
As for working with MIDI devices, this API supports Windows and macOS (that's what you need). Full documentation of the library availabale here: https://melanchall.github.io/drywetmidi. There you can find full API reference and help articles. For example, overview article on working with MIDI devices.
The library is distributed via NuGet package and can be installed via NuGet on both Windows and macOS.

How do you port a Cocoa/Mac application to Windows?

How do you port a Cocoa/Mac application to Windows? I mean how would you go about it? Assume the app was written with Objective-C and Cocoa, there's nothing fancy going on, no "engine" that could be factored out, etc.
Rewrite from scratch? I don't think there will be huge overlaps between the Mac and Windows codebases, right?
I have doubts about cocotron.
Its not clear from the cocotron website that cocotron is actually production ready yet. Id suspect that it would be possible to start new app development and use cocotron constantly to maintain and test windows builds on the go.
But to retrofit it into an existing project might be a much larger task. There are also no alternatives to cocotron - other than perhaps gnustep.
The practical approach to cross platform development involves developing the non gui components of your application, once, in C or C++. And then using a cross platform GUI library like QT - which is VERY good at generating and using native UI where possible or faking it where not. Please DO go to qt.nokia.com and download the latest build of QTCreator for windows and mac - See how the same QT application looks and feels very convincingly native on both platforms.
If QT doesn't provide a native enough solution, then you need to develop your GUI twice :- once in Cocoa, and once in Win32. The cocoa GUI would be in objective C of course, the Win32 GUI in C/C++.
Your non gui application code would - written in c++ - not be able to call Objective-C directly, but its not hard to write shim classes, implemented in .mm files - the provide a c++ interface, and wrap access to an objective c object or class.
You are also going to have to come up with an alternative to CoreData on windows - perhaps sqlite? Given that XCode has integrated support for the sqlite framework, and testing multiple code paths is, well, more work - perhaps dropping CoreData in favor of a common layer is a better approach?
The problem with Objective C is its very poor support on any platform that is not OS X. You can attempt to use the Cocotron, but I wouldn't consider it production ready yet.
For portability, a re-write is in order. With judicious use of standard C or C++ for the "core" of the application, you could still implement platform specific GUI code. If you don't like maintaining two GUIs, you can also try a toolkit such as Qt
Depending on which objects and framework you are using for your cocoa app, you might be able to get away with using gnustep, although the end result will probably look very weird to windows users, and the development environment might be a bit difficult to setup at first.
Are you aware of Cocotron? It looks like the project may have gone stale, but it's a good starting point anyway. It's a project to port Core APIs.
If your application is not cleanly separated (ie: a la MVC) then the only solution is a rewrite, I think.

Resources