Control for Main Button Window

csharp Denmark
  • 14 years ago

    Hello I have a issue to discuss that recently I have a made a C# program for Rental Car Management, although its very easy cause all it contained was SQL statements manipulating the data form database. The issues starts when I gather all the elements or functions and display them to be accessed by one Main window where I can access all the different elements of the programs. I am showing you the code for this part, My teacher says its bit complicated and he would have done it simpler and differently.
    I will appreciate any help comments to improve this.


    namespace CMS1 // The Main NameSpace which is used for referencing rest of the program.
    {
    class CMS
    {
    // Structure of the Form mad with Views FileSystem.
    Views.Form entry;
    string formSpec = @"<Form Text=Main BackColor = silver>
    <vertical>
    <horizontal>
    <Button Name='ManageEmployee'Width=170 Height=40 Font = Bold10 />
    <Button Name='ManageContract'Width=170 Height=40 Font = Bold10 />
    </horizontal>
    <vertical>
    <horizontal>
    <Button Name='ManageCustomer'Width=170 Height=40 Font = Bold10 />
    <Button Name='ManagePayment'Width=170 Height=40 Font = Bold10 />
    </horizontal>
    </vertical>
    <vertical>
    <horizontal>
    <Button Name='ManageCar'Width=170 Height=40 Font = Bold10 />
    <Button Name='ManageCarCatagories'Width=170 Height=40 Font = Bold10 />
    </horizontal>
    </vertical>
    <horizontal>
    <Space Width= 130 /><Button Name='Exit'/>
    </horizontal>
    </vertical>
    </form>";
    // a Method wich calls all other Programs from one single main.

    public void ActionPerformed( string c )
    {
    switch (c)
    {
    case "ManageCustomer":
    ManageCustomer m1= new ManageCustomer();
    m1.Go();
    break;
    case "ManageContract":
    ManageContract m2 = new ManageContract();
    m2.Go();
    break;
    case "ManageEmployee":
    ManageEmployee m3 = new ManageEmployee();
    m3.Go();
    break;
    case "ManagePayment":
    ManagePayment m4 = new ManagePayment();
    m4.Go();
    break;
    case "ManageCar":
    ManageCar m5 = new ManageCar();
    m5.Go();
    break;
    case"ManageCarCatagories":
    ManageCarCatagories m6 = new ManageCarCatagories();
    m6.Go();
    break;
    case "Exit":
    entry.CloseGUI();
    break;
    default:
    return;
    }
    }
    //This method calls the forms forward to be displayed.
    //every thing OK up til here, no problems, but all the problems start after this.

    public void Go()
    {
    entry = new Views.Form(formSpec);
    for( ; ; ) // he thinks this is not right!!!
    {
    string c = entry.GetControl();
    if (c==null) break;
    ActionPerformed(c);
    }
    entry.CloseGUI();
    }
    kind regards

    JG























































































Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“PHP is a minor evil perpetrated and created by incompetent amateurs, whereas Perl is a great and insidious evil perpetrated by skilled but perverted professionals.” - Jon Ribbens