public MainWindowViewModel(UserInterface userInterface, StatusInfo statusInfo, OpenedProjects openedProjects) { if (userInterface == null) { throw new ArgumentNullException(nameof(userInterface)); } if (statusInfo == null) { throw new ArgumentNullException(nameof(statusInfo)); } if (openedProjects == null) { throw new ArgumentNullException(nameof(openedProjects)); } this.userInterface = userInterface; this.statusInfo = statusInfo; this.openedProjects = openedProjects; // Create commands SelectAllFlagsCommand = new SelectAllFlagsCommand(userInterface, openedProjects); SelectNoFlagsCommand = new SelectNoFlagsCommand(userInterface, openedProjects); CopyCommand = new CopyCommand(userInterface, openedProjects); PasteCommand = new PasteCommand(userInterface, openedProjects); CreateProjectCommand = new CreateProjectCommand(userInterface, openedProjects); CloseCurrentProjectCommand = new CloseCurrentProjectCommand(userInterface, openedProjects); DigitCommand = new DigitCommand(userInterface, openedProjects); // Initialize everything IEnumerable <ProjectViewModel> projects = openedProjects .Select(x => new ProjectViewModel(userInterface, statusInfo, openedProjects, x)); Projects = new ObservableCollection <ProjectViewModel>(projects); SelectedProject = Projects.FirstOrDefault(); mainTitle = new MainTitle(openedProjects); mainTitle.Changed += HandleMainTitleChanged; Title = mainTitle.ToString(); this.openedProjects.CurrentProjectChanged += HandleCurrentProjectChanged; this.openedProjects.ProjectCreated += HandleProjectCreated; this.openedProjects.ProjectClosed += HandleProjectClosed; IsNoTabInfoVisible = Projects.Count == 0; }
private void HandleMainTitleChanged(object sender, EventArgs eventArgs) { Title = mainTitle.ToString(); }