Example #1
0
        internal SettingsForm()
        {
            InitializeComponent();

            CrawlerProcessMaxNumber.Text = CrawlerHostManager.Properties.Settings.Default.CrawlerProcessMaxNumber.ToString();
            SmtpHost.Text           = CrawlerHost.Properties.Settings.Default.SmtpHost;
            SmtpLogin.Text          = CrawlerHost.Properties.Settings.Default.SmtpLogin;
            SmtpPassword.Text       = CrawlerHost.Properties.Settings.Default.SmtpPassword;
            SmtpPort.Text           = CrawlerHost.Properties.Settings.Default.SmtpPort.ToString();
            AdminEmailSender.Text   = CrawlerHost.Properties.Settings.Default.EmailSender;
            DefaultAdminEmails.Text = CrawlerHost.Properties.Settings.Default.DefaultAdminEmails;
            DbConnectionString.Text = DbApi.GetConnectionString();
            //if (string.IsNullOrWhiteSpace(DbConnectionString.Text))
            //    DbConnectionString.Text = CrawlerHost.Properties.Settings.Default.DbConnectionString;
        }
Example #2
0
        private void load_table()
        {
            try
            {
                this.crawlersTableAdapter1.Connection.ConnectionString = DbApi.GetConnectionString();
                this.crawlersTableAdapter1.Fill(this.cliverCrawlersDataSet1.Crawlers);
                //dataGridView1.AutoResizeColumns();

                //foreach (DataColumn c in CrawlersTableAdapter1.GetData().Columns)
                //    if (c.ColumnName.StartsWith("_"))
                //        c.AllowDBNull = true;

                DataGridViewComboBoxColumn c_ = (DataGridViewComboBoxColumn)dataGridView1.Columns["Command_"];
                c_.DataSource = Enum.GetValues(typeof(Crawler.Command));
                c_.ValueType  = typeof(Crawler.Command);
                //c_.ValueMember = "Value";
                //c_.DisplayMember = "Display";
                foreach (DataGridViewRow r in dataGridView1.Rows)
                {
                    try
                    {
                        r.Cells[command_i_].Value = (Crawler.Command)r.Cells[command_i].Value;
                    }
                    catch
                    {
                        r.Cells[command_i_].Value = -1;
                    }
                }

                c_            = (DataGridViewComboBoxColumn)dataGridView1.Columns["State_"];
                c_.DataSource = Enum.GetValues(typeof(Crawler.State));
                c_.ValueType  = typeof(Crawler.State);
                foreach (DataGridViewRow r in dataGridView1.Rows)
                {
                    try
                    {
                        r.Cells[state_i_].Value = (Crawler.State)r.Cells[state_i].Value;
                    }
                    catch
                    {
                        r.Cells[state_i_].Value = -1;
                    }
                }

                c_ = (DataGridViewComboBoxColumn)dataGridView1.Columns["_LastSessionState_"];
                c_.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing;
                c_.DataSource   = Enum.GetValues(typeof(Crawler.SessionState));
                c_.ValueType    = typeof(Crawler.SessionState);
                foreach (DataGridViewRow r in dataGridView1.Rows)
                {
                    try
                    {
                        r.Cells[_last_session_state_i_].Value = (Crawler.SessionState)r.Cells[_last_session_state_i].Value;
                    }
                    catch
                    {
                        r.Cells[_last_session_state_i_].Value = 0;
                    }
                }
            }
            catch (Exception ex)
            {
                LogMessage.Error(ex);
            }
        }