public override void Init() { var addRepo = new Func <object, Task <Unit> >(o => { Action <string> okAction = url => { m_SettingsManager.Settings.Repositories.Add(url); }; var inputBoxVm = m_ViewModelFactory.CreateInputBoxViewModel("Enter URL of new repository", okAction, s => { }); ShowDialog(inputBoxVm); return(Task.FromResult(Unit.Default)); }); var removeRepo = new Func <object, Task <Unit> >(o => { string url = o as string; m_SettingsManager.Settings.Repositories.Remove(url); return(Task.FromResult(Unit.Default)); }); RepositoryEditorViewModel = new StringCollectionEditorViewModel(m_SettingsManager.Settings.Repositories, addRepo, removeRepo, "Repositories"); RepositoryEditorViewModel.Init(); var addExclusion = new Func <object, Task <Unit> >(o => { Action <string> okAction = packName => { m_SettingsManager.Settings.ExcludedPackages.Add(packName); }; var inputBoxVm = m_ViewModelFactory.CreateInputBoxViewModel("Enter name of excluded package", okAction, s => { }); ShowDialog(inputBoxVm); return(Task.FromResult(Unit.Default)); }); var removeExclusion = new Func <object, Task <Unit> >(o => { string packName = o as string; m_SettingsManager.Settings.ExcludedPackages.Remove(packName); return(Task.FromResult(Unit.Default)); }); ExclusionsEditorViewModel = new StringCollectionEditorViewModel(m_SettingsManager.Settings.ExcludedPackages, addExclusion, removeExclusion, "Excluded packages"); ExclusionsEditorViewModel.Init(); m_GraphManager.Documents.ToObservableChangeSet() .ObserveOnDispatcher() .Transform(CreateGraphViewModel) .Bind(Graphs) .Do(set => { var change = set.FirstOrDefault(); if (change == null) { return; } if (set.Adds > 0) { SwitchTo(change.Item.Current); } else if (set.Removes > 0) { ClearView(); } }) .DisposeMany() .Subscribe() .AddDisposableTo(Disposables); CmdAddNewGraph = ReactiveCommand.CreateAsyncTask(_ => { Action <string> okaction = name => { var graphHandler = m_GraphManager.CreateNewDocument(name); Task.Run(() => { graphHandler.ResolveDependencies(); }); }; Action <string> cancelAction = txt => { }; var inputVm = m_ViewModelFactory.CreateInputBoxViewModel("Enter name of Packge to investigate", okaction, cancelAction); ShowDialog(inputVm); return(Task.FromResult(Unit.Default)); }).AddDisposableTo(Disposables); CmdOpenSolution = ReactiveCommand.CreateAsyncTask(_ => { OpenFileDialog openFileDialog = new OpenFileDialog { Filter = "VS Solution (*.sln) | *.sln|C# Project (*.csproj)|*.csproj|Visual Basic Project (*.vbproj)|*.vbproj|Visual C++ Project (*.vcxproj)|*.vcxproj | All files (*.*)|*.*", Multiselect = false }; var result = openFileDialog.ShowDialog(); if (!result.HasValue || !result.Value) { return(Task.FromResult(false)); } var graphHandler = m_GraphManager.CreateNewDocument(openFileDialog.FileName); Task.Run(() => { graphHandler.ResolveDependencies(); }); return(Task.FromResult(Unit.Default)); }).AddDisposableTo(Disposables); CmdRefreshGraph = ReactiveCommand.CreateAsyncTask(o => { var result = o as ResolutionResult; var graphHandler = m_GraphManager.Documents.FirstOrDefault(handler => handler.Result == result); if (graphHandler == null) { return(Task.FromResult(Unit.Default)); } Task.Run(() => { graphHandler.ResolveDependencies(); }); return(Task.FromResult(Unit.Default)); }).AddDisposableTo(Disposables); CmdCancel = ReactiveCommand.CreateAsyncTask(o => { var result = o as ResolutionResult; var graphHandler = m_GraphManager.Documents.FirstOrDefault(handler => handler.Result == result); if (graphHandler == null) { return(Task.FromResult(Unit.Default)); } graphHandler.Cancel(); return(Task.FromResult(Unit.Default)); }).AddDisposableTo(Disposables); CmdDeleteGraph = ReactiveCommand.CreateAsyncTask(o => { var result = o as ResolutionResult; var graphHandler = m_GraphManager.Documents.FirstOrDefault(handler => handler.Result == result); if (graphHandler == null) { return(Task.FromResult(Unit.Default)); } m_GraphManager.Delete(graphHandler); return(Task.FromResult(Unit.Default)); }).AddDisposableTo(Disposables); }