Example #1
0
        private async Task RemoveDirectory(string path)
        {
            await Task.Factory.StartNew(() =>
            {
                SetUiState(false);
                Invoke(
                    new Action(
                        () =>
                        loadingLabel.Text = $"Deleting directory \"{path}\"..."));
                try
                {
                    _ftp.DeleteDirectory(path);
                }
                catch (Exception ex)
                {
                    Invoke(
                        new Action(
                            () =>
                            Popup.ShowPopup(this, SystemIcons.Error, "Error while deleting the directory.", ex,
                                            PopupButtons.Ok)));
                    SetUiState(true);
                    return;
                }

                Invoke(
                    new Action(
                        () =>
                        serverDataTreeView.SelectedNode.Remove()));
                SetUiState(true);
            });
        }