/// <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 ItemRefuseButtonClick(object sender, EventArgs e) { FileTransfersItem item = sender as FileTransfersItem; RequestSendFileEventArgs rse = item.Tag as RequestSendFileEventArgs; rse.Cancel = true; fileTansfersContainer.RemoveItem(item); item.Dispose(); AcceptReceive(rse); }
/// <summary> /// 文件发送完成时触发事件 /// </summary> /// <param name="e"></param> protected virtual void OnFileSendComplete(FileSendEventArgs e) { FileTransfersItem item = e.SendFileManager.Tag as FileTransfersItem; if (item != null) { Form.ActiveForm.BeginInvoke(new MethodInvoker(delegate() { fileTansfersContainer.RemoveItem(item); item.Dispose(); })); } if (FileSendComplete != null) { FileSendComplete(this, e); } }