public UI_HistoryAdvanced(VM_SciChartOsciloscope sci) { vm_sciChartOsciloscope = sci; InitializeComponent(); List <string> comboItems = SaveToDisk.getHistoryValues(); foreach (var comboItem in comboItems) { combo.Items.Add(comboItem); } if (comboItems.Count != 0) { combo.SelectedItem = comboItems[0]; } }
private void Btn_Delete(object sender, RoutedEventArgs e) { if (combo.SelectedIndex == -1) { return; } SaveToDisk.DeleteHistoryFile(combo.SelectedItem.ToString()); List <string> comboItems = SaveToDisk.getHistoryValues(); combo.Items.Clear(); foreach (var comboItem in comboItems) { combo.Items.Add(comboItem); } if (comboItems.Count != 0) { combo.SelectedItem = comboItems[0]; } }
public UI_HistoryChooser(VM_SciChartOsciloscope sci) { vm_sciChartOsciloscope = sci; InitializeComponent(); List <string> comboItems = SaveToDisk.getHistoryValues(); foreach (var comboItem in comboItems) { combo.Items.Add(comboItem); } if (comboItems.Count != 0) { if (selectedIndex != -1 && comboItems.Count > selectedIndex) { combo.SelectedItem = comboItems[selectedIndex]; } else { combo.SelectedItem = comboItems[comboItems.Count - 1]; } } }