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).
Related
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.
Reading the following (and skimming other areas of the site):
http://msdn.microsoft.com/library/windows/apps/br211361.aspx
It seems as though I have to re-write a program I've been writing in VC# 2010, to be able to put it on Windows Store. Is this true? Can I simply import my project into VC# 2013 and then put it out there? Is there a reason I shouldn't do that even if I could (i.e. it looks different than other Windows 8 apps and users will be off-put by it)?
If I can't import and release my project into Windows Store directly, and this is a little bit of a tangent, but, can I at least import it into Visual Studio 2013, and then begin rewriting/adding the parts I need to to be able to make it compatible with Windows Store? I've never used app stores before, so please be gentle.
In most cases, opening a VS2010 project in VS2013 is not a pain.
You can find 2 kind of apps in the Windows Store :
Modern UI apps (aka Metro)
Desktops Apps
If you want to create a Modern UI app you need to target the .Net 4.5 framework. To do so you need to upgrade to VS2013.
But most of your work will be to rewrite a huge part of your program as the modern UI is not compabible with WPF (and you will need to manage touch devices). Other assemblies also doesn't have all the features of the desktop ones, so you will probably have a little bit of work in that area too.
Here is a link that explain the process of publishing an app in the Windows Store : http://msdn.microsoft.com/en-us/library/windows/apps/jj657972.aspx
If you want to publish a desktop application it seems to me that you only need to provide an URL to download your package. Be careful it is not possible to submit that kind of app with a personal account, you need a company account to do so. You can find more information about that process on MSDN: http://msdn.microsoft.com/en-US/windows/desktop/dd535817
I would like to rewrite an application that currently works as a Windows GUI in C#. The problem is, it works well on Windows, but is not adapted for Mac and Linux because of GUI issues with Mono.
So my idea, was to continue with C# (needed because of an essential sub program that needs to run C# and cannot be ported) and try to rewrite it as a web application that any user on Windows, Mac or Linux could access easily and make it work.
It is also important that my application remains working "out-of-the-box" because it aims high accessibility.
I've looked for solutions like :
KayakHTTP but it does not support POST data ! (needed for a web GUI)
XSP2 from Mono and make an ASP.NET MVC web app, but will it really work with my web app to make an out-of-the-box application ?
Alternatively, do you have any other idea for me to have a C# web app working out of the box for the end users ? The only thing needed would be to install Mono on Mac and Linux.
Thank you very much for your help.
EDIT 1 : I realize that I have not explained all aspects correctly. In fact, there are 2 applications in my project :
The CORE application which is written in C# and is too big to be ported or rewritten and thus must use Mono for running on Mac and Linux
My GUI application using Windows Forms which is written in C# too and controls the CORE application
My goal is to convert my GUI application into a web app application so there's no more the Windows Forms GUI hassle on Mac and Linux.
Is it necessary for your core application to run on the client?
If NOT, then the best approach is to rewrite everything as a web (ASP.NET) application which is going to run on a Windows server. Users on all your target platforms will then access this app through a web browser.
If YES, then a web app is not a good idea. You really don't want to require a web server on your clients. You have two possibilities:
Take a look at the GUI toolkits available for mono and select one that is available on all your target platforms to avoid having different front ends for each of your platforms.
To ensure best user experience on all platforms you should choose the native GUI toolkit for each of the platforms and write a different front end for them: either using Mono or using a native development environment as long as your core application has an interface that can be accessed from it (e.g. command line or similar).
This is a duplicate question, but I don't have time to find the duplicate.
Briefly, the answer is: don't do this. You cannot translate a desktop application to a web application on a one to one basis: the two paradigms are too different.
I recommend instead refactoring your current application to remove all dependencies on the GUI. Then, write a totally new web application to meet the requirements, and have the web application call the code you refactored out of the desktop application.
Be aware of the big, hidden difference between the two platforms: the web application will be running on a server. It will be used by multiple users at the same time, and by multiple threads at the same time. While you are refactoring, be certain to note any code that would be sensitive to the difference. For instance, code that uses static member fields now could work in the desktop application because there is only one user at a time. In a web application, that static will be shared across all users and all threads.
This may not be what you had in mind.
I am trying to build a Windows 8 "metro-style" app that will operate as a "app killer". For those of you who have used Win8 (Tech Preview) you'll notice that once you open a metro-style app you cannot close it (without going into Task Manager and ending the process).
My challenge is that I cannot access 'System.Diagnostics.Process' from my metro-style app, nor do I know if there is an comparable alternative within the WinRT. I also thought of building a separate app that hosts a service for my metro app to interface with, but I'd like to do this with a single app.
Fundamentally, I am looking for a pattern for building Metro-style apps that leverage .NET 4.0 components, specifically to be able to enumerate and kill other processes running on the PC.
CLARIFICATION: I am less concerned with this specific application than I am with access that type of .NET functionality within a Metro-style app
Thanks
To your specific question, this functionality is not available. Apps are not allowed to interact or interfere with other apps.
To answer your more general question, the APIs available to Metro style applications is limited compared to what is available to desktop applications. C# has a subset of the .Net library available, much like Silverlight does. The same is true for C++ where a subset of the desktop Win32/COM APIs are available.
From what I understand (watching Build2011 videos) a Metro App won't be able to do that...
Interaction between processes is severally limited to specific Contracts (the charms on the right: Search, Send-to).
Think Phone, not Desktop.
You might be able to build a non-Metro Win8 app though.
Don't waste too much time on this. I expect that in a beta a close option (perhaps even a charm) will be included. Until then use a keyboard Alt-F4 or the Task Manager
C++:
Window::Current->CoreWindow->Close();
or
Window::Current->Close();
I haven't explored the difference between these two (more precisely, I don't know how CoreWindow differs from Current. I could assume though...
I'm using an Oracle VBox with Win8 on my Win7 machine to develop a C++ Metro App using VS 11. I used both of the above methods. I verified in Task Manager the app was not running on both Win8 and the Simulator.
I want to use windows 7 features like icon overlay, and thumbnail tasks but my question is that can i do it without using any other API on just my plain .net 3.5. i recently enabled jumplists on an application in my c#.net 3.5 using the Shell routine so can something like that be done for icon overlay and other windows 7 taskbar features.
And can old application like notepad which i am sure was made years ago use these new feaures?
I guess it depends on the meaning of "use". You get jumplists for free if you use the Common Files Dialog. If your app is WPF or MFC, you get some Windows 7 stuff in the latest version of those libraries (not 3.5). Failing that, you will need to either ask Windows directly (use an API) or use a library that isn't part of .NET 3.5 that will ask Windows for you. I recommend you use the Code Pack. One line of code for an overlay icon, for example. It also has non-visual Windows 7 features like Restart and Recovery, Power Awareness (.NET events when the machine goes on battery etc). It was last updated November 18th 2009 and I am expecting a new release any day now.
If you really don't want to use .NET wrapped taskbar functionalities,
you can try this link that calls overlay via PInvoke. For other W7 taskbar options you can check on the same site.
Anyway I suggest you to use the .NET managed API