public async Task <Result> OkButton() { var sb = new StringBuilder(); var powerStatus = await YamahaService.PowerStatus(); if (powerStatus == PowerStatusEnum.On) { var state = await SmartHouseService.GetCurrentState(); if (state == SmartHouseState.Pandora) { if (await PlayerService.IsPlaying()) { PlayerService.Pause(); } else { PlayerService.Play(); } sb.AppendLine("Starting to play/pause Pandora"); } else if (state == SmartHouseState.Music) { if (MpdService.GetStatus().State == MpdState.Play) { MpdService.Pause(); } else if (MpdService.GetStatus().State == MpdState.Pause) { MpdService.Play(); } } else if (state == SmartHouseState.TV) { await TVService.Ok(); } } else { sb.AppendLine("Yamaha is turned off. Operation canceled"); PushNotification("Yamaha is turned off. Operation canceled"); } return(new Result() { ErrorCode = 0, Message = sb.ToString(), Ok = true }); }
public Result Pause() { return(MpdService.Pause()); }