Console BarMenu - 3 | |
. | |
(DOS era text-mode style Colorful Bar-Menu in c#) | |
Version: 170714Fr | |
. | |
During the era of DOS 3, creating a bar menu in text or graphic mode was a
cutting-edge topic in programming. I vividly remember writing a ".prg" program
in dBase III Plus on my institute's PC, which impressed my friends, lab
assistants, and teachers. That program was my first attempt at creating a bar
menu, and I'm proud to say it was a success. Although I'm not sure if the
printout of that program still exists in my archives, I'm not eager to find out
also. In memory of that bar menu, I've now recreated that bar menu as a Console
project in C#.
| |
. | |
Salient features of above mentioned c# project are as follows: | |
(A) Display bar-menu. | |
(B) Provide menu-item selection mechanism through navigation keys like Up-arrow, Down-arrow, Home, End and Enter keys. | |
(C) Process menu-item selection and perform action accordingly. | |
(D) Return back to menu at end of action processed. | |
(E) Provide mechanism for exiting from 'bar-menu' and application. | |
. | |
Then I tried and made the above required project. Code for achieving above task is simple and is described as follows. | |
(1) First menu processing method is called. There must be one such method per menu. | |
(2) Then from menu processing method menu-driver method is called with information like menu-item-list etc. | |
(3) Then in menu-driver things happen in following sequence: | |
(3a) First menu is displayed. | |
(3b) Then user-input is taken. | |
(3c) Then user-input is processed based on input key as follows: | |
(3c1) Navigation key: Selected menuitem index is updated. | |
(3c2) Enter key: Current menuitem index is selected for returning. | |
(3c3) Escape key: Menu exit code is selected for returning. | |
(3c4) If user input is not Escape-Key or Enter-Key go back to step 3a. | |
(3c5) Menu-driver exits when user-input is Escape-Key or Enter-Key. | |
(4) Back in menu processing method returned value is processed as follows: | |
(4a) Respective methods are called according to returned value. On return control goes back to step 2. | |
(4b) Else menu exits when selection code is Escape-Key. | |
. | |
Keys used by menu are displayed in menu footer and are described in the following: | |
Navigation: | |
Down-arrow key for next menuitem. | |
Up-arrow key for previous menuitem. | |
Home key for First menuitem. | |
End key for last menuitem. | |
Selection: | |
Ente key for selecting current menuitem. | |
Exit: | |
Escape key for exiting menu. | |
. | |
Following is the C# code of the project I described above. It is not so simple or easy to understand. But it is full of helpful comments throughout it. | |
. | |
. | |
Code of "Console BarMenu - 3" in Visual C# 2010 | |
| |
. | |
. | |
Application Output | |
Following are some screen-shots of the application I took at different state of application to explain the application's look and feel. | |
. | |
Application is loaded | |
(When Application is loaded.) | |
. | |
. | |
Application Menu bar navigation | |
(When selection bar is on first menu-item) | |
. | |
(When selection bar is on last menu-item) | |
. | |
(When selection bar is on some other menu-item) | |
. | |
.
| |
Application Menu item selected | |
When menu's any selection bar is selected by pressing ENTER key and application is moved to the respective section. | |
. | |
(When 'Grains and cereals' menu-item is selected and respective method is run) | |
. | |
(When 'Vegetables' menu-item is selected and respective method is run) | |
. | |
(When 'Bakery & Confectionery Products' menu-item is selected and respective method is run) | |
. | |
. | |
Method which displays message based on menu selection, randomly selects background for console screen from a few dark ConsoleColors making display a little colorful. | |
. | |
. | |
A brief overview of Console application: | |
In the context of C#, a Console Application is a type of program that interacts with users through the command-line interface. This type of application reads input from the user through the standard input stream (STDIN), processes the input, and then displays output to the user through the standard output stream (STDOUT). Additionally, any error messages or exceptions are directed to the standard error stream (STDERR). Console Applications are commonly used for tasks that require user input, such as command-line tools, utilities, and interactive programs. They provide a simple and efficient way to interact with the user, making them a fundamental part of the C# programming landscape. | |
. | |
. | |
If there are any mistakes then I will surely remove them whenever found. | |
. | |
. | |
Enjoy Complete Source code of application written and compiled in visual studio 2010 Ultimate by me. Download it. Extract it. Read 'ReadMeFirst.txt' file and do as is explained in it. | |
. |
Saturday, July 15, 2017
console barmenu -3- c sharp - 170714Fr
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment