コード例 #1
0
        /// <todo>
        /// Implement code for file manager
        /// </todo>
        public VendingMachine()
        {
            //Initialize classes
            /////////////////////////////////////
            //Initialize Slot lists
            AvailableSlots = new List <Slot>();
            FinishedSlots  = new List <Slot>();
            BusySlots      = new List <Slot>();
            OverdueSlots   = new List <Slot>();

            m_Slot = new Slot[NumSlots];
            for (int i = 0; i < NumSlots; i++)
            {
                m_Slot[i] = new Slot(i + 1);
                //For now assume all slots are available till FileManager class is implemented.
                AvailableSlots.Add(m_Slot[i]);
                // Console.WriteLine("Slot ID " + i + "  " + AvailableSlots.ElementAt(i).getID());
            }
            m_ChangeDispenser = new ChangeDispenser();
            m_FileManager     = new FileManager();
            m_MoneyMachine    = new MoneyMachine();
            m_Printer         = new Printer();

            //Other members
            ChargingOrRetrieving = e_ChargingOrRetrieving.CHARGING;
            CurrentUIstage       = e_CurrentUIstage.START_STAGE;
            CurrentUIstageState  = e_CurrentUIstageState.WAITING_FOR_INPUT;

            MoneyCharged  = 0;
            MoneyReceived = 0;
            DateAndTime   = new DateTime();
        }
コード例 #2
0
        public void ChargeRetrieveEvent(object sender, QikTop.ChargeRetrieveEventArgs e)
        {
            QikTop             QikTopForm     = sender as QikTop;
            NextStageEventArgs nextStageEvent = new NextStageEventArgs();
            EventHandler <NextStageEventArgs> GoToNextHandler = gotoNextStage;

            if (GoToNextHandler == null)
            {
                return;     //error
            }
            CurrentUIstageState           = e_CurrentUIstageState.USER_SELECTED;
            nextStageEvent.UI_Stage_State = CurrentUIstageState;
            nextStageEvent.UI_Stage       = CurrentUIstage;
            // GoToNextHandler(this, nextStageEvent);
            //log Status
            //Check that current STAGE is the slot selection STAGE

            if (CurrentUIstage == e_CurrentUIstage.START_STAGE)
            {
                ChargingOrRetrieving = e.ChargeRetrieve;
                CurrentUIstageState  = e_CurrentUIstageState.PROCESSING_INPUT;
                //log Status
                nextStageEvent.UI_Stage_State = CurrentUIstageState;
                nextStageEvent.UI_Stage       = CurrentUIstage;
                GoToNextHandler(this, nextStageEvent);
                //Check that the current mode is charging
                // QikTopForm.gotoSlotSelection();
                CurrentUIstage      = e_CurrentUIstage.SLOT_SELECTION_STAGE;
                CurrentUIstageState = e_CurrentUIstageState.WAITING_FOR_INPUT;
                //log Status
                nextStageEvent.UI_Stage_State = CurrentUIstageState;
                nextStageEvent.UI_Stage       = CurrentUIstage;
                GoToNextHandler(this, nextStageEvent);
            }
            else
            {
                //post error
            }
        }