Пример #1
0
        public void CreateConsoleFolder()
        {
            try
            {
                var folderName = DialogExtensions.ShowTextInputDialog(this, "Add New Folder", "Folder Name: ", "");

                if (folderName != null)
                {
                    string folderPath = FtpDirectoryPath + "/" + folderName;

                    if (FtpClient.DirectoryExists(folderPath))
                    {
                        XtraMessageBox.Show($"A folder with this name already exists.", "Error");
                        return;
                    }
                    else
                    {
                        _ = FtpExtensions.CreateDirectory(folderPath);
                        LoadConsoleDirectory(FtpDirectoryPath);
                    }
                }
            }
            catch (FtpException ex)
            {
                DarkMessageBox.ShowError($"Unable to create new folder. Error: {ex.Message}", "Error");
            }
            catch (Exception ex)
            {
                DarkMessageBox.ShowError($"Unable to create new folder. Error: {ex.Message}", "Error");
            }
        }
Пример #2
0
        private void ToolStripConsoleNewFolder_Click(object sender, EventArgs e)
        {
            try
            {
                var folderName = DialogExtensions.ShowTextInputDialog(this, "Add New Folder", "Folder Name: ", "");

                if (folderName != null)
                {
                    _ = FtpExtensions.CreateDirectory(FtpDirectoryPath + "/" + folderName);
                    LoadConsoleDirectory(FtpDirectoryPath);
                }
            }
            catch (FtpException ex)
            {
                _ = DarkMessageBox.Show(this, $"Unable to create new folder. Error: {ex.Message}", "Error",
                                        MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                _ = DarkMessageBox.Show(this, $"Unable to create new folder. Error: {ex.Message}", "Error",
                                        MessageBoxIcon.Error);
            }
        }