// Original constructor created the tabcmd object public BeholdEmailer(string tabcmdDirectory, string tabcmdConfigLocation, string repositoryPassword, string tableauServerUrl, string tableauServerAdminUsername, string tableauServerAdminPassword, string smtpServerName, string smtpServerUsername, string smtpServerPassword) { this.TableauServerUrl = tableauServerUrl; this.RepositoryPassword = repositoryPassword; this.SmtpServer = new SmtpClient(smtpServerName); this.HtmlEmailTemplateFilename = ""; this.TextEmailTemplateFilename = ""; // Add credentials stuff here this.Tabcmd = new Tabcmd(tabcmdDirectory, tableauServerUrl, tableauServerAdminUsername, tableauServerAdminPassword, "default", repositoryPassword, tabcmdConfigLocation); this.Logger = null; if (Configurator.GetConfigBool("save_emailed_copies_flag")) { SaveEmailsToArchive = Configurator.GetConfigBool("save_emailed_copies_flag"); } if (!String.IsNullOrEmpty(Configurator.GetConfig("export_archive_folder"))) { this.ExportArchiveFolderPath = Configurator.GetConfig("export_archive_folder"); } // Cancel action if no archive folder exists else { MessageBox.Show("Please configure the local save folder", "No Local Configuration", MessageBoxButtons.OK, MessageBoxIcon.Error); throw new ConfigurationException("Please configure the local save folder"); } }
// In this situation you create the tabcmd and smtpClient objects separately public BeholdEmailer(Tabcmd tabcmd, SmtpClient smtpClient) { this.Tabcmd = tabcmd; this.TableauServerUrl = this.Tabcmd.TableauServerUrl; this.SmtpServer = smtpClient; this.HtmlEmailTemplateFilename = ""; this.TextEmailTemplateFilename = ""; this.Logger = null; this.ExportArchiveFolderPath = null; if (Configurator.GetConfigBool("save_emailed_copies_flag")) { SaveEmailsToArchive = Configurator.GetConfigBool("save_emailed_copies_flag"); } if (!String.IsNullOrEmpty(Configurator.GetConfig("export_archive_folder"))) { this.ExportArchiveFolderPath = Configurator.GetConfig("export_archive_folder"); } // Cancel action if no archive folder exists else { MessageBox.Show("Please configure the local save folder", "No Local Configuration", MessageBoxButtons.OK, MessageBoxIcon.Error); throw new ConfigurationException("Please configure the local save folder"); } }
private void MainWindow_Load(object sender, EventArgs e) { var schedulesEnabledFlag = Configurator.GetConfigBool("schedules_enabled"); if (schedulesEnabledFlag) { enableSchedulesRadioButton.Checked = true; } else { disableSchedulesRadioButton.Checked = true; } }
public ConfigureEmailServer() { InitializeComponent(); // Load the configurations emailServer.Text = Configurator.GetConfig("smtp_server"); smtpServerUsername.Text = Configurator.GetConfig("smtp_server_username"); smtpServerPassword.Text = Configurator.GetConfig("smtp_server_password"); smtpServerTLS.Text = Configurator.GetConfig("smtp_server_tls"); smtpServerPort.Text = Configurator.GetConfig("smtp_server_port"); textEmailFilename.Text = Configurator.GetConfig("text_email_template_filename"); htmlEmailFilename.Text = Configurator.GetConfig("html_email_template_filename"); emailSender.Text = Configurator.GetConfig("email_sender"); saveLocalCopyCheckBox.Checked = Configurator.GetConfigBool("save_emailed_copies_flag"); }