상속: CommandArgs
        public override void Run(ClientCommandArgs args)
        {
            if (args.PeerConnectionId == null)
            return;

              ScreenClientPlugin.Model.API.SendMessage(null, string.Format("Выполнен снимок у пользователя {0}.", args.PeerConnectionId), ServerModel.MainRoomName);
        }
        public override void Run(ClientCommandArgs args)
        {
            if (args.PeerConnectionId == null)
            return;

              var receivedContent = Serializer.Deserialize<MessageContent>(args.Message);

              var screenDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "screens");
              if (!Directory.Exists(screenDirectory))
            Directory.CreateDirectory(screenDirectory);

              var fullPath = Path.Combine(screenDirectory, receivedContent.FileName);

              using (var bmpScreenCapture = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height))
              using (var graphic = Graphics.FromImage(bmpScreenCapture))
              {
            graphic.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, bmpScreenCapture.Size, CopyPixelOperation.SourceCopy);
            bmpScreenCapture.Save(fullPath);
              }

              ScreenClientPlugin.Model.API.AddFileToRoom(ServerModel.MainRoomName, fullPath);
              ScreenClientPlugin.Model.Peer.SendMessage(args.PeerConnectionId, ClientScreenDoneCommand.CommandId, null);
        }
예제 #3
0
        protected override void OnPackageReceived(PackageReceivedEventArgs e)
        {
            try
              {
            if (e.Exception != null)
            {
              OnError(e.Exception);
              return;
            }

            var command = ClientModel.Api.GetCommand(e.Unpacked.Package.Id);
            var args = new ClientCommandArgs(null, e.Unpacked);

            requestQueue.Add(ClientId, command, args);
              }
              catch (Exception exc)
              {
            OnError(exc);
              }
        }
예제 #4
0
        protected override void OnDataReceived(DataReceivedEventArgs e)
        {
            try
              {
            if (e.Error != null)
              throw e.Error;

            if (TrySetApi(e))
              return;

            var command = ClientModel.API.GetCommand(e.ReceivedData);
            var args = new ClientCommandArgs { Message = e.ReceivedData };

            requestQueue.Add(ClientId, command, args);
              }
              catch (Exception exc)
              {
            ClientModel.Notifier.AsyncError(new AsyncErrorEventArgs { Error = exc });
            ClientModel.Logger.Write(exc);
              }
        }