private void LoadNewHostButton_Click(object sender, EventArgs e) { var newLogin = new LoginDialog(Connection); if (newLogin.ShowDialog() != DialogResult.OK) { return; } Connection = newLogin.Connection; _fsLoader = new BackgroundWorker { WorkerReportsProgress = true, WorkerSupportsCancellation = true }; _fsLoader.DoWork += FsLoader_DoWork; _fsLoader.RunWorkerCompleted += FsLoader_RunWorkerCompleted; _progress = new FtpBrowseProgressDialog(); _progress.FormClosing += Progress_FormClosing; _fsLoader.RunWorkerAsync(); _progress.ShowDialog(); }
protected override void OnShown(EventArgs e) { if (TestMode) { LoadTestNodes(); } else if (_promptForServer) { LoadNewHostButton.PerformClick(); } else { _fsLoader = new BackgroundWorker { WorkerReportsProgress = true, WorkerSupportsCancellation = true }; _fsLoader.DoWork += FsLoader_DoWork; _fsLoader.RunWorkerCompleted += FsLoader_RunWorkerCompleted; _progress = new FtpBrowseProgressDialog(); _progress.FormClosing += Progress_FormClosing; _fsLoader.RunWorkerAsync(); _progress.ShowDialog(); } base.OnShown(e); }