示例#1
0
        public String FormatAggregatedName(Column column, ColumnType type, AggregativeFunction.BaseAggregation aggregativeFunction)
        {
            if (aggregativeFunction is AggregativeFunction.MinAggregation ||
                aggregativeFunction is AggregativeFunction.MaxAggregation ||
                aggregativeFunction is AggregativeFunction.MeanAggregation ||
                aggregativeFunction is AggregativeFunction.SumAggregation)
            {
                return(String.Format(aggregatedColumnNameFormat, aggregativeFunction.Name, column.Name));
            }

            return(column.Name);
        }
示例#2
0
        SelectionChangedEventHandler CreateAggregationChangedHandler(ColumnViewModel columnViewModel)
        {
            return(new SelectionChangedEventHandler((sender, args) =>
            {
                ComboBox comboBox = sender as ComboBox;
                String selectedName = (comboBox.SelectedItem as ComboBoxItem).Content.ToString();
                AggregativeFunction.BaseAggregation aggregativeFunction = AggregativeFunction.FromName(selectedName);

                Logger.Instance.Log($"aggregation changed,{columnViewModel.Column.Name},{columnViewModel.AggregativeFunction.Name},{aggregativeFunction.Name}");

                columnViewModel.AggregativeFunction = aggregativeFunction;

                mainPageViewModel.ReflectAll(ReflectReason.ColumnChanged); //.ColumnViewModelChanged);
            }));
        }
示例#3
0
        SelectionChangedEventHandler CreateColumnChangedHandler(ColumnViewModel currentColumnViewModel, AggregativeFunction.BaseAggregation defaultAggregativeFunction)
        {
            return(new SelectionChangedEventHandler((sender, args) =>
            {
                ComboBox comboBox = sender as ComboBox;
                String selectedName = (comboBox.SelectedItem as ComboBoxItem).Content.ToString();
                ColumnViewModel selectedColumnViewModel = mainPageViewModel.SheetViewModel.ColumnViewModels.First(cvm => cvm.Name == selectedName);

                // selectedColumnViewModel로 이제 바꾸면 됨. 이 과정에 대해서는 explorationViewModel의 PageViewTapped를 참고하면 좋다.

                Logger.Instance.Log($"column changed,{currentColumnViewModel.Column.Name},{selectedColumnViewModel.Column.Name}");

                // 1. 컬럼의 상태 변경
                if (selectedColumnViewModel.IsSelected)
                {
                    Int32 index1 = ViewStatus.SelectedColumnViewModels.FindIndex(cvm => cvm == currentColumnViewModel);
                    Int32 index2 = ViewStatus.SelectedColumnViewModels.FindIndex(cvm => cvm == selectedColumnViewModel);
                    ViewStatus.SelectedColumnViewModels[index1] = selectedColumnViewModel;
                    ViewStatus.SelectedColumnViewModels[index2] = currentColumnViewModel;
                    ViewStatus.Refresh();
                }
                else
                {
                    currentColumnViewModel.IsSelected = false;
                    selectedColumnViewModel.IsSelected = true;

                    Int32 index = ViewStatus.SelectedColumnViewModels.FindIndex(cvm => cvm == currentColumnViewModel);
                    ViewStatus.SelectedColumnViewModels[index] = selectedColumnViewModel;
                    ViewStatus.Refresh();
                }

                if (selectedColumnViewModel.Type == ColumnType.Numerical && defaultAggregativeFunction != null)
                {
                    selectedColumnViewModel.AggregativeFunction = defaultAggregativeFunction;
                }

                mainPageViewModel.ReflectAll(ReflectReason.ColumnChanged); // 2.ColumnViewModelChanged);
            }));
        }