一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

Using the Remoting Callbacks in .Net Applications

时间:2022-07-02 12:03:15 编辑:袖梨 来源:一聚教程网

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);

热门栏目