public SolutionExplorerViewModel( [ImportMany] IEnumerable <Lazy <ISolutionType, SolutionTypeMetadata> > solutionTypes) { _shell = IoC.Get <IShell>(); _studio = IoC.Get <IStudio>(); _studio.SolutionChanged += (sender, e) => { Model = _studio.CurrentSolution; }; _solutionTypes = solutionTypes; Title = "Solution Explorer"; this.WhenAnyValue(x => x.SelectedItem).OfType <SourceFileViewModel>().Subscribe(async item => { await IoC.Get <IStudio>().OpenDocumentAsync((ISourceFile)item.Model, 1); }); this.WhenAnyValue(x => x.SelectedItem).OfType <ProjectViewModel>().Subscribe(async item => { if (item.Model is IProject p) { var sourceFile = FileSystemFile.FromPath(p, null, p.Location); await IoC.Get <IStudio>().OpenDocumentAsync(sourceFile, 1); } }); }