Develop desktop apps using Xamarin for Windows and Mac OS? - xamarin

I want to develop desktop application for Windows and Mac OS. Can I use Xamarin for this?

Yes you can, but the support for Xamarin.Forms is not available right now for Xamarin.Mac. For Xamarin.UWP it is.
While using Xamarin.Mac, it is indeed using the Mono Framework, and you can develop on Xamarin Studio. The interfaces can be created either by code or with the Interface Builder on XCode. You can have more informations here : https://developer.xamarin.com/guides/mac/getting_started/

Xamarin.Forms has UWP and OSX (alpha) support. If you need WPF and/or GTK (to support also Linux), you can use something like Xwt (used by MonoDevleop) or Eto. Both allow you to choose which toolkit to use (i.e. Gtk backends can run on both Windows and Mac, or you use always the native backend, or Wpf on Windows and Gtk on Mac, etc.)

With Xamarin/Mono you can use the GTK# wrapper that comes with it to build cross platform Windows/OSx/Nix applications.
Just be aware that the UI will look less native on Windows and OSx.

Related

Xamarin iOS GUI

We've been developing a cross-platform app in Xamarin on Windows and now we are moving to make GUI for iOS counterpart.
If I'm understanding correctly we need to switch to Visual Studio for MAC, on a MAC machine, and continue our GUI development there.
Is it possible to develop everything on Windows and just publish an app on the MAC machine?
How do we include the logic and everything from the android app?
You can use Xamarin.Forms to develop UI for both Android and iOS.
But if its already native then you can still continue developing it in Windows.
For the build and testing you definitely need a MAC, if you don't want to use a VM then you can build it on the cloud using a https://www.macincloud.com/ or other party that uses the same service, and use a simulator on windows.
If its cross platform then I assume you're using a .NET Standard for the shared codebase. So there would be no problem using the same logic for both the Android and iOS.
It is up to you. Many apps will work by just publishing on the Mac. Of those many will have some artifacts that shouldn't be in the end version.
To simplify it is like asking whether you should publish the app without testing and fixing. In 99% no, but sometimes it may work.

Is there a way to convert Windows Desktop applications to Universal UWP and Vice Versa?

In Visual Studio I am trying to decide which type of application I should start with. I want to make it available to as many devices as I can.
If I make a Windows desktop application (.NET/WPF), I could convert it to a UWP but it only targets desktop applications, which is pointless device-wise.
But if I make a UWP, it would work with Microsoft devices, but not ones running a Windows older than Windows 10. A lot of people still use older versions of Windows, and I would rather make a Windows desktop application than limit the use to a specific version of Windows.
It would also be cool to be able to make it work on other devices like Android.
QUESTIONS: Is there a way to convert a Desktop application to a Universal UWP (with or without the code)? Is there a way to convert a Universal UWP to a Desktop application (or make it run on older Windows machines)? If not, what would be the best application type and why?
Also, is there a different application type I should use instead that I'm not thinking of?
NOTE: Microsoft Project Centennial converts Desktop applications to UWP's, but they only work on desktop machines.
I would go UWP and use Xamarin forms if I were you.
Using Xamarin you can write the one UWP app and deploy to Windows, Android, and iOS.
You answered most of your question yourself already. You have the following options (considering you want to continue using your .NET/XAML skillset as you mention WPF and are not looking into a web alternative):
Write a desktop app in WPF: you want to support Windows 7 or need features that are currently not available yet in UWP (some APIs, sandboxed UWP, ..). As you mentioned, you can use the Desktop Bridge to bring the app to the Windows 10 store as well with the downside of not running on mobile, HoloLens, Xbox (as of today). Then again, WPF doesn't run on those platforms either.
Write the app from scratch in UWP: run on Windows 10 on all available platforms. Yes, you will leave the Windows 7 users in the cold but not that Windows 7 is already in the extended support block so people will have to upgrade at some point.
Write the app from scratch with Xamarin.Forms, creating a single app that runs on Windows 7 (WPF), UWP, Android and iOS. Note that this is a somewhat different XAML dialect right now, but XAML Standard is working on unifying the dialects in the future.
A bit more work is to share most of your code with .NET Standard or PCL libraries and write multiple native UI's on top of it (which can be done with Xamarin).
If you're looking for longer term support pick either UWP (the way forward for Windows) or Xamarin.Forms.
Try Microsoft's Desktop Bridge tool for UWP. Using the Desktop Bridge, you can gradually migrate your code to the Universal Windows Platform (UWP) to reach every Windows 10 device, including phones, Xbox One, and HoloLens
Using Desktop bridge tool, you can
Convert MSI to APPX package
Upload your Desktop app (after conversion to APPX package) to Store
Take advantage of UWP features like Live tiles, Push Notification and many more)
And, for Android and iOS app try Xamarin. UWP project cannot converted to xamarin project. You've to write seperate project. I recommend you to try Xamarin.Forms which allows you to boild UWP, Android and iOS app with shared code.

Is it possible to develop a desktop application, which will be supported in both Mac and Windows, using Xamarin in Visual Studio?

Our team would like to develop an application in Visual studio and Xamarin. The app needs to be supported in both Mac and Windows. We prefer Xamarin because the back end code can be shared. If possible, how to build and publish it so that it can be only installed in the machines. We are not planning to submit this app to the corresponding app stores.
You can write and Windows Application with C# using WinForms, WPF, WinRT (Windows Store apps).
Also you can write Mac application with C# using Xamarin.Mac.
To share the code between Windows App and Mac App, you just need to split your code into shareable Business Logic (part) and specific UI part.
To share the code, just use PCL libraries.
Yes.
The core business logic can be written in shared code usable on both platforms.
You have a couple of choices of how to develop the UI. You can use native or Xamarin Forms.
If you use native then I would suggest using the MVVM pattern with a framework like MvvmCross. You can then write the bulk of your app in shared code and just write the UI in platform-specific code, with the windows UI written as a standard windows WPF or UWP app, and the Mac app written using Xamarin.Mac using the native Mac API.
If you want to use Forms then you may have to compile the binaries yourself to get Mac support as it won't be available till roughly May 2017, but you could get started building a Forms app for UWP/Windows now and add the Mac project once it is available.

Does Xamarin Monotouch run on Microsoft Windows Phone mobile?

Need to program a GUI for iOS, Android, and Microsoft Windows Phone devices (Windows Phone 7/8).
Does same program written in Xamarin Monotouch C# run on all three platforms?
To elaborate a bit on #choper answer...
Xamarin.iOS (formally MonoTouch) gives you the tools and the API/SDK required to write .NET applications that will run on iOS devices (or the simulator);
Xamarin.Android (formally Mono for Android) gives you the tools and the API/SDK required to write .NET applications that will run on Android devices (or the emulators);
Xamarin.Mac gives you the tools and the API/SDK required to write .NET applications that will run on OSX computers;
All products are based on the open source Mono project. They all provide addins to work with the Xamarin Studio IDE (and optionally XI and XA can work inside Visual Studio, see note).
So the same product won't allow you to write once, run everywhere. However they will let you share a great deal of logic code (often beyond 80%) between the Xamarin-supported platforms and others .NET platforms (Windows, Windows Phone...). Some design patterns (MVC, MVVM) and libraries (e.g. MVVMCross) can help you maximize code sharing - but they are optional (i.e. you can roll your own).
You'll still need to write some user interface code for each specific platform - but that gives you the ability to provide a native, high quality user experience on each platform, without rewriting the application everytime (e.g. ObjC on iOS/Mac, Java on Android and C# on Windows/Windows Phone).
note: A Mac is still required to build/debug iOS applications from Visual Studio.
No, it isn't. It will run only on iOS and also like Xamarin.Android/Monodroid will run only on Android

How can I create C# desktop application with XCode for Mac OS?

Is there any other solutions to create desktop application for Mac with C#?
If you want to use C#, you can use mono to develop WinForms applications.
Mono is what you need, either use their IDE or there also seems to be a plugin for XCode

Resources