示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Map" /> class.
        /// </summary>
        public Map()
        {
            Focusable = false;
            ClipToBounds = true;
            _updateThrottle = new DispatcherThrottle(DispatcherPriority.Background, Update);

            Loaded += (_, __) => ViewportSize = (Vector)this.GetPhysicalPixelSize() * 512.0;
        }
        public ProjectFile(Solution solution, Project project)
        {
            Contract.Requires(solution != null);
            Contract.Requires(project != null);

            _deferredSaveThrottle = new DispatcherThrottle(SaveProjectFile);
            _solution = solution;
            _project = project;

            FileTime = File.GetLastWriteTime(project.FullName);

            _projectGuid = GetProjectGuid(solution, project.UniqueName);
        }
        public Solution(ITracer tracer, IVsServiceProvider serviceProvider)
        {
            Contract.Requires(tracer != null);
            Contract.Requires(serviceProvider != null);

            _deferredUpdateThrottle = new DispatcherThrottle(DispatcherPriority.ContextIdle, Update);

            _tracer = tracer;
            _serviceProvider = serviceProvider;

            _specificProjectConfigurations = Projects.ObservableSelectMany(prj => prj.SpecificProjectConfigurations);
            _solutionContexts = SolutionConfigurations.ObservableSelectMany(cfg => cfg.Contexts);
            _defaultProjectConfigurations = Projects.ObservableSelect(prj => prj.DefaultProjectConfiguration);
            _projectConfigurations = new ObservableCompositeCollection<ProjectConfiguration>(_defaultProjectConfigurations, _specificProjectConfigurations);

            _solutionEvents = Dte?.Events?.SolutionEvents;
            if (_solutionEvents != null)
            {
                _solutionEvents.Opened += Solution_Changed;
                _solutionEvents.AfterClosing += Solution_Changed;
                _solutionEvents.ProjectAdded += _ => Solution_Changed();
                _solutionEvents.ProjectRemoved += _ => Solution_Changed();
                _solutionEvents.ProjectRenamed += (_, __) => Solution_Changed();
            }

            Update();
        }