示例#1
0
文件: Handler.cs 项目: KHIT93/CarWash
        /// <summary>
        /// Starts the Gold wash
        /// </summary>
        /// <param name="machineID">ID of the machine</param>
        /// <param name="progressObserver">The progressobserver used to update the progressbar></param>
        private void StartGoldWash(int machineID, IProgress <WashProgress> progressObserver)
        {
            CarWashMachine  machine = CreateMachineIfNotExist(machineID);
            GoldWashHandler handler = new GoldWashHandler();

            handler.WashCarGold(machineID, progressObserver);
            machine.WashHandler = handler;
        }
示例#2
0
文件: Handler.cs 项目: KHIT93/CarWash
        /// <summary>
        /// Starts the standard wash
        /// </summary>
        /// <param name="machineID">ID of the machine</param>
        /// <param name="progressObserver">The progressobserver used to update the progressbar></param>
        private void StartStandardWash(int machineID, IProgress <WashProgress> progressObserver)
        {
            CarWashMachine      machine = CreateMachineIfNotExist(machineID);
            StandardWashHandler handler = new StandardWashHandler(progressObserver);

            handler.WashCarStandard(machineID);
            machine.WashHandler = handler;
        }
示例#3
0
文件: Handler.cs 项目: KHIT93/CarWash
        public void WashFinished(int machineID)
        {
            CarWashMachine machine = CreateMachineIfNotExist(machineID);

            if (machine.WashHandler != null)
            {
                machine.WashHandler = null;
            }
        }
示例#4
0
文件: Handler.cs 项目: KHIT93/CarWash
        /// <summary>
        /// Shows if the machine is running
        /// </summary>
        /// <param name="machineID">ID of the machine</param>
        /// <returns></returns>
        private bool CheckIfMachineBusy(int machineID)
        {
            CarWashMachine machine = CreateMachineIfNotExist(machineID);

            if (machine.WashHandler == null)
            {
                return(false);
            }
            return(true);
        }
示例#5
0
文件: Handler.cs 项目: KHIT93/CarWash
        /// <summary>
        /// Cancels the current running wash
        /// </summary>
        /// <param name="machineID">ID of the machine</param>
        public void CancelWash(int machineID)
        {
            CarWashMachine machine = CreateMachineIfNotExist(machineID);

            if (machine.WashHandler != null)
            {
                machine.WashHandler.Cancel();
                machine.WashHandler = null;
            }
        }
示例#6
0
文件: Handler.cs 项目: KHIT93/CarWash
        /// <summary>
        /// Returns an existing machine object or creates a new one if a machine with the ID does not exist
        /// </summary>
        /// <param name="machineID">ID of the machine</param>
        /// <returns></returns>
        private CarWashMachine CreateMachineIfNotExist(int machineID)
        {
            CarWashMachine machine;

            if (!machineList.Exists(i => i.Id() == machineID))
            {
                machine = new CarWashMachine(machineID);
                machineList.Add(machine);
            }
            else
            {
                machine = machineList.Find(i => i.Id() == machineID);
            }

            return(machine);
        }
示例#7
0
文件: Handler.cs 项目: KHIT93/CarWash
        /// <summary>
        /// Gets the status of the current running wash
        /// </summary>
        /// <param name="machineID">ID of the machine</param>
        /// <returns></returns>
        public int GetWashStatus(int machineID)
        {
            CarWashMachine machine = CreateMachineIfNotExist(machineID);

            return(machine.WashHandler.WashProgram.Status());
        }