/// <summary> /// 取消按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ItemCancelButtonClick(object sender, EventArgs e) { FileTransfersItem item = sender as FileTransfersItem; ControlTag tag = item.Tag as ControlTag; CancelReceive(tag.MD5, tag.RemoteIP); fileTansfersContainer.RemoveItem(item); item.Dispose(); }
/// <summary> /// 保存文件按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ItemSaveButtonClick(object sender, EventArgs e) { FileTransfersItem item = sender as FileTransfersItem; RequestSendFileEventArgs rse = item.Tag as RequestSendFileEventArgs; //自动保存在程序根目录下 rse.Path = Application.StartupPath; ControlTag tag = new ControlTag( rse.TraFransfersFileStart.MD5, rse.TraFransfersFileStart.FileName, rse.RemoteIP); item.Tag = tag; item.Style = FileTransfersItemStyle.Receive; item.CancelButtonClick += new EventHandler(ItemCancelButtonClick); item.Start(); this.AcceptReceive(rse); }
/// <summary> /// 文件另存为按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ItemSaveToButtonClick(object sender, EventArgs e) { FileTransfersItem item = sender as FileTransfersItem; RequestSendFileEventArgs rse = item.Tag as RequestSendFileEventArgs; FolderBrowserDialog fbd = new FolderBrowserDialog(); if (fbd.ShowDialog() == DialogResult.OK) { rse.Path = fbd.SelectedPath; ControlTag tag = new ControlTag( rse.TraFransfersFileStart.MD5, rse.TraFransfersFileStart.FileName, rse.RemoteIP); item.Tag = tag; item.Style = FileTransfersItemStyle.Receive; item.CancelButtonClick += new EventHandler(ItemCancelButtonClick); item.Start(); this.AcceptReceive(rse); } }