public override async Task <SendMediaKeysReply> SendMediaKeys(SendMediaKeysRequest request, ServerCallContext context) { var success = await InteropService.SendMediaKey(request.KeyCode); return(new SendMediaKeysReply() { Success = success }); }
public override Task <SendMediaKeysReply> SendMediaKeys(SendMediaKeysRequest request, ServerCallContext context) { Log.Info("Executing [{Name}] [{MediaKey}]", nameof(SendMediaKeys), request.KeyCode); switch (request.KeyCode) { case SendMediaKeysRequest.Types.MediaKeyCode.NextTrack: NativeMethods.PressMediaKey(NativeMethods.MediaKeyCode.NextTrack); break; case SendMediaKeysRequest.Types.MediaKeyCode.PreviousTrack: NativeMethods.PressMediaKey(NativeMethods.MediaKeyCode.PreviousTrack); break; case SendMediaKeysRequest.Types.MediaKeyCode.PlayPause: NativeMethods.PressMediaKey(NativeMethods.MediaKeyCode.PlayPause); break; default: throw new ArgumentOutOfRangeException(); } return(Task.FromResult(new SendMediaKeysReply())); }