private void dataGridViewSettings_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (dataGridViewSettings.CurrentCell == null) { return; } if (e.ColumnIndex == 0) { if (!(bool)dataGridViewSettings.CurrentCell.Value) { CityDataSet obj = (CityDataSet)dataGridViewSettings.CurrentRow.DataBoundItem; obj.Date = DateTime.MinValue; cellDateTimePicker.Visible = false; dataGridViewSettings.Refresh(); } } }
private void LoadConfig() { mainTimer.Stop(); settingsCitiesList.Clear(); var vals = ConfigurationManager.AppSettings[SITIES].Split(';'); foreach (string val in vals) { CityDataSet dc = new CityDataSet(); var param = val.Split('|'); if (param.Length > 0 && settingsCities.ContainsKey(param[0])) { dc.City = settingsCities[param[0]]; dc.CityCode = param[0]; } if (param.Length > 1) { try { dc.Date = DateTime.ParseExact(param[1], Const.DateFormat, CultureInfo.InvariantCulture); } catch (Exception e) { Debug.WriteLine(e.ToString()); } } if (param.Length > 2) { dc.IsSelected = param[2] == "1"; } settingsCitiesList.Add(dc); } _listToMonitor.Clear(); foreach (CityDataSet city in settingsCitiesList) { if (city.IsSelected) { _listToMonitor.Add(city); } } _values.Clear(); dataGridViewResults.DataSource = null; txtIntMain.Text = ConfigurationManager.AppSettings[MainInterval]; txtInt.Text = ConfigurationManager.AppSettings[SubInterval]; dataGridViewSettings.DataSource = settingsCitiesList; cbxVisas.DataSource = settingsVisas; int visa = 1; int.TryParse(ConfigurationManager.AppSettings[TypeVisa], out visa); cbxVisas.SelectedIndex = visa; txtNotif.Text = ConfigurationManager.AppSettings[NotifCount]; int.TryParse(ConfigurationManager.AppSettings[NotifCount], out notifsett); _visaType = cbxVisas.SelectedItem.ToString(); _visaCode = getVisaId(_visaType); }