当前位置:编程学习 > C#/ASP.NET >>

Using the Remoting Callbacks in .Net Applications

Invoking the Remote Method
This code snippet shows invoking a method on the Remoting objects using the asynchronous design pattern. Clicking on the button Run/Abort the following code snippet is going to be perform:
private void buttonRM_Click(object sender, System.EventArgs e)
{
     try
     {
        if(buttonRM.Text == "Run")
        {
    // client state
    buttonRM.Text = "Busy";
    progressBarStatus.Value = 0;
    textBoxStatus.Text = string.Empty;
    cb.State = true;
    //
    // arguments
    int timeinsec = 10;
    string ticketId = "ProgressBar";
    RemoteCallback wire = new RemoteCallback(cb.Progress);
    //
    // invoking method on the objectA
    AsyncCallback acbA = new AsyncCallback(asyncCallBackA);
    DelegateGiveMeCallback dA = new DelegateGiveMeCallback(roA.GiveMeCallback);
    IAsyncResult arA = dA.BeginInvoke(timeinsec, ticketId, wire, acbA, null);
    //
    // invoking method on the objectX
    AsyncCallback acbX = new AsyncCallback(asyncCallBackX);
补充:asp.net教程,远程及网络应用
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,