Exemplo n.º 1
0
        protected void btnServiceAsync_Click(object sender, EventArgs e)
        {
            service.Service1 srv = new service.Service1();
            srv.HelloWorldCompleted += new WebApplication.service.HelloWorldCompletedEventHandler(srv_HelloWorldCompleted);

            stopWatch.Start();
            srv.HelloWorldAsync();

            for (int i = 0; i < 10000; i++)
            {
                this.lblResult1.Text += i + " ";
            }
            for (int i = 0; i < 10000; i++)
            {
                this.lblResult2.Text += i + " ";
            }

            srv.CancelAsync
        }
Exemplo n.º 2
0
        protected void btnService_Click(object sender, EventArgs e)
        {
            service.Service1 srv = new service.Service1();

            stopWatch.Start();
            this.lblResult.Text += srv.HelloWorld() + " sinkrone ";

            for (int i = 0; i < 10000; i++)
            {
                this.lblResult1.Text += i + " ";
            }

            for (int i = 0; i < 10000; i++)
            {
                this.lblResult2.Text += i + " ";
            }

            stopWatch.Stop();
            this.lblResult.Text += " -> " + String.Format("Kohezgjatja: {0} ms", stopWatch.Elapsed.Milliseconds);
        }