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.
Related
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
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 know that you can create a separate console application, however, I am in the final stages of testing and my application does not have an interface. Is there a way to simply open a console and interact with that inside the desktop application? This would be in a test method. (I am using C#, in Visual Studio 2008).
Thanks,
badPanda
You might be able to do what you want using AllocConsole (creates a new console) or AttachConsole (attaches to an existing console), but I think there are some limitations to what you can do with them.
See here for the API documentation for AllocConsole and here's the PInvoke page.
Here's a list of lots of Console functions, might be something else useful there too.
This may or may not be helpful, but some of the same techniques of GUI testing can be applied to a console app too, of course.
Here is an article and example code in C# for a user interface test.
Or there are totally different tools/languages that can be used for UI testing, such as AutoIt v3, which is easy to learn and apply. AutoIt does have a DLL/COM control that you can access from your preferred programming language (but I haven't used it that way so I can't comment on how well it works).
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.
I'm wondering if there are any useful (free) libraries out there to
help the development of Console applications.
Just a simple example:
What about a library that encapsulates all the behaviour to
select files in a console application (aka the OpenFileDialog for Console applications).
There's MonoCurses of course, but I'm wondering if there are others?
Thnx.
UPDATE:
I know you can simply use the OpenFileDialog of course. But I'm talking about pure console applications. No Windows Forms or WPF elements. Pure console only. (For example to run on a Linux system without a graphical user interface).
This is one Good code I have used for Parsing the Command Line Arguments while using the Console Application Command Line Parser