Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GUI application for command line program

Status
Not open for further replies.

abcfantasy

Programmer
Jun 3, 2006
110
0
0
DK
Hello, there is this command line application and I need to create a GUI application for it to simplify work and increase efficiency. The way I'm doing it is that the graphical application runs the command line program, sends all input to it and receives all output.

While building it however, I had to put a lot of dirty hacks to get around small issues, but now I am starting to doubt whether my approach is the best. This is what's happening:

My application sends input to the command line process and receives the output asynchronously. The output needs to be analyzed, because some will be displayed to the user, and some will be used internally by the GUI. Since the output is received asynchronously, it's very hard to keep track of which output is a response to which input. This is what can happen for example:

Input:
- Send a command to the command line program to get the list of variables.
- Send a command to output "Hello world"

Output:
1. varA
2. varB
3. Hello world
4. varC

As you can see one command's output can be mixed with another. I'm currently using a lot of dirty hacks as workarounds, but this is making my application not robust at all.

Doing the output synchronous might help, but due to the many inputs and outputs, I fear there will be few time intervals where it hangs.

Anyone can help me on this? I can give more information.
It will be much appreciated.
Andrew

|| ABC
 
Edit: Sorry for posting again. I'm doing all this in C#, I hope this is the right forum.

|| ABC
 
could you explain what you mean by
there is this command line application and I need to create a GUI application
if you are trying to create a .net GUI for a DOS or FP (not VFP) application then your GUI is simply one big hack. it would be no different than:
a windows app controlling a webpage
a webpage controlling a windows application
a webpage controlling a console app

you get the idea. You are using one user interface to control another. This is prone to alot of complications.

instead have the user interface (console, web, win) talk to a service layer that controls the business logic. this will greatly simplify the development process.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
Thanks for your reply.

Yes exactly, a .net gui for a dos application. I agree it is one big hack.

Could you elaborate on the service layer? Do you mean creating another layer that controls the communication between the gui and the dos application and do any processing there? I'm not too convinced about its benefits.

Thanks once again

Andrew
Research Assistant
 
no i mean the service layer is shared by the dos and windows application. here is an ascii diagram
[tt]
database -> business logic
|
+-> console interface
|
+-> windows gui interface
|
+-> web interface
[/tt]
the business logic, console, win and web would all be separate assemblies/executables. the human interfaces would reference the business logic assembly.
the console app and the windows app know nothing about each other.

this is one approach to layering, you still have the physical layout to consider.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top