public override async Task <GetClipboardResponse> GetClipboard(GetClipboardRequest request, ServerCallContext context) { var result = await InteropService.GetClipboardAsync(request.Requestee); return(new GetClipboardResponse() { Content = result }); }
public override async Task <GetClipboardResponse> GetClipboard(GetClipboardRequest request, ServerCallContext context) { Log.Info("Executing [{Name}]", nameof(GetClipboard)); if (MessageBox.Show($"Send clipboard content to {request.Requestee}?", "PC Remote 2", MessageBoxButtons.YesNo) == DialogResult.Yes) { try { var content = await ClipboardHelper.GetClipboardAsync(System.Windows.Forms.TextDataFormat.UnicodeText); Log.Debug("Returning {Length} characters to client", content.Length); return(new GetClipboardResponse() { Content = content }); } catch (Exception e) { Log.Error(e, "Failed to read clipboard."); return(new GetClipboardResponse() { Content = default });