Ejemplo n.º 1
0
        /// <summary>
        /// 删除所选目录
        /// </summary>
        /// <param name="sender">传递对象</param>
        /// <param name="e">传递事件</param>
        private void btnDeleteDir_Click(object sender, EventArgs e)
        {
            if (null == _ftpHelper)
            {
                MessageBox.Show("请先创建FTP服务!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            lblStatusInfo.Text = "等待...";

            string selectedFile = lstDataBox.SelectedItem as string;

            if (string.IsNullOrWhiteSpace(selectedFile))
            {
                MessageBox.Show("您暂未选中任何目录,或列表中没有目录可供选择,请先执行获取基本列表,并确认选中了目录后重试。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            string resultString = _ftpHelper.DeleteDirectory(selectedFile);

            lblStatusInfo.Text = $"{_ftpHelper.CurrentStatusCode} : {resultString}";
        }