private void DeleteFileAndSend(Session session, FileDeleteRequest request) { var deleteFileEventArgs = new DeleteFileEventArgs(request.Key); var response = new FileDeleteResponse() { MessageId = request.MessageId, ResponseType = ResponseType.OK }; try { DeleteFile?.Invoke( this, deleteFileEventArgs); } catch (Exception ex) { OnException(session, ex, disconnect: false); response.ResponseType = ResponseType.Exception; response.Exception = ex.Message; } SendData( session, SerializeManager.Current.Serialize(response)); }
private void btnDelete_Click(object sender, EventArgs e) { if (MessageBox.Show(this, "Delete the file " + FilePath + "?", "Delete File", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { DeleteFile.Invoke(this, new FileViewerEventArgs() { FilePath = FilePath }); } }
/// <summary> /// 引发 <see cref="DeleteFile" /> 事件 /// </summary> protected virtual void OnDeleteFile(InstallFileEventArgs e) { DeleteFile?.Invoke(this, e); }