public VsixShellViewModel(ResourceManager resourceManager) { Contract.Requires(resourceManager != null); _selectedCodeGeneratorsChangedThrottle = new DispatcherThrottle(() => OnPropertyChanged(nameof(SelectedCodeGenerators))); _resourceManager = resourceManager; _resourceManager.SelectedEntities.CollectionChanged += (_, __) => _selectedCodeGeneratorsChangedThrottle.Tick(); _resourceManager.Loaded += (_, __) => _selectedCodeGeneratorsChangedThrottle.Tick(); }
private CodeReferenceConfiguration CreateCodeReferenceConfiguration() { _codeReferences = GetValue(default(CodeReferenceConfiguration)) ?? CodeReferenceConfiguration.Default; _codeReferences.ItemPropertyChanged += (_, __) => _codeReferencesChangeThrottle.Tick(); return(_codeReferences); }
public ResourceViewModel([NotNull] ResourceManager resourceManager, [NotNull] Configuration configuration, [NotNull] ISourceFilesProvider sourceFilesProvider, [NotNull] CodeReferenceTracker codeReferenceTracker, [NotNull] ITracer tracer, [NotNull] PerformanceTracer performanceTracer) { Contract.Requires(resourceManager != null); Contract.Requires(configuration != null); Contract.Requires(sourceFilesProvider != null); Contract.Requires(codeReferenceTracker != null); Contract.Requires(tracer != null); Contract.Requires(performanceTracer != null); _resourceManager = resourceManager; _configuration = configuration; _sourceFilesProvider = sourceFilesProvider; _codeReferenceTracker = codeReferenceTracker; _tracer = tracer; _performanceTracer = performanceTracer; _resourceTableEntiyCountUpdateThrottle = new DispatcherThrottle(() => OnPropertyChanged(nameof(ResourceTableEntryCount))); _resourceTableEntries = _selectedEntities.ObservableSelectMany(entity => entity.Entries); _resourceTableEntries.CollectionChanged += (_, __) => _resourceTableEntiyCountUpdateThrottle.Tick(); _restartFindCodeReferencesThrottle = new DispatcherThrottle(DispatcherPriority.ContextIdle, () => BeginFindCodeReferences(sourceFilesProvider.SourceFiles)); resourceManager.TableEntries.CollectionChanged += (_, __) => _restartFindCodeReferencesThrottle.Tick(); resourceManager.LanguageChanged += ResourceManager_LanguageChanged; }
private MoveToResourceConfiguration CreateMoveToResourceConfiguration(MoveToResourceConfiguration current) { _moveToResources = current ?? MoveToResourceConfiguration.Default; _moveToResources.ItemPropertyChanged += (_, __) => _moveToResourcesChangeThrottle.Tick(); return(_moveToResources); }
private DataGridColumn CreateColumn([NotNull] ProjectPropertyName projectPropertyName) { Contract.Requires(projectPropertyName != null); var column = new DataGridTextColumn { Header = new TextBlock { Text = projectPropertyName.DisplayName }, Width = new DataGridLength(1, DataGridLengthUnitType.Star), Binding = new Binding(@"PropertyValue[" + projectPropertyName.Name + @"]") { Mode = BindingMode.TwoWay }, }; column.EnableMultilineEditing(); column.SetValue(DataGridFilterColumn.TemplateProperty, AssociatedObject?.FindResource(ResourceKeys.MultipleChoiceFilterTemplate)); column.SetValue(ProjectPropertyNameProperty, projectPropertyName); column.SetValue(PropertyNameProperty, projectPropertyName.Name); _columnsCreatedThrottle.Tick(); return(column); }
private void SelectedEntities_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { _updateThrottle.Tick(); IsLoading = true; Dispatcher.ProcessMessages(DispatcherPriority.Render); }
private void SetCodeProvider(CodeGenerator codeGenerator) { _resourceManager.SelectedEntities .Select(x => x.NeutralProjectFile) .OfType <DteProjectFile>() .ForEach(pf => pf.CodeGenerator = codeGenerator); _selectedCodeGeneratorsChangedThrottle.Tick(); }
private MoveToResourceConfiguration LoadMoveToResourceConfiguration(MoveToResourceConfiguration current) { Contract.Ensures(Contract.Result <MoveToResourceConfiguration>() != null); _moveToResources = current ?? MoveToResourceConfiguration.Default; _moveToResources.ItemPropertyChanged += (_, __) => _moveToResourcesChangeThrottle.Tick(); return(_moveToResources); }
private CodeReferenceConfiguration LoadCodeReferenceConfiguration() { Contract.Ensures(Contract.Result <CodeReferenceConfiguration>() != null); // ReSharper disable once ExplicitCallerInfoArgument _codeReferences = GetValue(default(CodeReferenceConfiguration), nameof(CodeReferences)) ?? CodeReferenceConfiguration.Default; _codeReferences.ItemPropertyChanged += (_, __) => _codeReferencesChangeThrottle.Tick(); return(_codeReferences); }
private SourceFileExclusionFilterConfiguration LoadSourceFileExclusionFilterConfiguration() { Contract.Ensures(Contract.Result <SourceFileExclusionFilterConfiguration>() != null); // ReSharper disable once ExplicitCallerInfoArgument _sourceFileExclusionFilters = GetValue(default(SourceFileExclusionFilterConfiguration), nameof(SourceFileExclusionFilters)) ?? SourceFileExclusionFilterConfiguration.Default; _sourceFileExclusionFilters.ItemPropertyChanged += (_, __) => _sourceFileExclusionFiltersChangeThrottle.Tick(); return(_sourceFileExclusionFilters); }
public void Enqueue(IEnumerable <EnvDTE.ProjectItem> projectItems) { if (projectItems == null) { return; } _projectItems.AddRange(projectItems); _throttle.Tick(); }
private void SelectedEntities_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { _updateThrottle.Tick(); IsLoading = true; // using (_performanceTracer.Start("Dispatcher.ProcessMessages")) { Dispatcher.ProcessMessages(DispatcherPriority.Render); } }
private void DisplaySettings_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == nameof(DisplaySettings.StyleWindowTitleBar)) { if (!DisplaySettingsPanel.CurrentDisplaySettings.StyleWindowTitleBar) { restartNotificationThrottle.Tick(); return; } UpdateWindowStyle(); } }
private void Initialize() { if (_projectPropertyNames == null) { return; } var dataGrid = AssociatedObject; if (dataGrid == null) { return; } dataGrid.Columns.AddRange(_projectPropertyNames.OfType <ProjectPropertyName>().Select(CreateColumn)); dataGrid.ColumnDisplayIndexChanged += (_, __) => _displayIndexChangedThrottle.Tick(); }
public void Reload(bool forceFindCodeReferences) { try { using (_performanceTracer.Start("ResourceManager.Load")) { var sourceFiles = _sourceFilesProvider.SourceFiles; _codeReferenceTracker.StopFind(); if (_resourceManager.Reload(sourceFiles, _configuration.DuplicateKeyHandling) || forceFindCodeReferences) { _restartFindCodeReferencesThrottle.Tick(); } _configuration.Reload(); } } catch (Exception ex) { _tracer.TraceError(ex.ToString()); } }
private void Solution_Changed(string action) { _tracer.WriteLine(action); _deferredUpdateThrottle.Tick(); }
private void Comments_ValueChanged(object sender, EventArgs e) { _deferredCommentChangedThrottle.Tick(); }
private void SaveChanges() { _deferredSaveThrottle.Tick(); }
protected override void OnAttached() { base.OnAttached(); var listBox = AssociatedObject; if (listBox == null) { return; } listBox.SelectAll(); listBox.SelectionChanged += ListBox_SelectionChanged; ((INotifyCollectionChanged)listBox.Items).CollectionChanged += (_, __) => _collectionChangedThrottle.Tick(); _performanceTracer = listBox.GetExportProvider().GetExportedValue <PerformanceTracer>(); }
private void DataGrid_ColumnDisplayIndexChanged(object sender, DataGridColumnEventArgs e) { _updateColumnGripperToolTipVisibilityThrottle.Tick(); }
protected override void OnAttached() { base.OnAttached(); var listBox = AssociatedObject; if (listBox == null) { return; } listBox.SelectAll(); listBox.SelectionChanged += ListBox_SelectionChanged; ((INotifyCollectionChanged)listBox.Items).CollectionChanged += (_, __) => _collectionChangedThrottle.Tick(); }
private void Solution_Changed() { _deferredUpdateThrottle.Tick(); }