Ejemplo n.º 1
0
 private void Media_SkipForward_Click(object sender, RoutedEventArgs e)
 {
     if (Model.IsServer)
     {
         MediaControl.SkipForward();
     }
     else
     {
         NetworkCommunicator.SendAsync(new HarmonyPacket()
         {
             Type = HarmonyPacket.PacketType.MediaControl,
             Pack = new HarmonyPacket.MediaControlPacket()
             {
                 Action = HarmonyPacket.MediaControlPacket.MediaAction.SkipForward
             }
         });
     }
 }
Ejemplo n.º 2
0
        private static void ServerProcessReceived()
        {
            while (true)
            {
                var hp = _toProcess.Take();

                switch (hp.Type)
                {
                case HarmonyPacket.PacketType.MouseMovePacket:
                    break;

                case HarmonyPacket.PacketType.MousePacket:
                    break;

                case HarmonyPacket.PacketType.KeyBoardPacket:
                    if (OnSlave == 0)
                    {
                        Keyboard.SendInput(hp.Pack);
                    }
                    else
                    {
                        SendAsync(hp);
                    }
                    break;

                case HarmonyPacket.PacketType.DisplayPacket:
                    break;

                case HarmonyPacket.PacketType.SaltPacket:
                    break;

                case HarmonyPacket.PacketType.MediaControl:
                    switch (((HarmonyPacket.MediaControlPacket)hp.Pack).Action)
                    {
                    case HarmonyPacket.MediaControlPacket.MediaAction.PlayPause:
                        MediaControl.PlayPause();
                        break;

                    case HarmonyPacket.MediaControlPacket.MediaAction.Stop:
                        MediaControl.Stop();
                        break;

                    case HarmonyPacket.MediaControlPacket.MediaAction.SkipPrevious:
                        MediaControl.SkipPrevious();
                        break;

                    case HarmonyPacket.MediaControlPacket.MediaAction.SkipForward:
                        MediaControl.SkipForward();
                        break;

                    case HarmonyPacket.MediaControlPacket.MediaAction.Reload:
                        MediaControl.Reload();
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
        }