public override bool Execute() { if (cbxHardwareType.SelectedIndex == 0) { errorProvider.Clear(); errorProvider.SetError(cbxHardwareType, cbxHardwareType.Items[0].ToString()); return(false); } if (FtpCommands.TestFTPserver(txtServerName.Text, txtUserName.Text, txtPassword.Text)) { HardwareDetails det = HardwareDetailsFactory.CreateDetails((HardwareTypeEnum)cbxHardwareType.SelectedIndex); Settings.Default.Server = txtServerName.Text; Settings.Default.Username = txtUserName.Text; Settings.Default.Password = txtPassword.Text; Settings.Default.FTPSubFolder = det.DefaultFTPSubFolder; Settings.Default.WebserverSubFolder = det.DefaultWebserverSubFolder; string prevHardwareType = Settings.Default.HardwareType; Settings.Default.HardwareType = ((HardwareTypeEnum)cbxHardwareType.SelectedIndex).ToString(); Settings.Default.HardwareName = cbxHardwareType.Items[cbxHardwareType.SelectedIndex].ToString(); Settings.Default.FirstRun = false; Settings.Default.Save(); if (prevHardwareType != Settings.Default.HardwareType) { //reload the repository to fix the magic tokens Repository newRep = new Repository(UpdateRepositoryState); panelResults["Repository"] = newRep; Thread t = new Thread(new ThreadStart(newRep.UpdateRepository)); t.Start(); while (t.ThreadState != ThreadState.Stopped) { Application.DoEvents(); Thread.Sleep(50); } } else { ((Repository)panelResults["Repository"]).LoadRepositoryFiles(); } //this will trigger an appinfo update panelResults["SelectedItem"] = 1; return(true); } else { Logger.GetInstance().AddLogLine(LogLevel.Warning, "FTP test failed. Error while trying to connect to the FTP server."); MessageBox.Show(Resources.MessageBox_FtpConnectionTestFailed, Resources.MessageBox_FtpConnectionTestCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } }
private void removeWaitImageSetToolStripMenuItem_Click(object sender, EventArgs e) { if (MessageBox.Show(Resources.MessageBox_WaitImageDeleteConfirm, Resources.MessageBox_WaitImageDeleteCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { FtpCommands.DeleteFolder(Settings.Default.Server, Settings.Default.Username, Settings.Default.Password, "/Photo/_waitimages_/"); MessageBox.Show(Resources.MessageBox_WaitImageDeleted, Resources.MessageBox_WaitImageDeleteCaption, MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { Logger.GetInstance().AddLogLine(LogLevel.Error, "Wait Image Set cleanup failed", ex); MessageBox.Show(Resources.MessageBox_WaitImageDeleteFailed, Resources.MessageBox_WaitImageDeleteCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void AddCommand(FtpCommands.FtpCommandHandler handler) { m_theCommandHashTable.Add(handler.Command, handler); }