Example #1
0
        internal ProjectExplorerViewModel(ObservableCollection <ProjectViewModel> projects,
                                          ProjectViewModelSelectionService selectionService,
                                          ProjectService projectService,
                                          ProjectFileService projectFileService,
                                          IErrorInfoService errorInfoService,
                                          OptionService optionService,
                                          OleMenuCommandService oleMenuCommandService,
                                          IWaitIndicator waitIndicator,
                                          TextBlockBuilderService textBlockBuilderService,
                                          SearchContextFactory searchContextFactory)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            _projects           = projects ?? throw new ArgumentNullException(nameof(projects));
            _selectionService   = selectionService ?? throw new ArgumentNullException(nameof(selectionService));
            _projectService     = projectService ?? throw new ArgumentNullException(nameof(projectService));
            _projectFileService = projectFileService ?? throw new ArgumentNullException(nameof(projectFileService));

            _errorInfoService        = errorInfoService;
            _optionService           = optionService;
            _oleMenuCommandService   = oleMenuCommandService;
            _waitIndicator           = waitIndicator;
            _textBlockBuilderService = textBlockBuilderService;
            _searchContextFactory    = searchContextFactory;

            _commands = new List <Command> {
                { RefreshCommand = new RefreshCommand(this) },
                { CancelRefreshCommand = new CancelRefreshCommand(this) },
                { OpenInFileExplorerCommand = new OpenInFileExplorerCommand(this) },
                { AddProjectCommand = new AddProjectCommand(this) },
                { RemoveProjectCommand = new RemoveProjectCommand(this) },
                { UnloadProjectCommand = new UnloadProjectCommand(this) },
                { LoadProjectCommand = new LoadProjectCommand(this) },
                { SettingsCommand = new SettingsCommand(this) },
                { ExceuteDefaultCommand = new ExceuteDefaultCommand(this) },
            };

            // View
            _projectsView = (ListCollectionView)CollectionViewSource.GetDefaultView(_projects);
            // Sortierung
            _projectsView.CustomSort    = new ProjectViewModelComparer();
            _projectsView.IsLiveSorting = true;
            _projectsView.LiveSortingProperties.Add(nameof(ProjectViewModel.Status));
            _projectsView.LiveSortingProperties.Add(nameof(ProjectViewModel.PatternMatch));
            // Filter
            _projectsView.IsLiveFiltering = true;
            _projectsView.LiveFilteringProperties.Add(nameof(ProjectViewModel.Visible));
            _projectsView.Filter = vm => (vm as ProjectViewModel)?.Visible == true;

            WireEvents();
            RegisterCommands();
            UpdateCommands();

            if (_projectService.IsSolutionOpen)
            {
                RefreshCommand.Execute();
            }
        }
Example #2
0
        public ChartViewModel(IChartDataService service, IErrorInfoService errorInfo)
        {
            _service   = service;
            _errorInfo = errorInfo;
            Series     = new SeriesCollection();
            Labels     = new ObservableCollection <string>();

            Formatter = (value) => $"{value} см";
        }
        public DocumentViewModel(
            IDocumentDataSource dataSource,
            IErrorInfoService errorService)
        {
            _dataSource   = dataSource;
            _errorService = errorService;

            if (_errorService == null)
            {
                throw new ArgumentNullException(nameof(errorService), "Не найден обработчик ошибок.");
            }

            if (dataSource == null)
            {
                throw new ArgumentNullException(nameof(dataSource), "Не найден источник данных.");
            }

            NextCommand = new WindowCommand(ProcessDocument, () => !HasErrors);

            ValidateQtyCommand = new WindowCommand(ProcessValidate);
        }
        #pragma warning restore

        public ProjectExplorerViewModel CreateViewModel(
            ProjectExplorerPackage package,
            IErrorInfoService errorInfoService,
            OleMenuCommandService oleMenuCommandService)
        {
            var projects           = new ObservableCollection <ProjectViewModel>();
            var selectionService   = new ProjectViewModelSelectionService(projects);
            var projectService     = new ProjectService(_solutionService, projects);
            var projectFileService = new ProjectFileService(package);

            return(new(
                       projects               : projects,
                       selectionService       : selectionService,
                       projectService         : projectService,
                       projectFileService     : projectFileService,
                       errorInfoService       : errorInfoService,
                       optionService          : _optionService,
                       oleMenuCommandService  : oleMenuCommandService,
                       waitIndicator          : _waitIndicator,
                       textBlockBuilderService : _textBlockBuilderService,
                       searchContextFactory   : _searchContextFactory));
        }
 public MainViewModel(IErrorInfoService errorInfoService)
 {
     _errorInfoService = errorInfoService;
 }
 public ErrorController(IErrorInfoService errorInfoService)
 {
     _errorInfoService = errorInfoService;
 }
Example #7
0
 public ChartDataService(IErrorInfoService errorInfo)
 {
     _errorInfo = errorInfo;
     connection = ConfigurationManager.ConnectionStrings["ChartLookups"].ConnectionString;
 }
Example #8
0
 public ChartSettingDataService(IErrorInfoService infoService)
 {
     _infoService = infoService;
     connection   = ConfigurationManager.ConnectionStrings["ChartSettings"].ConnectionString;
 }