コード例 #1
0
        private void btnApply_Click(object sender, EventArgs e)
        {
            try
            {
                if (chkRemoveDups.Checked)
                {
                    RemoveDuplicates();
                }

                _list.Clear();

                _list.AddRange(_destListBox);

                bool does    = (chkContains.Checked && !string.IsNullOrEmpty(txtContains.Text));
                bool doesnot = (chkNotContains.Checked && !string.IsNullOrEmpty(txtDoesNotContain.Text));

                if (lbRemove.Items.Count > 0)
                {
                    FilterList();
                }

                if (does || doesnot)
                {
                    FilterMatches(does, doesnot);
                }

                if (_destListBox.Items.Count > 0 && _destListBox.Items[0] is Article)
                {
                    FilterNamespace();
                }

                if (_list.Count != _destListBox.Items.Count)
                {
                    _destListBox.BeginUpdate();
                    _destListBox.Items.Clear();
                    _destListBox.Items.AddRange(_list.ToArray());
                    _destListBox.EndUpdate();
                }

                if (chkSortAZ.Checked)
                {
                    _destListBox.Sort();
                }

                //Only try to update number of articles using listmaker method IF the parent is indeed a listmaker
                //Causes exception on DBScanner otherwise
                if (_destListBox.Parent is ListMaker)
                {
                    (_destListBox.Parent as ListMaker).UpdateNumberOfArticles();
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.HandleException(ex);
            }
            DialogResult = DialogResult.OK;
        }