private void btnCleanup_Click(object sender, EventArgs e) { var confirmResult = MessageBox.Show("Are you sure to want to delete ALL POSTS and UPLOADS, including IMAGES from the blog?", "Confirm Delete!!", MessageBoxButtons.YesNo); if (confirmResult != DialogResult.Yes) return; var programOptionsFactory = new ProgramOptionsFactory(); _options = programOptionsFactory.Get(); if (string.IsNullOrEmpty(_options.FtpUrl)) { MessageBox.Show("In order to delete images, please set up FTP account from settings."); return; } _ftp = new Ftp.Ftp(FtpConfiguration); if (!string.IsNullOrEmpty(_ftp.TestConnection())) { MessageBox.Show("Cannot connect to FTP, please check your settings."); return; } try { _ftp.DirectoryListingProgressing += FtpDirectoryListingProgressing; _ftp.DirectoryListingFetchFinished += FtpDirectoryListingFetchFinished; _ftp.DirectoryDeletionProgressing += FtpDirectoryDeletionProgress; _ftp.DirectoryDeletionFinished += FtpDirectoryDeletionFinished; EnDis(false); _ftp.DeleteDirectory("wp-content/uploads/"); } catch (Exception exception) { EnDis(true); MessageBox.Show(exception.ToString()); Logger.LogExceptions(exception); } }
private void PrepareTemplates() { var programOptionsFactory = new ProgramOptionsFactory(); _options = programOptionsFactory.Get(); if (string.IsNullOrEmpty(_options.FtpUrl)) { MessageBox.Show("In order to update wp files, please set up FTP account from settings."); return; } var ftp = new Ftp(FtpConfiguration); if (!string.IsNullOrEmpty(ftp.TestConnection())) { MessageBox.Show("Cannot connect to FTP, please check your settings."); return; } var frmPrepareTemplate = new frmPrepareTemplate(); frmPrepareTemplate.ShowDialog(); }
private void btnTestFtpConnection_Click(object sender, EventArgs e) { var ftp = new Ftp.Ftp(FtpConfiguration); string result = ftp.TestConnection(); if (string.IsNullOrEmpty(result)) { MessageBox.Show("Successfull!"); return; } MessageBox.Show("Failed: " + result); }