예제 #1
0
        /*
         * The constructor for CoffeeMachineForm
         *
         * myCoffeeMachine: a reference to the main program for calling
         *  logic methods
         */
        public CoffeeMachineForm(CoffeeMachine myCoffeeMachine)
        {
            InitializeComponent();
            CoffeeMachineForm.myCoffeeMachine = myCoffeeMachine;

            // To get the values alone, the Drinks
            drinkCollection = myCoffeeMachine.DrinkList.Values;

            //Run through all the drinks and add their names to the combo box
            foreach (Drink drink in drinkCollection)
            {
                comboBoxDrinkList.Items.Add(drink.DrinkName);
            }

            //Set the default drink (on startup) to index 0 (Water in this case)
            comboBoxDrinkList.SelectedIndex = 0;

            //Sets up a ToolTip so I could test out how they work
            paymentToolTip = new System.Windows.Forms.ToolTip();
        }
예제 #2
0
        static void Main()
        {
            myCoffeeMachine = new CoffeeMachine();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            myCoffeeMachineForm = new CoffeeMachineForm(myCoffeeMachine);
            Application.Run(myCoffeeMachineForm);
        }