コード例 #1
0
        void RequestDataForPieAndBar()
        {
            var range = RangeViewModel.GetSelectedRange();

            if (range == null)
            {
                return;
            }
            RequestData("Data", x => {
                if (ModuleType == Modules.Regions)
                {
                    return(x.GetSalesByRegion(range.Value, GroupingPeriod.All));
                }
                else if (ModuleType == Modules.Sectors)
                {
                    return(x.GetSalesBySector(range.Value, GroupingPeriod.All));
                }
                else if (ModuleType == Modules.Products)
                {
                    return(x.GetSalesByProduct(range.Value, GroupingPeriod.All));
                }
                else if (ModuleType == Modules.Channels)
                {
                    return(x.GetSalesByChannel(range.Value, GroupingPeriod.All));
                }
                throw new NotImplementedException();
            }, x => {
                BarViewModel.LoadData(x);
                PieViewModel.LoadData(x);
            });
        }
コード例 #2
0
        protected PieBarRangeViewModel(string moduleType)
        {
            ModuleType = moduleType;

            BarViewModel   = BarViewModel.Create();
            PieViewModel   = PieViewModel.Create();
            RangeViewModel = RangeViewModel.Create();
            RangeViewModel.RangeChanged         += OnRangeViewModelRangeChanged;
            RangeViewModel.SelectedRangeChanged += OnRangeViewModelSelectedRangeChanged;

            RequestDataForRange();
            RequestDataForPieAndBar();
        }