void _trans_Prepare(object sender, TransferEventArgs e) { if (MainForm.Confirm(string.Format("是否接收文件{0}?", e.Config.FileName), "文件传输")) { TaskHelper.Factory.StartNew(() => { var form = new TransferForm(); form.Start(_trans); form.Show(); }); } else { e.Cancel = true; } }
void button2_Click(object sender, EventArgs e) { IPAddress addr; if (!IPAddress.TryParse(tb_destIpe.Text, out addr)) { this.AppendLog("IP错误"); return; } if (openFileDialog1.ShowDialog() == DialogResult.OK) { var form = new TransferForm(); form.Start(openFileDialog1.FileName, addr); form.Show(); } }