예제 #1
0
        private void BtnCustomizeFilters_OnClick(object sender, RoutedEventArgs e)
        {
            StockPropertySelector selector = new StockPropertySelector(_shownFilters, true);

            if (selector.ShowDialog() == true)
            {
                List <string>        newList = selector.GetSelectedProperties().ToList();
                IEnumerable <string> oldList = _shownFilters;
                IEnumerable <string> add     = newList.Except(oldList);
                List <string>        remove  = oldList.Except(newList).ToList();

                _shownFilters = newList;

                List <FilterCriteria> criterias = GetCriteria().ToList();

                foreach (FilterCriteria criteria in criterias)
                {
                    if (remove.Contains(criteria.Variable))
                    {
                        Filters.Children.Remove(criteria);
                    }
                }
                foreach (string variable in add)
                {
                    AddFilter(variable, false);
                }
            }
        }
예제 #2
0
        private void btnEditColumns_Click(object sender, RoutedEventArgs e)
        {
            StockPropertySelector selector = new StockPropertySelector(GridColumns.Keys.ToList());

            if (selector.ShowDialog() == true)
            {
                IEnumerable <string> newList = selector.GetSelectedProperties().ToList();
                IEnumerable <string> oldList = GridColumns.Keys.ToList();
                //                ClearGridColumns();
                IEnumerable <string> add    = newList.Except(oldList);
                IEnumerable <string> remove = oldList.Except(newList);

                foreach (string variable in remove)
                {
                    RemoveGridColumn(variable);
                }

                foreach (string columnVariable in add)
                {
                    AddGridColumn(columnVariable);
                }
            }
        }