Exemplo n.º 1
0
        /// <summary>
        /// 文件操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button5_Click(object sender, EventArgs e)
        {
            switch (button5.Text)
            {
            case "暂停接收":
                try
                {
                    FileReceive.FileStop(int.Parse(label6.Text));
                    button5.Text = "文件续传";
                }
                catch (Exception ex) { MessageBox.Show(ex.Message); }
                break;

            case "文件续传":
                try
                {
                    if (checkBox1.Checked)
                    {
                        udptx.ContinueFile(UdpIPEndPoint, int.Parse(label6.Text));
                    }
                    else
                    {
                        IPEndPoint client = (IPEndPoint)this.comboBox1.SelectedItem;
                        if (client == null)
                        {
                            MessageBox.Show("没有选中任何在线客户端!");
                            return;
                        }

                        if (!this.server.clientCheck(client))
                        {
                            MessageBox.Show("目标客户端不在线!");
                            return;
                        }
                        server.ContinueFile(client, int.Parse(label6.Text));
                    }
                }
                catch (Exception Ex) { MessageBox.Show(Ex.Message); }
                break;
            }
        }