예제 #1
0
        protected virtual void DisplayDeviceOnPowerStatusChange(IPowerDevice device, DevicePowerStatusEventArgs args)
        {
            switch (args.NewPowerStatus)
            {
            case DevicePowerStatus.PowerWarming:
            case DevicePowerStatus.PowerOn:
                if (args.PreviousPowerStatus == DevicePowerStatus.PowerWarming)
                {
                    return;
                }
                if (HoistController != null)
                {
                    CloudLog.Info("{0} power now {1}, Lowering Hoist", Name, args.NewPowerStatus);
                    HoistController.Down();
                }
                if (ScreenController != null)
                {
                    CloudLog.Info("{0} power now {1}, Lowering Screen", Name, args.NewPowerStatus);
                    ScreenController.Down();
                }
                break;

            case DevicePowerStatus.PowerOff:
                if (ScreenController != null && args.PreviousPowerStatus == DevicePowerStatus.PowerOn)
                {
                    CloudLog.Info("{0} power now {1}, Raising Screen", Name, args.NewPowerStatus);
                    ScreenController.Up();
                }
                if (HoistController != null)
                {
                    CloudLog.Info("{0} power now {1}, Raising Hoist", Name, args.NewPowerStatus);
                    HoistController.Up();
                }
                break;

            case DevicePowerStatus.PowerCooling:
                if (ScreenController != null)
                {
                    CloudLog.Info("{0} power now {1}, Raising Screen", Name, args.NewPowerStatus);
                    ScreenController.Up();
                }
                break;
            }
        }