public ReportsViewModel(
            MainWindow mainWindow, log4net.ILog log,
            MainBooksModel mainModel, MainViewModel parent)
        {
            _mainWindow = mainWindow;
            _log        = log;
            _mainModel  = mainModel;
            _parent     = parent;

            if (!_mainModel.TalliedMonths.Any())
            {
                return;
            }

            DateTime lastMonth = FirstMonth = _mainModel.TalliedMonths.Last().MonthDate;

            FirstMonth     = _mainModel.TalliedMonths.First().MonthDate;
            lastMonth      = lastMonth.AddMonths(1);
            lastMonth      = lastMonth.AddDays(-1);
            LastMonth      = lastMonth;
            _selectedMonth = lastMonth.AddMonths(-1);
            TalliedMonths  = new ObservableCollection <TalliedMonth>();
            _mainModel.SelectedMonthTally = GetSelectedMonthTally();

            PlotCurrentMonthPagesReadByLanguage =
                new OxyPlotPair(new CurrentMonthPagesReadByLanguagePlotGenerator(), "CurrentMonthPagesReadByLanguage");
            PlotCurrentMonthPagesReadByCountry =
                new OxyPlotPair(new CurrentMonthPagesReadByCountryPlotGenerator(), "CurrentMonthPagesReadByCountry");

            PlotCurrentMonthDocumentPagesReadByLanguage =
                new OxyPlotPair(new CurrentMonthPagesReadByLanguagePlotGenerator(), "CurrentMonthPagesReadByLanguage");
            PlotCurrentMonthDocumentPagesReadByCountry =
                new OxyPlotPair(new CurrentMonthPagesReadByCountryPlotGenerator(), "CurrentMonthPagesReadByCountry");

            PlotCurrentMonthPrintPagesReadByLanguage =
                new OxyPlotPair(new CurrentMonthPagesReadByLanguagePlotGenerator(), "CurrentMonthPagesReadByLanguage");
            PlotCurrentMonthPrintPagesReadByCountry =
                new OxyPlotPair(new CurrentMonthPagesReadByCountryPlotGenerator(), "CurrentMonthPagesReadByCountry");

            ReportsTallies =
                new ObservableCollection <MonthlyReportsTally>
            {
                new MonthlyReportsTally(_mainModel.SelectedMonthTally),
                new MonthlyReportsTally(_mainModel.BookDeltas.Last().OverallTally)
            };
        }
示例#2
0
        public ChartSelectionViewModel(
            MainWindow mainWindow, log4net.ILog log,
            MainBooksModel mainModel, MainViewModel parent)
        {
            _mainWindow = mainWindow;
            _log        = log;
            _mainModel  = mainModel;
            _parent     = parent;

            PlotOverallBookAndPageTallies =
                new OxyPlotPair(new OverallBookAndPageTalliesPlotGenerator(), "OverallBookAndPage");
            PlotDaysPerBook =
                new OxyPlotPair(new DaysPerBookPlotGenerator(), "DaysPerBook");
            PlotPageRate =
                new OxyPlotPair(new PageRatePlotGenerator(), "PageRate");
            PlotPagesPerBook =
                new OxyPlotPair(new PagesPerBookPlotGenerator(), "PagesPerBook");

            AvailableCharts = new List <ChartPair>()
            {
                new ChartPair {
                    Name = "Overall Books and Pages", Plot = PlotOverallBookAndPageTallies
                },
                new ChartPair {
                    Name = "Days Per Book", Plot = PlotDaysPerBook
                },
                new ChartPair {
                    Name = "Page Rate", Plot = PlotPageRate
                },
                new ChartPair {
                    Name = "Pages per Book", Plot = PlotPagesPerBook
                },
            };

            SelectedChart = AvailableCharts.First();

#if Works
            PlotBooksInTranslation =
                new OxyPlotPair(new BooksInTranslationPlotGenerator(), "BooksInTranslation");
            PlotDaysPerBookWithTime =
                new OxyPlotPair(new DaysPerBookWithTimePlotGenerator(), "DaysPerBook");
            PlotPagesPerDayWithTime =
                new OxyPlotPair(new PagesPerDayWithTimePlotGenerator(), "PagesPerDayWithTime");
            PlotAverageDaysPerBook =
                new OxyPlotPair(new AverageDaysPerBookPlotGenerator(), "AverageDaysPerBook");
            PlotPercentageBooksReadByLanguage =
                new OxyPlotPair(new PercentageBooksReadByLanguagePlotGenerator(), "PercentageBooksReadByLanguage");
            PlotTotalBooksReadByLanguage =
                new OxyPlotPair(new TotalBooksReadByLanguagePlotGenerator(), "TotalBooksReadByLanguage");
            PlotPercentagePagesReadByLanguage =
                new OxyPlotPair(new PercentagePagesReadByLanguagePlotGenerator(), "PercentagePagesReadByLanguage");
            PlotTotalPagesReadByLanguage =
                new OxyPlotPair(new TotalPagesReadByLanguagePlotGenerator(), "TotalPagesReadByLanguage");
            PlotPercentageBooksReadByCountry =
                new OxyPlotPair(new PercentageBooksReadByCountryPlotGenerator(), "PercentageBooksReadByCountry");
            PlotTotalBooksReadByCountry =
                new OxyPlotPair(new TotalBooksReadByCountryPlotGenerator(), "TotalBooksReadByCountry");
            PlotPercentagePagesReadByCountry =
                new OxyPlotPair(new PercentagePagesReadByCountryPlotGenerator(), "PercentagePagesReadByCountry");
            PlotTotalPagesReadByCountry =
                new OxyPlotPair(new TotalPagesReadByCountryPlotGenerator(), "TotalPagesReadByCountry");
            PlotTotalPagesReadByLanguage =
                new OxyPlotPair(new TotalPagesReadByLanguagePlotGenerator(), "TotalPagesReadByLanguage");
            PlotBooksAndPagesThisYear =
                new OxyPlotPair(new BooksAndPagesThisYearPlotGenerator(), "BooksAndPagesThisYear");
            PlotCurrentPagesReadByCountry =
                new OxyPlotPair(new CurrentPagesReadByCountryPlotGenerator(), "CurrentPagesReadByCountry");
            PlotCurrentBooksReadByCountry =
                new OxyPlotPair(new CurrentBooksReadByCountryPlotGenerator(), "CurrentBooksReadByCountry");
            PlotBooksAndPagesLastTen =
                new OxyPlotPair(new BooksAndPagesLastTenPlotGenerator(), "BooksAndPagesLastTen", true);
            PlotBooksAndPagesLastTenTranslation =
                new OxyPlotPair(new BooksAndPagesLastTenTranslationPlotGenerator(), "BooksAndPagesLastTenTranslation", true);
            PlotCountryLocationsBooksAndPages =
                new OxyPlotPair(new CountryLocationsBooksAndPagesPlotGenerator(), "CountryLocationsBooksAndPages", true);
            PlotCountryLocationsBooksRead =
                new OxyPlotPair(new CountryLocationsBooksReadPlotGenerator(), "CountryLocationsBooksRead", true);
            PlotLatitudeWithTime =
                new OxyPlotPair(new LatitudeWithTimePlotGenerator(), "LatitudeWithTime");
            PlotLongitudeWithTime =
                new OxyPlotPair(new LongitudeWithTimePlotGenerator(), "LongitudeWithTime");
            PlotTalliesPerCalendarYear =
                new OxyPlotPair(new TalliesPerCalendarYearPlotGenerator(), "TalliesPerCalendar");
            PlotMonthlyBookTalliesByCalendarYear =
                new OxyPlotPair(new MonthlyBookTalliesByCalendarYearPlotGenerator(
                                    MonthlyBookTalliesByCalendarYearPlotGenerator.ChartType.BooksAsColumns),
                                "MonthlyBookTalliesByCalendarYear");
            PlotMonthlyPageTalliesByCalendarYear =
                new OxyPlotPair(new MonthlyBookTalliesByCalendarYearPlotGenerator(
                                    MonthlyBookTalliesByCalendarYearPlotGenerator.ChartType.PagesAsColumns),
                                "MonthlyPageTalliesByCalendarYear");
            PlotMonthlyBookAndPageTalliesByCalendarYear =
                new OxyPlotPair(new MonthlyBookTalliesByCalendarYearPlotGenerator(
                                    MonthlyBookTalliesByCalendarYearPlotGenerator.ChartType.BothAsLines),
                                "MonthlyBookAndPageTalliesByCalendarYear");

            PlotWorldCountriesMap =
                new OxyPlotPair(new WorldCountriesMapPlotGenerator(), "WorldCountriesMap", true);
            PlotWorldCountriesMapBooksRead =
                new OxyPlotPair(new WorldCountriesMapBooksReadPlotGenerator(), "WorldCountriesMapBooksRead", true);
            PlotWorldCountriesMapPagesRead =
                new OxyPlotPair(new WorldCountriesMapPagesReadPlotGenerator(), "WorldCountriesMapPagesRead", true);
            PlotWorldCountriesMapWithBooksRead =
                new OxyPlotPair(new WorldCountriesMapWithBooksReadPlotGenerator(), "WorldCountriesMapWithBooksRead", true);
            PlotWorldCountriesMapLastTenLatLong =
                new OxyPlotPair(new WorldCountriesMapLastTenLatLongPlotGenerator(), "WorldCountriesMapLastTenLatLong", true);
#endif
        }