private void TurnOffDevice(ControlDevice device) { Type deviceType = device.GetType(); switch (deviceType.Name) { case "AirFlowController": _mainGui.AirFlowControllerPB.Image = device.DisabledImageDevice; break; case "AntiFireSystem": _mainGui.AntiFirePB.Image = device.DisabledImageDevice; break; case "QualityDevice": _mainGui.ConditionerPB.Image = device.DisabledImageDevice; break; case "Pump": _mainGui.FanPB2.Image = device.DisabledImageDevice; break; case "Filter": _mainGui.FilterPB.Image = device.DisabledImageDevice; break; case "RedirectDevice": _mainGui.RedirectPB.Image = device.DisabledImageDevice; break; } }