public ProjectFolderViewModel(IProjectFolder model) : base(model) { shell = IoC.Get <IShell>(); Items = new ObservableCollection <ProjectItemViewModel>(); Items.BindCollections(model.Items, p => { return(Create(p)); }, (pivm, p) => pivm.Model == p); NewItemCommand = ReactiveCommand.Create(); NewItemCommand.Subscribe(_ => { shell.ModalDialog = new NewItemDialogViewModel(model); shell.ModalDialog.ShowDialog(); }); RemoveCommand = ReactiveCommand.Create(); RemoveCommand.Subscribe(_ => { model.Project.ExcludeFolder(model); }); }
public ProjectViewModel(SolutionViewModel solutionViewModel, IProject model) : base(model) { shell = IoC.Get <IShell>(); Items = new ObservableCollection <ProjectItemViewModel>(); Items.BindCollections(model.Items, p => { return(ProjectItemViewModel.Create(p)); }, (pivm, p) => pivm.Model == p); ConfigureCommand = ReactiveCommand.Create(); ConfigureCommand.Subscribe(o => { if (configuration == null) { configuration = new ProjectConfigurationDialogViewModel(model, () => { configuration = null; }); shell.AddDocument(configuration); } else { shell.SelectedDocument = configuration; } //shell.ModalDialog.ShowDialog(); }); DebugCommand = ReactiveCommand.Create(); DebugCommand.Subscribe(_ => { //shell.Debug(model); }); BuildCommand = ReactiveCommand.Create(); BuildCommand.Subscribe(o => { shell.Build(model); }); CleanCommand = ReactiveCommand.Create(); CleanCommand.Subscribe(o => { shell.Clean(model); }); ManageReferencesCommand = ReactiveCommand.Create(); ManageReferencesCommand.Subscribe(o => { }); SetProjectCommand = ReactiveCommand.Create(); SetProjectCommand.Subscribe(o => { model.Solution.StartupProject = model; model.Solution.Save(); shell.InvalidateCodeAnalysis(); foreach (var project in solutionViewModel.Projects) { project.Invalidate(); } }); OpenInExplorerCommand = ReactiveCommand.Create(); OpenInExplorerCommand.Subscribe(o => { Process.Start(Model.CurrentDirectory); }); NewItemCommand = ReactiveCommand.Create(); NewItemCommand.Subscribe(_ => { shell.ModalDialog = new NewItemDialogViewModel(model); shell.ModalDialog.ShowDialog(); }); RemoveCommand = ReactiveCommand.Create(); RemoveCommand.Subscribe(async o => { await shell.CloseDocumentsForProjectAsync(Model); Model.Solution.RemoveProject(Model); Model.Solution.Save(); }); }