示例#1
0
        public SettingsViewModel(Window window, Settings settings, ImageService imageService,
                                 PathInfo pathInfo, ReportsViewerController controller, List <string> groupNames)
        {
            _window       = window;
            _settings     = settings;
            _pathInfo     = pathInfo;
            _imageService = imageService;
            _controller   = controller;
            _groupNames   = groupNames;

            WindowTitle = "Settings";

            DisplayDateSuffixWithReportName = settings.DisplayDateSuffixWithReportName;
            GroupType = GroupTypes.FirstOrDefault(a => a.Type == settings.GroupByType) ?? GroupTypes.First();

            var reportTemplates = new List <ReportTemplate>();

            foreach (var reportTemplate in _controller.GetCustomReportTemplates())
            {
                if (!string.IsNullOrEmpty(reportTemplate.Path) && File.Exists(reportTemplate.Path))
                {
                    reportTemplate.IsAvailable = true;
                }

                reportTemplates.Add(reportTemplate);
            }

            _reportTemplates = new ObservableCollection <ReportTemplate>(reportTemplates);
        }
示例#2
0
        public void RefreshView(Settings settings, List <Report> reports)
        {
            Settings   = settings;
            _groupType = GroupTypes.FirstOrDefault(a => a.Type == settings.GroupByType) ?? GroupTypes.First();
            OnPropertyChanged(nameof(GroupType));

            _reports = reports;

            Task.Run(() => ApplyFilter(true));
        }
示例#3
0
        public ReportsNavigationViewModel(List <Report> reports, Settings settings, PathInfo pathInfo)
        {
            _reports         = reports;
            _filteredReports = _reports;

            Settings      = settings;
            _pathInfo     = pathInfo;
            _filterString = string.Empty;

            _groupType = GroupTypes.FirstOrDefault(a => a.Type == settings.GroupByType) ?? GroupTypes.First();

            Task.Run(() => ApplyFilter(true));
        }