Example #1
0
        private void btnEditColumns_Click(object sender, RoutedEventArgs e)
        {
            List <string>         variables = Settings.Columns.Select(c => c.Variable).ToList();
            StockPropertySelector selector  = new StockPropertySelector(variables)
            {
                Topmost = Settings.AlwaysOnTop
            };

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

                //                foreach (string variable in remove)
                //                {
                //                    variables.Remove(variable);
                //                }
                variables = variables.Except(remove).ToList();
                variables.AddRange(add);
                Settings.Columns.Clear();
                int columnId = 0;
                Settings.Columns.AddRange(variables.Select(v => new GridColumnState
                {
                    Id       = columnId++,
                    Variable = v
                }));
            }
        }
        private void btnCustomize_Click(object sender, RoutedEventArgs e)
        {
            StockPropertySelector selector = new StockPropertySelector(_shownFilters);

            if (selector.ShowDialog() == true)
            {
                List <string>        newVariables = selector.GetSelectedProperties().ToList();
                IEnumerable <string> remove       = _shownFilters.Except(newVariables).ToList();
                IEnumerable <string> add          = newVariables.Except(_shownFilters);
                foreach (string variable in remove)
                {
                    RemoveFilter(variable);
                }
                foreach (string variable in add)
                {
                    AddFilter(variable, true);
                }
            }
        }