예제 #1
0
        //////////////////////////////////////////////////////////////////////////
        private void OnUnignoreItem(object sender, EventArgs e)
        {
            StringItem StrItem = null;

            if (ListIgnored.SelectedItems.Count > 0)
            {
                ListViewItem Item = ListIgnored.SelectedItems[0];
                StrItem = Item.Tag as StringItem;

                if (StrItem != null)
                {
                    StrItem.Ignored = false;
                    Mgr.ProjectStrings.Add(StrItem);
                    Mgr.IgnoredStrings.Remove(StrItem);

                    int OrigSelIndex = Item.Index;
                    ListIgnored.Items.Remove(Item);

                    int SelIndex = Math.Min(ListIgnored.Items.Count - 1, OrigSelIndex);
                    if (SelIndex >= 0)
                    {
                        ListIgnored.Items[SelIndex].Selected = true;
                        ListIgnored.EnsureVisible(SelIndex);
                    }

                    ListViewItem ListItem = AddStringToList(StrItem, true);
                    SelIndex = ListItem.Index;
                    if (SelIndex >= 0)
                    {
                        ListStrings.Items[SelIndex].Selected = true;
                        ListStrings.EnsureVisible(SelIndex);
                    }
                }
            }
        }
예제 #2
0
        //////////////////////////////////////////////////////////////////////////
        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();
        }
예제 #3
0
        //////////////////////////////////////////////////////////////////////////
        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();
        }