private void lstNames_Format(object sender, ListControlConvertEventArgs e) { CaretHandlerInfo item = e.ListItem as CaretHandlerInfo; if (item != null) { e.Value = item.DisplayName; } else { e.Value = "(null)"; } }
private void lstNames_SelectedIndexChanged(object sender, EventArgs e) { CaretHandlerInfo item = lstNames.SelectedItem as CaretHandlerInfo; if (item == null) { webDocumentation.DocumentText = ResourceLoader.LoadString("NoDocumentationHtml"); } else { webDocumentation.DocumentText = item.Documentation; IndentTheme theme = ActiveTheme; if (theme != null && lstNames.Enabled) { theme.CaretHandler = item.TypeName; OnThemeChanged(theme); } } }
private void SelectItem(string name) { try { lstNames.Enabled = false; lstNames.SelectedIndex = -1; for (int i = 0; i < lstNames.Items.Count; ++i) { CaretHandlerInfo item = lstNames.Items[i] as CaretHandlerInfo; if (item != null && item.TypeName.Equals(name, StringComparison.Ordinal)) { lstNames.SelectedIndex = i; return; } } ICaretHandlerMetadata metadata = CaretHandlerBase.MetadataFromName(name); for (int i = 0; i < lstNames.Items.Count; ++i) { CaretHandlerInfo item = lstNames.Items[i] as CaretHandlerInfo; if (item != null) { ICaretHandlerMetadata metadata2 = CaretHandlerBase.MetadataFromName(item.TypeName); if (metadata == metadata2) { lstNames.SelectedIndex = i; return; } } } if (lstNames.Items.Count > 0) { lstNames.SelectedIndex = 0; } } finally { lstNames.Enabled = true; } }