/// <summary> /// Determines if and how data received from the client should be handled /// </summary> /// <param name="sender">Source client</param> /// <param name="eventArgs">Object containing the received data</param> private void HandleOnData(object sender, OnReceivedDataEventArgs eventArgs) { // Check if the data is meant for us, otherwise return early. if (!(eventArgs.data is StreamedImage img)) { return; } // update the image to show the SharingSession screen image.BeginInvoke(new Action(async() => { await UpdateImageAsync(img.data); eventArgs.data = null; } )); }
/// <summary> /// Handles the data based on type and calls the corresponding Method. /// </summary> /// <param name="sender">The object invoking the event</param> /// <param name="e">The data received</param> private static void HandleOnData(object sender, OnReceivedDataEventArgs e) { switch (e.data) { case MouseRemoteMoveCommand c: HandleRemoteMouseMoveEvent(c); break; case MouseRemoteClickCommand c: HandleRemoteMouseButtonEvent(c); break; case KeyDownRemoteCommand c: HandleRemoteKeyDownEvent(c); break; } }