private void buttonRefresh_Click(object sender, EventArgs e) { string selected = (string)comboLogs.SelectedItem; string[] logNames = LogWatcher.GetLogNames(); comboLogs.DataSource = logNames; if (logNames.Contains(selected)) { comboLogs.SelectedItem = selected; } }
public FormMain() { InitializeComponent(); Rectangle bounds = Screen.AllScreens.Last().Bounds; Top = bounds.Top; Left = bounds.Left; Width = bounds.Width; _CitadelLogs = new DataTable(); _CitadelLogs.Columns.Add("Text", typeof(string)); _CitadelLogs.Columns.Add("System", typeof(string)); dataGridIntel.DataSource = _CitadelLogs; logWatcherIntel.LogName = Settings.Default.intelLogName; comboLogs.DataSource = LogWatcher.GetLogNames(); comboLogs.SelectedItem = Settings.Default.intelLogName; comboLogs.SelectedIndexChanged += comboLogs_SelectedIndexChanged; numMaxVisibleSystems.Value = Settings.Default.maxVisibleSystems; numMaxVisibleSystems.ValueChanged += numMaxVisibleSystems_ValueChanged; _ComboBoxSystemsSetValue = true; comboBoxSystems.DataSource = DbHelper.DataContext.SolarSystems.ToArray(); _ComboBoxSystemsSetValue = false; if (Settings.Default.currentSystemId != 0) { SolarSystem solarSystem = DbHelper.DataContext.SolarSystems.First(o => o.Id == Settings.Default.currentSystemId); map.CurrentSystemName = solarSystem.SolarSystemName; _ComboBoxSystemsSetValue = true; comboBoxSystems.SelectedItem = solarSystem; _ComboBoxSystemsSetValue = false; } hotkeyControlKosCheck.Hotkey = Settings.Default.kosCheckKey & ~cModifiers; hotkeyControlKosCheck.HotkeyModifiers = Settings.Default.kosCheckKey & cModifiers; InitHook(); }