CÁC GIẢI PHÁP LẬP TRÌNH C# - Trang 500

500
Chương 12: Dịch vụ Web XML và Remoting

using System;

using System.Windows.Forms;

using System.Runtime.Remoting;

public class ClientForm : System.Windows.Forms.Form {

private System.Windows.Forms.Button cmdStart;

// (Bỏ qua phần mã designer.)

RemoteObject.RemoteObject remoteObj;

EventListener.EventListener listener;

private void ClientForm_Load(object sender, System.EventArgs e) {

RemotingConfiguration.Configure("Client.exe.config");

remoteObj = new RemoteObject.RemoteObject();

listener = new EventListener.EventListener();

}

private void cmdStart_Click(object sender, System.EventArgs e) {

// Kết nối phương thức thụ lý sự kiện ở xa.

remoteObj.TaskComplete += new

RemoteObject.TaskCompleted(listener.OnTaskComplete);

// Kết nối phương thức thụ lý sự kiện cục bộ.

listener.TaskComplete +=

new RemoteObject.TaskCompleted(TaskComplete);

remoteObj.StartTask();

MessageBox.Show("Task has been started.");

}

// Định nghĩa phương thức thụ lý sự kiện cục bộ.

Liên Kết Chia Sẽ

** Đây là liên kết chia sẻ bới cộng đồng người dùng, chúng tôi không chịu trách nhiệm gì về nội dung của các thông tin này. Nếu có liên kết nào không phù hợp xin hãy báo cho admin.