Building a Pos Terminal Simulation with C# MVP (ModelViewPresenter) RRS feed

  • Question

  • Hi,

    I have 4 buttons. Btn1, Btn2, Btn3 and Btn4. Also I have some arrays as it shown below and 1 combo-box.

    1. ArrayMain() = {“1.Water”,”2.Air”,”3.Soil”,”4.Fire”}

    1.1.   ArrayWater() = {“1.Salty”,”2.Fresh”, “3.Contaminated”}

    1.1.1.ArraySalty() = {1.”AA”, 2.”BB”, 3.”CC”}

    1.1.2.ArrayFresh() = {1.”DD”, 2.”EE”, 3.”FF”}

    1.1.3.ArrayWaterContaminated() = {1.”XX”, 2.”YY”, 3.”ZZ”}                                   

    1.2   ArrayAir() = {“1.Fresh”, “2.Contaminated”}

    1.3   ArraySoil() = {“1.Normal”, “2.Contaminated”}

    1.4   ArrayFire() = {“1.Low”,”2.Mid”,”3.High”}

    When my app starts, first array values 1.(ArrayMain) fills the comboBox.This comboBox will have (4 values as;)  “1.Water”, ”2.Air”, ”3.Soil”, ”4.Fire” values in it.

    If user choose “1.Water” than user clicks Btn1. Than Btn1 events clears the comboBox and loads 1.1ArrayWater() values into comboBox.

    Second time if user chooses “1.Salty” than user clicks again Btn1 and this time Btn1 events clears the comboBox and loads 1.1.1ArraySalty() values into comboBox.

    Third time if user chooses “2.BB” than user clicks Btn2 and sends the information “BB” for calculation.

    Now I want to build this demo app in C# and it must use Context/Interface (or MVP- ModelViewPresenter) type and avoids multiple if/else statement as well as multiple panel control on main form.

    Like (ingenico) pos terminal. First you have 5 (more or less) menu item and each time you press any (number) buttons (1 to 9 lilke in pos terminal) than new menu appears on the screen.

    I thank you for reading my post.

    Kind Regards,





    Wednesday, April 29, 2015 7:23 AM


  • Thank you all, I made it. Most of the credit goes to Eugene Podskal who help me to find best logic, with minimum of code. And this is my few cent contribution for C# world. Here it is: http://stackoverflow.com/questions/29941997/how-to-set-same-button-events-for-listbox-value-index-or-treeview-nodes/29951624#29951624
    • Marked as answer by GC2006 Wednesday, April 29, 2015 6:34 PM
    Wednesday, April 29, 2015 6:34 PM