示例#1
0
        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));
        }
示例#2
0
 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
         });
     }
 }
示例#3
0
 /// <summary>
 /// 引发 <see cref="DeleteFile" /> 事件
 /// </summary>
 protected virtual void OnDeleteFile(InstallFileEventArgs e)
 {
     DeleteFile?.Invoke(this, e);
 }