Exemplo n.º 1
0
        public CountLimitationBarChartVM CreateBarChartVM(string limitationName, int showOnRemaining = -1, Color backgroundColor = null)
        {
            var limitation = Get <CountLimitationVM> (limitationName);

            if (limitation == null)
            {
                return(null);
            }

            TwoBarChartVM barChart = new TwoBarChartVM(new SeriesVM {
                Title = "Remaining", Elements = limitation.Remaining, Color = App.Current.Style.ColorAccentSuccess
            },
                                                       new SeriesVM {
                Title = "Current", Elements = limitation.Count, Color = Color.Transparent
            },
                                                       limitation.Maximum);

            barChart.Height     = 10;
            barChart.Background = App.Current.ResourcesLocator.LoadImage("images/lm-widget-full-bar" + Constants.IMAGE_EXT);

            var result = new CountLimitationBarChartVM(showOnRemaining)
            {
                Limitation = limitation, BarChart = barChart
            };

            if (backgroundColor != null)
            {
                result.BackgroundColor = backgroundColor;
            }
            result.Bind();
            return(result);
        }
Exemplo n.º 2
0
        void CreateViewModels(int max, int count, bool enabled, int showOnRemaining = -1)
        {
            countLimitationVM = new CountLimitationVM {
                Model = new CountLicenseLimitation {
                    Maximum      = max,
                    Count        = count,
                    Enabled      = enabled,
                    DisplayName  = "testLimitation",
                    RegisterName = "test"
                }
            };

            twoBarChartVM = new TwoBarChartVM(new SeriesVM {
                Title = "Remaining", Elements = countLimitationVM.Remaining,
                Color = Color.Green1
            },
                                              new SeriesVM {
                Title = "Current", Elements = countLimitationVM.Count,
                Color = Color.Transparent
            }, countLimitationVM.Maximum);

            viewModel = new CountLimitationBarChartVM(showOnRemaining)
            {
                Limitation = countLimitationVM,
                BarChart   = twoBarChartVM
            };
        }