|
|
@@ -125,7 +125,13 @@ namespace ClassFile
|
|
|
{
|
|
|
int index = SelectIP.Items.IndexOf(item.RemoteEndPoint.ToString());
|
|
|
SelectIP.Items.RemoveAt(index);
|
|
|
- SelectIP.Update();
|
|
|
+ if (SelectIP.Items.Count > 0)
|
|
|
+ {
|
|
|
+ if (SelectIP.Text == "")
|
|
|
+ SelectIP.Text = SelectIP.Items[0].ToString();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ SelectIP.Text = "";
|
|
|
richtext.AppendText("客户端" + item.RemoteEndPoint + "已经中断连接" + "\r\n");
|
|
|
|
|
|
if (list.Contains(item))
|
|
|
@@ -219,7 +225,13 @@ namespace ClassFile
|
|
|
//提示套接字监听异常
|
|
|
int index = SelectIP.Items.IndexOf(socketServer.RemoteEndPoint.ToString());
|
|
|
SelectIP.Items.RemoveAt(index);
|
|
|
- SelectIP.Update();
|
|
|
+ if (SelectIP.Items.Count > 0)
|
|
|
+ {
|
|
|
+ if (SelectIP.Text == "")
|
|
|
+ SelectIP.Text = SelectIP.Items[0].ToString();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ SelectIP.Text = "";
|
|
|
richtext.AppendText("客户端" + socketServer.RemoteEndPoint + "已经中断连接" + "\r\n");
|
|
|
}
|
|
|
if (list.Contains(socketServer))
|
|
|
@@ -237,7 +249,13 @@ namespace ClassFile
|
|
|
{
|
|
|
int index = SelectIP.Items.IndexOf(socketServer.RemoteEndPoint.ToString());
|
|
|
SelectIP.Items.RemoveAt(index);
|
|
|
- SelectIP.Update();
|
|
|
+ if (SelectIP.Items.Count > 0)
|
|
|
+ {
|
|
|
+ if (SelectIP.Text == "")
|
|
|
+ SelectIP.Text = SelectIP.Items[0].ToString();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ SelectIP.Text = "";
|
|
|
richtext.AppendText("客户端" + socketServer.RemoteEndPoint + "已经中断连接" + "\r\n");
|
|
|
}
|
|
|
if (list.Contains(socketServer))
|