Beginner question here, I'm learning to code and have been working with C# for a few weeks.
Now I am trying out with Windows.Forms and so far I haven't been sure on what kind of solution I am suppose to load. I am using a Mac and Tamarin Studio. Xamarin only offers Xamarin.Forms but I'm not sure about that.
Any helping hands out there ?
Xamarin Studio is only for cross platform app development. Meaning you can code in C# your Android and iOS app. At most, you can develop a Console project but that's about it.
Xamarin.Forms is not to be confused with Windows Forms (WinForms).
Xamarins.Forms Xamarin.Forms is a cross-platform UI toolkit that allows developers to easily create native user interface layouts that can be shared across Android, iOS, and Windows Phone. (Source)
WindowsForms Windows Forms (WinForms) is a graphical (GUI) class library included as a part of Microsoft .NET Framework, providing a platform to write rich client applications for desktop, laptop, and tablet PCs. (Source)
So to answer your question, if you want to build a Windows App using Windows Forms (though I would recommend using WPF as it's more modern), you will need to do that on Windows using either Visual Studio or another compatible IDE.
Related
I've developed a WinForms application with C# in Visual Studio on Windows and I need a version for macOS but I don't know which way is the best.
I also have a Mac machine so don't have problems about the compiler: I already used VS2017 with integrated Xamarin to develop an iOS app using my mac as the required build server but didn't find any such method for developing a Mac desktop application. NET core only works with console application and even Visual Studio for Mac is different from Visual Studio for Windows and doesn't provide any visual designer. Am I forced to redo the whole application using an Apple product?
There are multiple solutions to building desktop apps targeting a Mac using .NET.
Mono is an alternative implementation of the .NET Framework that reimplements the underlying Windows API calls that Win Forms makes. It's probably the most straightfoward way to port an existing Win Forms app to Mac.
ElectronNET is a combination of Electron and .NET. Electron provides a desktop development framework combining a Chromium rendering engine with NodeJS. It's best if you have a lot of familiarity with web development. It's notable that major companies that want to build cross platform apps are using Electron (Visual Studio Code, Slack, Atom etc) so those with the time to invest in researching how to do a cross platform app seem to choose this option.
Avalonia is a .NET desktop framework that is inspired by WPF, but it's cross platform.
So no, you aren't forced to redo your application. Hopefully you've done a good job of separating UI logic from business logic, which will make using one of these other technologies easier.
Note that even though .NET Core 3 (which is cross platform) has support for Win Forms and WPF, that functionality will only be working on Windows. Win Forms still depends on the underlying Windows APIs, and WPF still depends on DirectX.
I have a complex Android app which now needs to run on UWP.
I figured that I'll have to re-write and re-design most of it but I'm wondering if there's any way whatsoever that I can at least port some of it into .NET so that I have a starting point?
Microsoft has been working on converting Android and iOS to UWP directly just like Desktop Bridge. And currently Windows Bridge for iOS has been used. It is a Microsoft open-source project that provides an Objective-C development environment for Visual Studio and support for iOS APIs. You could refer Move from iOS to UWP for more detail. And Microsoft also provide Windows Bridge for Android. However, it has not finished.
I have VS 2015 Community Edition and installed Xamarin to create Android applications, I installed Android SDK and emulators and setup them, I have 2 questions:
Do I have to start a device in emulator first and then debug the android application in VS 2015?
For form and controls to add to android application have to use the Xamarin forms or where can I find any 3rd party controls, I have SyncFusion community package are there any controls for Xamarin?
Thank you
1.) No. You don't need to start the emulator first. If there is not emulator running, VS will start the current selected Emulator.
2.) Xamarin.Forms and Android/iOS/WinPhone projects are different approaches.
When you make a Xamarin.Forms app, then you create one UI and customize it for every platform (e.g. padding to the top edge). So you share the UI AND yor cross plattform code (e.g. custom datat service like fetching feeds/database entries/...).
An Crossplattform App (New Project -> Visual C# -> Crossplatform -> Blank App (Native Portable)) is meant to create a project for each platform and create your UI for each target. Additionally (like the Xamarin.Forms) you can share your buisness code across them as a PCL (portable class libary). So if you have to request some data from a webservice then you can implement them in the PCL and access it from your Android, WinPhone and iOS app.
In Xamarin.Forms you can design your own custom controls by just inheriting from a existing control and making a renderer for each platform by yourselfe or try the Xamarin Component Store.
In the cross platform approach you can/have to design them on each platform by yourselfe.
In Xamarin.Forms you have
One UI for multiple platforms
Portion of Code you can shar increases
The UI looks absolutly native
BUT:
You can only use the least common denominator (things that are possible unter Android can't be used under Android since iOS and WinPhone don't support them
sometimes the UI does not work as it is intended
When you create your app with the Crossplatform approach:
You have the full control about the things and how they work in each device
BUT:
You have to have knowledge about the application life time and how the OS really works.
Take a look at the developer page of xamarin: Xamarin.Forms
Xamarin.Forms is best for:
- Data entry apps
- Prototypes and proofs-of-concept
- Apps that require little platform-specific functionality
- Apps where code sharing is more important than custom UI
Xamarin.iOS & Xamarin.Android are best for:
- Apps that require specialized interactions
- Apps with highly polished design
- Apps that use many platform-specific APIs
- Apps where custom UI is more important than code sharing
I'm writing a universal app by using windows 10, visual studio 2015 and C#. I would like to run this app on windows, Linux and mac. I know mono doesn't implements windows presentation framework, so, if I write a WPF app it runs onluy on windows. Now, if I write a universal app, can mono run that? If yes, how?
The holy grail .Net UI question :-)
TL;DR Answer = No.
Universal Windows Platform (UWP) core APIs (also known as Windows Runtime / WinRT) and the resulting APPX based applications only target Windows 10 platforms (Phone, PC, Tablet...) as those APIs and runtime do not exist on the other desktops.
Using Xamarin/Mono you could reuse a portion of the C# app's 'business' level logic but the presentation layer and GUI logic would have to be re-written using a different GUI (Native Widgets, GTK#, QTSharp, HTML/CSS/NodeJs, etc...). Same model that people have been using Xamarin for C# based mobile development applies, share your C# app logic across platforms and use Xamarin.Mac to build a native OS-X UI, and/or build a UI using GTK#, embed your app's runtime logic into a Electron/Blink shell, etc..
Currently the Windows 10 for Apache Cordova project which is HTML, JavaScript, and CSS, only targets Mobile (WinPhone, iOS, Android) and Windows 10 PC/Tablet platforms. That is not to say someone could not develop a new Cordova target to include OS-X and Linux desktop manager support (but I do not know of any that have not already stalled) :-/
Even Microsoft's xplat-based Visual Studio Code for Linux and OS-X uses Electron (Chromium based) to deploy the io.js based application along with the Blink layout engine to render the UI, all done in HTML/CSS/JS.
Can a Android Hybrid App with some plugins written in Java and others imported from Cordova, be made windows phone complaint using Xamarin ?
Is there any such feature in VS 2015 from which conversion of android app to windows be made possible without much rework. Please help.
No. Xamarin will not allow you to automatically convert an app from one platform to another.
Microsoft has announced Project Astoria as part of Windows 10. This will enable Android apps to run as Windows Universal apps.
Can a Android Hybrid App with some plugins written in Java and others
imported from Cordova, be made windows phone complaint using Xamarin ?
No you cannot.
There are two ways to port Java code to C#.
The first way is to port the code manually.
The second porting methodology is to try and automate the process by using a code converter.