I have an winForms application fully written in VB.NET. I have to start importing this application into WPF written C#. For the starting, I want to do this only for one module of the application. Is there any way I can pass VB.NET objects to a C# code, call a WPF application from a WinForms application and vice-versa ?
How should I approach this problem? Any help would be appreciated.
There is no easy way to migrate winform applications to Wpf.
You should carefully consider the reasons why would you like to do it and the effort it will take vs the profit.
that being said you can start by hosting your winform by a wpf application using WindowsFormHost then you can start by rewriting your controls one at a time and using ElementHost to host them in the winform.
Since you would like your application to be robust and use MVVM I personally think that it will take too much effort to migrate and it will be more reasonable to rewrite the application using already existing modules(logic not ui modules)
Regarding using Vb.net object in c# it can be done easily because they are both managed languages and are being compiled to CIL:
During compilation of CLI programming languages, the source code is
translated into CIL code rather than platform or processor-specific
object code. CIL is a CPU- and platform-independent instruction set
that can be executed in any environment supporting the Common Language
Infrastructure, such as the .NET runtime on Windows
Yes u can call wpf application in windows and vice-versa.For that u have to configure in .config file
In Through ElementHost u can access the controls
Related
I am writing my first vb.net application ( But I will tag c# here as well, as I am sure even a c# person can answer this with the similar .net implementation).
Short Description of my Applicaiton:
My desktop application will run on win platform only, using vb.net, it is a simple internet cafe management software, with a server gui running on server, and a client gui running on workstations, both communicating with TCP/IP to allocate time to customers, and the server storing some data in either xml files ( for human operators login info e.g) or in a small database. Nothing complicated.
What I would like to do:
I'd like to have a "sexy" look, i.e. either silverlight look or win7 phone look, yet this is a desktop application. I'd like to use CSS but its entirely optional, if there is a simple way to have my controls look like below without CSS thats fine with me.
What I have tried
I have looked into just doing a silverlight out of browser app, but as I am new to .net, and even though I have read up as many articles about using silverlight5 out of browser, I don't want to be caught down the road when I want to implement a feature and realize "Oh silverlight out of box doesnt support that".
So my question is , how do I implement one of the new looks in the picture in my desktop vb app?
You should look at using WPF for your application instead of using WinForms.
WPF (Windows Presentation Foundations) is a platform which works same way as silverlight but on desktop (as far as you need to be aware now.) Silverlight is a cut down version of WPF so WPF will give you a lot more controls and a lot more control over the program.
WPF uses XAML to draw up the UI and it holds the code in the source code file associated to the xaml file. If you have experience using Silverlight you should easily be able to make programs with WPF.
WPF is really powerful and gives you access to all the styling that is possible on Silverlight. WinForms is more so restricted which makes it harder to abandon the consistent Windows look and make your own intuitive and innovative UI.
Hope it helps!
Here are some tutorials if you are interested:
WPF Tutorials
Here is an example WPF desktop app (exact same look as achievable with Silverlight)
You can use wpf with Mahapps Metro : http://mahapps.com/MahApps.Metro/
I have a terminal application written in C# which I run with mono.
Now, I would like to write a GUI for this application. How can I use buttons to pass commands to this application, and how can I receive output from the terminal window?
Is there any possible way to do this? and if, how?
Thank you very much.
I think it is possible, but if you have the source code for the application, you would be much better off incorporating that source code into your new application and providing a GUI directly rather than trying to work with the command interface.
Based on your reply to competent_tech what you want to do is create the GUI using MonoMac.
MonoMac, a new foundation for building Cocoa applications on OSX using Mono.
MonoMac is the result of years of experimentation in blending .NET with Objective-C and is inspired by the same design principles that we used for MonoTouch.
You can use MonoMac to publish applications to the Mac AppStore, to learn about this see the MonoMacPackager page.
What you are describing as a windows 95 looking window, is winforms which is the native .Net API for building GUI applications. With MonoMac you will be able to build a GUI application that uses your current applications source code and looks and feels just like a normal Mac application.
Again trying to call commands on your application is not an ideal way to go about this.
If you have a command line program that you cannot modify then you probably want to invoke it directly as a subprocess and capture it's text output.
You can then write whatever GUI you like (MonoMac/GTK#) to drive the app directly.
I'm rebuilding an Embedded application:
Prebuild application Specifications:
Use : For dispaying the captured images/video from microscope image capturing device on windows based PC or Laptops.
Sepcifications: Prebuild on .NET plateform using VC++
Flaws : Lacks some specified features.
Current Requirement:
Want to rebuild that entire application using C# and add some additional client features.
My Questions:
Is it feasible to develop such application in C#.net?
If yeh,What kind of resources available in C# to develop desktop embedded application?
Any references which show any of such kind of application?
Your suggestions on building this kind of application.
P.S. It is essential to buid it on .NET platform.
I think by "Prebuild" you mean "Existing". Why do you want to rewrite the complete application? As you have stated that the application is written in C++.Net. You can easily add all the new functions in C# and use that code from your existing C++.Net code.
Note: I'm making this answer CW because the question is hard on the limit towards some close reasons. Everyone feel free to edit and extend it.
Is it feasible to develop such application in C#.net?
That's a tough one...from the top of my head I'd argue that it doesn't matter. If you know C#, then build it in C#, if the client wants it in C#, then build it in C#. You'll most likely have to use COM-Components or API-Invokes anyway to accomplish this.
If it is a TWAIN device, you might be better of to stick with VC++, I found TWAIN on .NET a real pain in the a** and have given up on such features. Same goes for WIA, but that might just be me.
If yes, what kind of resources available in C# to develop desktop embedded application?
I guess you mean a Widget? In that case I have no idea, I never really looked at that (at least not on Windows). But as far as I know widgets on Windows consist of a data-backend and a HTML/JavaScript-Frontend, so you'll most likely have to develop the two separately.
Any references which show any of such kind of application?
I guess any WIA/TWAIN application would be a reference, at least your description sounds so.
Your suggestions on building this kind of application.
See your first question.
I have a VB 6 application and we are starting to port it over to C#. We have finished one of the screens and wanted to see if there was an incremental way of hosting the winform within VB to start to have the existing users get used to new screens. This is a migration strategy..
Any thoughts.
The Interop Forms Toolkit allows you to create .NET Forms and User Controls that can be used in VB 6.0 applications. This allows you to migrate VB 6.0 applications to .NET over time (a form or part of a form at a time). However, the toolkit relies on features from the Microsoft.VisualBasic assembly and the VB.NET compiler so it doesn't work with C#.
There are a couple articles/samples on CodeProject.com that discuss the toolkit and how to use it with C#.
Interop Forms Toolkit 2.0 Tutorial
VB6 - C# Interop Form Toolkit
Beth Massi has several articles and webcasts on the use of the Toolkit you can use for reference. Check out her blog for links to resources.
Have you looked at this? Direct Link to Product here
You do not need any third party tools out anything outside of what comes with Visual Studio if you mainly just want your VB6 program to cause a .NET Winform to be displayed.
The approach we have taken here is to expose a C# wrapper class to VB6 by giving it a COM interface. This class has a few methods which can be called from VB6. They, in turn, instantiate and then show the Winform. It works well.
I am responsible for the User Interface of an application written completely in Visual C++ using MFC and some third-part controls. I would like to use C# (WinForms or even better WPF) to improve the application look&feel.
I would like some advices about how to do it. Links, articles, examples...
Right now the user interface is isolated in a single project and I don't want to compile the whole module with CLR. So how do I have to manage that from the architectural point of view?
I have already looked at the Internet for the subject and read MSDN information. I would like more detailed information...is it convinient? pros/cons? have you used this approach successfully in a "big" application?
I don't want to compile the whole ui project with CLR...can I just have all the .NET code in a isolated project and call it from the ui project? what's the best way to do it?
Thanks in advance.
A good starting point is the Win32 and WPF interop page on MSDN.
I found this codeproject article gave a good introduction to the subject of mixing mfc / winforms code.
When faced with the same problem, I made an ActiveX control in C# and used it in my MFC app. The folks at MS took out support for building ActiveX controls with .NET, but it's still possible to do so with a plain Jane COM class which has a custom [ComRegisterFunction()] and [ComUnregisterFunction].
Although MS would like to tell us that the /clr flag will solve our problems, it measurably slowed down my large MFC app.