I have a GUI windows form app written in .NET .
And I have a new .NET UWP app that has UWP camera and UWP sockets.
Can I port the UWP camera and UWP sockets code into the .NET Windows form app project?
(If I went the other way, it probably will take much longer to port the Windows forms GUI into a UWP GUI.)
WinForm project can use most new Windows 10 API designed for UWP. Check this post.
If went the other way, you need to port bit by bit of the existing GUI, so it all depends how complex your WinForm GUI is.
The first challenge is you are using XAML, another language instead of C# to write UWP UI.
Some WinForm controls you are using just do not have a UWP counterpart, you need to turn to the community to check if there are alternatives that are freely available l, or purchase proprietary product, or write your own control.
No. WinForm and UWP projects are very different. UWP are compiled to native code and WinForm are compiled to IL that are then run by the CLR. Microsoft is currently working on the ability to put a UWP control inside a WinForm application. You can check it out here.
Related
This question already has answers here:
Porting WinForms Application to Mac OS
(2 answers)
Closed 2 years ago.
I'm just new in C# Windows Form. Now I have a project that Uploads a txt file and output into a PDF file. Now I need to use C# windows form for this but I'm just curious if I develop this using C# Windows form will I be able to install the application on a MacOS environment and use it as how I can use it on windows? Are there any consideration needed? Like do I need to install a certain package just to make it work in Mac or vice versa?
I'm just new in C# Windows Form.
Hi!
Now I have a project that Uploads a txt file and output into a PDF file.
Go on...
Now I need to use C# windows form for this
No, you don't need to use WinForms to simply upload a text file and download a PDF.
but I'm just curious if I develop this using C# Windows form will I be able to install the application on a MacOS environment and use it as how I can use it on windows?
No, you cannot. WinForms is tightly coupled to the Microsoft Windows operating-system (the biggest clue is in the name: Windows Forms. WinForms' is a thin wrapper around Windows' default windowed controls and widgets (also called User32 and Common Controls) as well as OLE, COM + ActiveX, and other Windows-centric APIs.
There are attempts to make a subset of WinForms work on other operating systems, but because WinForms is not natively cross-platform you won't have things like support for macOS's main menu and your users will be able to tell that your program doesn't look and feel like a native program.
Are there any consideration needed? Like do I need to install a certain package just to make it work in Mac or vice versa?
No, it won't work.
Alternative Approaches:
Make your application using WinForms System.Windows.Forms and make it available to macOS users through some form of application remoting:
Run it on a Windows box accessed using macOS' Remote Desktop app.
Run it on a Windows box accessed using a browser-based RDP gateway.
Run it in a Windows virtual-machine running on an Apple Mac (Parallels Fusion, VirtualBox, etc).
Using only natively supported cross-platform features in .NET Core:
Make your application with a built-in http://localhost ASP.NET web-server that hosts a GUI web-application accessed with a web-browser that interacts with the rest of your application code.
Make a command-line only application.
Make a text-mode GUI application using a library like ncurses for .NET.
Make a platform-specific GUI while still sharing the rest of your application code (e.g. using Xamarin to use Cocoa from .NET, use WinForms or WPF on Windows, GTK# for Linux/BSD, etc).
I have an app developed for windows 10 on C# and now I want to move to IOS and Android. I have heard of xamarin and used some of there stuff in C# but would it be possible to embed the C# code and move it to apple xcode without having to redevelop the app from again?
would it be possible to embed the C# code and move it to apple xcode without having to redevelop the app from again?
No, it is not possible. Basically you can share some UIs across different platforms, but I think redevelop your app for each platform is necessary.
Not sure if you want to use Xamarin.Android and Xamarin.iOS or Xamarin.Forms to develop your app, you can use C# for development by using Xamarin, it provides a cross-platform implementation of the extensive features in .Net framework, but the actual implementation on each system is very different. For more information, you can refer to Understanding the Xamarin Mobile Platform.
For Xamarin.Android and Xamarin.iOS, you can refer to Android Architecture and iOS Architecture.
For Xamarin.Forms, you can have your UIs and some basic features designed in the PCL in order to share across different platforms, but for most features just for example like working with files, we need to access the native method of each platform, therefor, Xamarin.Forms provides a locator named DependencyService to achieve this.
Is there any future of winform and wpf app in smart phone or tablet market. will we be able to develop applications for window store on winform or wpf. Or are they a dead technology
Thanks
I don't think they will be dead so soon. may be yes for Winforms. but still there are tons of applications that are running on Winforms and even on consoles.
you can use XAML for smart phones as well as tables. even WinRT supports XAML. also there are new libraries out there you can write programs targeting multiple platforms such as Portable Class Library
The new standard for building desktop applications is WPF. This is currently not deprecated and will not be for the foreseeable future. When developing for Windows phones and tablets there is an API very similar to WPF in structure/feel (using XAML).
Summary:
I want the prettiness of Silverlight/WPF in part of my current Winforms application. The application can only have access to the full .NET Framework 2.0, no more and no less. The only possibility I can think of is a Silverlight OOB application that utilizes Com+ Automation but I can't figure out how to attach the Silverlight application to a panel within the parent Winforms application.
Details:
I currently have a winforms application, and want to take advantage of the improved GUI features in WPF but to many of my users are still running .Net Framework 2.0 and refuse to update to 3+. So WPF is not an option for me.
I know Silverlight is just a subset of WPF, but it has most of the features I'm looking for and only requires the Silverlight plug-in. I've read about Silverlight 4's Com+ Automation, which would give me access to the full desktop .Net Framework 2.0 (which I need). In order for Com+ Automation to work in Silverlight I need elevated trust and the only way I can find to gain elevated trust is to make my Silverlight application Out-Of-Browser (OOB).
My problem is that the OOB application seems to run in its own container window and I need the Silverlight application embedded inside a panel in my Winforms application. My Winforms application does not need to communicate with the Silverlight application and vice-versa, this is purely to have everything contained and displayed in one window.
If there is another way to get my desired result that I have not thought of feel free to suggest it.
The best option is to host the Silverlight content within a WebBrowser Control. This will allow your Silverlight content to run "inside" your windows forms application.
The COM automation won't help for embedded silverlight INTO a Windows Forms application. It's really intended for using COM from within Silverlight, not the other way around.
I'm thinking of developing a desktop app in C#. Although windows will be my main target, later I'll try and run the app in MacOS X and linux. Can I do this today, in a simple way?
I'm aware of the mono project, but it is not clear to me if I can do this in a simple way.
Also, what is the relation between WPF and Silverlight? AFAIK Silverlight follows a plugin model much like Flash or Java. Can I develop my desktop app with Silverlight and deploy it on windows, linux and os x without much changes?
Any pointers will be greatly appreciated.
The Mono project does not support .Net 3 and WPF yet, and it will probably been some time before that happens.
Silverlight might be sufficient for your needs.
As of Silverlight 3.0 you can run Silverlight outside the browser, even create a shortcut to it on the desktop.
Last I heard, the Mono project has no plans to implement WPF, however they are working on other .NET 3.5 features, especially LINQ and ASP.NET MVC. The problem with implementing WPF in Mono (beyond the size and complexity of the API) is that on Windows it uses DirectX for rendering, so an implementation for Mono would need to use OpenGL. Definitely not a trivial undertaking.
WPF is used to build desktop applications for Windows only. Currently no other platforms are supported. If cross-platform support is a must, you can create a browser-based application and use Silverlight. Silverlight runs applications in the browser, though, so you cannot make a "desktop" application using that.
Mono is working hard to make sure that Silverlight runs cross platform (as mentioned on one of the stack overflow podcasts). So that seems to be a good way to go.