/// <summary>
        /// 全选一组
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button btnGroup = sender as Button;

            //IEnumerable<Clipper.Model.DetectItems> items= mDetectItems.Where<Clipper.Model.DetectItems>(x => x.DetectVariety.typeName == btnGroup.Content.ToString());
            foreach (Clipper.Model.DetectItems model in mDetectItems)
            {
                if (model.DetectVariety.typeName == btnGroup.Content.ToString())
                {
                    if (SelectedItem == null)
                    {
                        SelectedItem = new ObservableCollection <Clipper.Model.DetectItems>();
                    }
                    //if (!SelectedItem.Contains(model))
                    //{
                    SelectedItem.Add(model);
                    //}
                    CurrentItem = model;
                    if (SelectionChangedEvent != null)
                    {
                        SelectionChangedEvent.Invoke(sender, null);
                    }
                }
            }
        }
        /// <summary>
        /// Add a drop down item to the Add button.
        /// </summary>
        private void AddAddAction(string text, Func <IAction> builder)
        {
            var item = new ToolStripMenuItem(text);

            item.Click += (s, x) =>
            {
                var action = builder();
                var node   = SelectedItem.Add(action);
                tvItems.SelectedNode = node;
            };
            tbAdd.DropDownItems.Add(item);
        }
        public void Add()
        {
            using (var dialog = new AddCustomTagDialog(Module))
            {
                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                var newItem = dialog.Item;
                var service = (IConfigurationService)GetService(typeof(IConfigurationService));
                SelectedItem.Add(newItem);
                service.ServerManager.CommitChanges();
            }
            OnRewriteSettingsSaved();
        }
        //选中检测项事件
        private void SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ListBox _listview = sender as ListBox;

            Clipper.Model.DetectItems model = _listview.SelectedItem as Clipper.Model.DetectItems;
            if (model != null)
            {
                if (SelectedItem == null)
                {
                    SelectedItem = new ObservableCollection <Clipper.Model.DetectItems>();
                }
                //if (!SelectedItem.Contains(model))
                //{
                SelectedItem.Add(model);
                //}
                CurrentItem = model;
                if (SelectionChangedEvent != null)
                {
                    SelectionChangedEvent.Invoke(sender, e);
                }
            }
        }
        //选中检测项事件
        private void Select_Click(object sender, RoutedEventArgs e)
        {
            Button           _btn = sender as Button;
            ContentPresenter _contentPresenter = _btn.Content as ContentPresenter;

            Clipper.Model.DetectItems model = _contentPresenter.Content as Clipper.Model.DetectItems;
            if (model != null)
            {
                if (SelectedItem == null)
                {
                    SelectedItem = new ObservableCollection <Clipper.Model.DetectItems>();
                }
                //if (!SelectedItem.Contains(model))
                //{
                SelectedItem.Add(model);
                //}
                CurrentItem = model;
                if (SelectionChangedEvent != null)
                {
                    SelectionChangedEvent.Invoke(sender, null);
                }
            }
        }