private void cbSearch_TextUpdate(object sender, EventArgs e) { ListViewItem lvi = lvList.FindItemWithText(cbSearch.Text, !ckIDOnly.Checked, (lvList.SelectedItems.Count > 0)?lvList.SelectedItems[0].Index:0); if (lvi != null) { SHListViewUtil.SelectIndex(lvList, lvi.Index); } }
private void cbSearchText_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Enter) { int nSearchIndex = (lvList.SelectedIndices.Count > 0 && lvList.SelectedIndices[0] != lvList.Items.Count) ? lvList.SelectedIndices[0] + 1 : 0; ListViewItem lvi = lvList.FindItemWithText(cbSearchText.Text, (cbIDOnly.Checked != true), nSearchIndex, true); if (lvi == null) { lvi = lvList.FindItemWithText(cbSearchText.Text, (cbIDOnly.Checked != true), 0, true); } if (lvi != null) { SHListViewUtil.SelectIndex(lvList, lvi.Index); cbSearchText.AutoCompleteCustomSource.Add(cbSearchText.Text); } } }
private void VelixianObjBrowser_Load(object sender, EventArgs e) { ListViewItem lviSelected = null; switch (DataType) { case VOBType.Quest: for (int i = 0; i < SHXmlCore.CurrentCore.Quests.dataList.Count; i++) { SHQuest quest = (SHQuest)SHXmlCore.CurrentCore.Talents.dataList[i]; ListViewItem lvi = new ListViewItem(new string[] { quest.id.ToString(), quest.title }); if (SelectedTag == quest.id.ToString()) { lviSelected = lvi; } lvi.Tag = quest.title.ToString(); lvList.Items.Add(lvi); } break; case VOBType.Item: for (int i = 0; i < SHXmlCore.CurrentCore.Items.dataList.Count; i++) { SHItem item = (SHItem)SHXmlCore.CurrentCore.Items.dataList[i]; ListViewItem lvi = new ListViewItem(new string[] { item.id.ToString(), item.name }); if (SelectedTag == item.id.ToString()) { lviSelected = lvi; } lvi.Tag = item.id.ToString(); lvList.Items.Add(lvi); } break; case VOBType.Talent: for (int i = 0; i < SHXmlCore.CurrentCore.Talents.dataList.Count; i++) { SHTalent talent = (SHTalent)SHXmlCore.CurrentCore.Talents.dataList[i]; ListViewItem lvi = new ListViewItem(new string[] { talent.id.ToString(), talent.name }); if (SelectedTag == talent.id.ToString()) { lviSelected = lvi; } lvi.Tag = talent.id.ToString(); lvList.Items.Add(lvi); } break; case VOBType.String: for (int i = 0; i < SHXmlCore.CurrentCore.Strings.dataList.Count; i++) { SHString str = (SHString)SHXmlCore.CurrentCore.Strings.dataList[i]; ListViewItem lvi = new ListViewItem(new string[] { str.Key, str.String }); if (SelectedTag == str.Key) { lviSelected = lvi; } lvi.Tag = str.Key; lvList.Items.Add(lvi); } break; } if (lviSelected != null) { SHListViewUtil.SelectIndex(lvList, lviSelected.Index); } else { SHListViewUtil.SelectIndex(lvList, 0); } lvList.Select(); }