示例#1
0
文件: GlueForm.cs 项目: ame89/nfx
        private void button6_Click(object sender, EventArgs e)
        {
            warmup();
            var unsecure = chkUnsecureEcho.Checked;

            Text        = "Working...";
            tbNote.Text = "Started...";
            var w = Stopwatch.StartNew();

            var client = new JokeContractClient(cbo.Text);

            client.DispatchTimeoutMs = 5 * 1000;
            client.TimeoutMs         = 40 * 1000;
            if (!unsecure && chkImpersonate.Checked)
            {
                client.Headers.Add(new AuthenticationHeader(new IDPasswordCredentials(tbID.Text, tbPwd.Text)));
            }

            var totalCalls = tbCallsPerReactor.Text.AsInt();

            System.Threading.Tasks.Parallel.For(0, totalCalls,
                                                (i) =>
            {
                client.Async_Notify("aa");
            });
            var allFinished = w.ElapsedMilliseconds;

            Text = "Placed {0:n2} One Way calls in {1:n2} ms,  @ {2:n2} calls/sec "
                   .Args
                   (
                totalCalls,
                allFinished,
                totalCalls / (allFinished / 1000d)
                   );
        }