Exemple #1
0
        //Prints the status of a device
        //Finds a device by its id if exists, returns device.GetCurrentState()
        //If device does not exist, throws DeviceDoesNotExistException
        public string PrintStatus(int deviceId)
        {
            AbsDevice device = GetDeviceById(deviceId);

            if (device == null)
            {
                throw new DeviceDoesNotExistException();
            }
            return(device.GetCurrentState());
        }
Exemple #2
0
        //Whenever a device is updated, prints the status of the device into the console
        public void OnDeviceUpdated(object source, EventArgs e)
        {
            AbsDevice absDevice = (AbsDevice)source;

            Console.WriteLine(absDevice.GetCurrentState());
        }