コード例 #1
0
        /// <summary>
        /// Applies operation
        /// </summary>
        protected override void DoOperation()
        {
            var un = Command.Parameters["un"] as ParameterString;

            for (int i = 0; i < Server.Clients.Count; i++)
            {
                if (Server.Clients[i].Username == un.Value)
                {
                    var command = new NetCommand(CommandNames.GET_PICTURE);
                    Server.Clients[i].Commands.Add(command);

                    if (command.WaitForStatus(CommandStatus.Executed, 10, 10000))
                    {
                        Response = new NetResponse(true);
                        Response.Parameters.Add(new ParameterResponse("rp", command.Response));
                    }
                    else
                    {
                        Response = new NetResponse(false, "Server could not read picture from target client in the given time");
                    }

                    break;
                }
            }

            if (Response == null)
            {
                Response = new NetResponse(false, "Could not find client");
            }
        }
コード例 #2
0
ファイル: FormMain.cs プロジェクト: ozcandegirmenci/B-Msn
        private void testToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var command = new NetCommand("TEST");

            client1.Commands.Add(command);

            if (command.WaitForStatus(CommandStatus.Executed))
            {
                MessageBox.Show(command.Response.Message);
            }
        }