public Tool( IPackageContext packageContext, BuildInfo buildContext, IBuildDistributor buildDistributor, ControlViewModel viewModel) { _dte = packageContext.GetDTE(); if (_dte == null) throw new InvalidOperationException("Unable to get DTE instance."); _dteStatusBar = packageContext.GetStatusBar(); if (_dteStatusBar == null) TraceManager.TraceError("Unable to get IVsStatusbar instance."); _toolWindowManager = new ToolWindowManager(packageContext); _buildContext = buildContext; _buildDistributor = buildDistributor; _viewModel = viewModel; _solutionEvents = _dte.Events.SolutionEvents; Initialize(); }
private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { Debug.Assert(DataContext != null); _viewModel = (ControlViewModel)DataContext; _viewModel.GridColumnsRef = Grid.Columns; _viewModel.PropertyChanged += ViewModelOnPropertyChanged; _viewModel.Model.SolutionItem.Projects.CollectionChanged += ProjectsOnCollectionChanged; }
private ControlView CreateMyControl() { var packageContext = (IPackageContext)Package; var viewMode = new ControlViewModel(new ControlModel(), packageContext); var view = new ControlView { DataContext = viewMode }; return view; }