26.6.txt
来自「《Microsoft Visual C# .NET 2003开发技巧大全》源代码」· 文本 代码 · 共 35 行
TXT
35 行
Listing 26.6 Creating a Listener Thread
using System;
using System.Threading;
using System.Net.Sockets;
using System.IO;
using System.Text;
namespace _7_IRChatClient
{
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox tbTranscript;
private System.Windows.Forms.TextBox tbMessage;
private System.Windows.Forms.Button btnSend;
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem mnuExit;
private Thread listenerThread;
private string serviceType = “IRDA_CHAT”;
IrDAListener listener;
public Form1()
{
InitializeComponent();
// create the IR listener
listener = new IrDAListener( serviceType );
// create the thread and start it
listenerThread = new Thread( new ThreadStart(
ListenerThreadMethod ));
listenerThread.Start();
}
void ListenerThreadMethod()
{
}
// continued…
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?