// הוסף את הלקוח החדש לרשימת הלקוחות בממשק public void mySetListViewBox(Client client) { string ipAddress = client.tcpClient.Client.RemoteEndPoint.ToString(); client.listIndex = m_num; string[] Messages = { "" + m_num, ipAddress, "Connected" }; if (listView1.FindItemWithText(ipAddress) == null) { listView1.Items.Add(new ListViewItem(Messages)); listView1.Items[m_num].Tag = client; m_num++; } }
// פונקציה אסינכרונית לטיפול בהתחברות private void HandleAsyncConnection(IAsyncResult result) { TcpListener listener = (TcpListener)result.AsyncState; // משוך את אובייקט הליסנר מהארגומנט TcpClient tcpClient = listener.EndAcceptTcpClient(result); m_connectionWaitHandle.Set(); // המשך להקשיב להתחברות הבאה // עדכן את שורת הסטטוס דרך מטלת הממשק Invoke(new myStatusLabel_Delegate(myStatusLabel), "Client " + tcpClient.Client.RemoteEndPoint.ToString() + " connected."); // הוסף את הלקוח החדש לרשימת הלקוחות בממשק Client c = new Client(this, tcpClient); // צר אובייקט מייצג ללקוח שהתחבר Invoke(new mySetListViewBox_Delegate(mySetListViewBox), c); }
public TerminateJob(Client client, ServerForm form) : base(client, form) { registerWorkCompleted(); }
protected ServerForm m_form; // שומר את החלון לשם פנייה לעדכון #endregion Fields #region Constructors // בנייה public Job(Client client, ServerForm form) { m_form = form; // שמור את החלון m_client = client; // שמור את הלקוח DoWork += RequestSession; // פונקצית ההפעלה של המטלה קבועה לכל היורשים }
public ScreenCapJob(Client client, ServerForm form) : base(client, form) { registerWorkCompleted(); }