////////////////////////////////////////////////////////////////////////// private void Reload() { UpdateStatusLocked = true; int OrigSelIndex = -1; if (ListStrings.SelectedIndices.Count > 0) { OrigSelIndex = ListStrings.SelectedIndices[0]; } if (Mgr != null) { if (Mgr.ProjectStrings != null) { ListStrings.BeginUpdate(); ListStrings.Items.Clear(); foreach (StringItem StrItem in Mgr.ProjectStrings) { if (HideStringsWithID && StrItem.ID != string.Empty) { continue; } AddStringToList(StrItem); } ListStrings.EndUpdate(); } if (Mgr.IgnoredStrings != null) { ListIgnored.BeginUpdate(); ListIgnored.Items.Clear(); foreach (StringItem StrItem in Mgr.IgnoredStrings) { if (StrItem.IgnoreReason == IgnoreReason.AlreadyInTable) { continue; } AddStringToIgnoreList(StrItem); } ListIgnored.EndUpdate(); } } int SelIndex = Math.Min(ListStrings.Items.Count - 1, OrigSelIndex); if (SelIndex >= 0) { ListStrings.Items[SelIndex].Selected = true; ListStrings.EnsureVisible(SelIndex); } UpdateStatusLocked = false; UpdateStringStatus(); }
////////////////////////////////////////////////////////////////////////// private void IgnoreItems(bool AddToIgnoreList) { StringItem[] SelectedItems = GetSelectedStrings(); if (SelectedItems.Length == 0) { return; } if (AddToIgnoreList) { if (MessageBox.Show("Selected item(s) will be ignored and added to the ignore list. Continue?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } } ListStrings.BeginUpdate(); ListIgnored.BeginUpdate(); int OrigSelIndex = -1; if (ListStrings.SelectedIndices.Count > 0) { OrigSelIndex = ListStrings.SelectedIndices[0]; } if (ListStrings.CheckedItems.Count > 0) { foreach (ListViewItem Item in ListStrings.CheckedItems) { IgnoreSingleItem(Item, AddToIgnoreList); } } else if (ListStrings.SelectedIndices.Count > 0) { foreach (ListViewItem Item in ListStrings.SelectedItems) { IgnoreSingleItem(Item, AddToIgnoreList); } } // select ignored int SelIndex; SelIndex = ListIgnored.Items.Count - 1; if (SelIndex >= 0) { ListIgnored.Items[SelIndex].Selected = true; ListIgnored.EnsureVisible(SelIndex); } // select string SelIndex = Math.Min(ListStrings.Items.Count - 1, OrigSelIndex); if (SelIndex >= 0) { ListStrings.Items[SelIndex].Selected = true; ListStrings.EnsureVisible(SelIndex); } ListStrings.EndUpdate(); ListIgnored.EndUpdate(); UpdateStringStatus(); }