本文整理汇总了C#中Lazy.Where方法的典型用法代码示例。如果您正苦于以下问题:C# Lazy.Where方法的具体用法?C# Lazy.Where怎么用?C# Lazy.Where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lazy
的用法示例。
在下文中一共展示了Lazy.Where方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WpfTextViewConnectionListenerService
public WpfTextViewConnectionListenerService(IWpfTextView wpfTextView, Lazy<IWpfTextViewConnectionListener, IContentTypeAndTextViewRoleMetadata>[] wpfTextViewConnectionListeners) {
if (wpfTextView == null)
throw new ArgumentNullException(nameof(wpfTextView));
if (wpfTextViewConnectionListeners == null)
throw new ArgumentNullException(nameof(wpfTextViewConnectionListeners));
this.wpfTextView = wpfTextView;
listenerInfos = wpfTextViewConnectionListeners.Where(a => wpfTextView.Roles.ContainsAny(a.Metadata.TextViewRoles)).Select(a => new ListenerInfo(a)).ToArray();
wpfTextView.Closed += WpfTextView_Closed;
wpfTextView.TextDataModel.ContentTypeChanged += TextDataModel_ContentTypeChanged;
InitializeListeners();
}
示例2: WpfHexViewMarginProviderCollectionImpl
public WpfHexViewMarginProviderCollectionImpl(Lazy<WpfHexViewMarginProvider, IWpfHexViewMarginMetadata>[] wpfHexViewMarginProviders, WpfHexViewHost wpfHexViewHost, WpfHexViewMargin marginContainer, string marginContainerName) {
if (wpfHexViewMarginProviders == null)
throw new ArgumentNullException(nameof(wpfHexViewMarginProviders));
if (wpfHexViewHost == null)
throw new ArgumentNullException(nameof(wpfHexViewHost));
if (marginContainer == null)
throw new ArgumentNullException(nameof(marginContainer));
if (marginContainerName == null)
throw new ArgumentNullException(nameof(marginContainerName));
this.wpfHexViewMarginProviders = wpfHexViewMarginProviders.Where(a =>
StringComparer.OrdinalIgnoreCase.Equals(marginContainerName, a.Metadata.MarginContainer) &&
wpfHexViewHost.HexView.Roles.ContainsAny(a.Metadata.TextViewRoles)
).ToArray();
this.wpfHexViewHost = wpfHexViewHost;
this.marginContainer = marginContainer;
currentMargins = Array.Empty<WpfHexViewMarginInfo>();
wpfHexViewHost.Closed += WpfHexViewHost_Closed;
UpdateMargins();
}
示例3: WpfHexViewImpl
#pragma warning restore 0169
public WpfHexViewImpl(HexBuffer buffer, VSTE.ITextViewRoleSet roles, VSTE.IEditorOptions parentOptions, HexEditorOptionsFactoryService hexEditorOptionsFactoryService, ICommandService commandService, FormattedHexSourceFactoryService formattedHexSourceFactoryService, HexViewClassifierAggregatorService hexViewClassifierAggregatorService, HexAndAdornmentSequencerFactoryService hexAndAdornmentSequencerFactoryService, HexBufferLineFormatterFactoryService bufferLineProviderFactoryService, HexClassificationFormatMapService classificationFormatMapService, HexEditorFormatMapService editorFormatMapService, HexAdornmentLayerDefinitionService adornmentLayerDefinitionService, HexLineTransformProviderService lineTransformProviderService, HexSpaceReservationStackProvider spaceReservationStackProvider, Lazy<WpfHexViewCreationListener, IDeferrableTextViewRoleMetadata>[] wpfHexViewCreationListeners, VSTC.IClassificationTypeRegistryService classificationTypeRegistryService, Lazy<HexCursorProviderFactory, ITextViewRoleMetadata>[] hexCursorProviderFactories) {
if (buffer == null)
throw new ArgumentNullException(nameof(buffer));
if (roles == null)
throw new ArgumentNullException(nameof(roles));
if (parentOptions == null)
throw new ArgumentNullException(nameof(parentOptions));
if (hexEditorOptionsFactoryService == null)
throw new ArgumentNullException(nameof(hexEditorOptionsFactoryService));
if (commandService == null)
throw new ArgumentNullException(nameof(commandService));
if (formattedHexSourceFactoryService == null)
throw new ArgumentNullException(nameof(formattedHexSourceFactoryService));
if (hexViewClassifierAggregatorService == null)
throw new ArgumentNullException(nameof(hexViewClassifierAggregatorService));
if (hexAndAdornmentSequencerFactoryService == null)
throw new ArgumentNullException(nameof(hexAndAdornmentSequencerFactoryService));
if (bufferLineProviderFactoryService == null)
throw new ArgumentNullException(nameof(bufferLineProviderFactoryService));
if (classificationFormatMapService == null)
throw new ArgumentNullException(nameof(classificationFormatMapService));
if (editorFormatMapService == null)
throw new ArgumentNullException(nameof(editorFormatMapService));
if (adornmentLayerDefinitionService == null)
throw new ArgumentNullException(nameof(adornmentLayerDefinitionService));
if (lineTransformProviderService == null)
throw new ArgumentNullException(nameof(lineTransformProviderService));
if (spaceReservationStackProvider == null)
throw new ArgumentNullException(nameof(spaceReservationStackProvider));
if (wpfHexViewCreationListeners == null)
throw new ArgumentNullException(nameof(wpfHexViewCreationListeners));
if (classificationTypeRegistryService == null)
throw new ArgumentNullException(nameof(classificationTypeRegistryService));
if (hexCursorProviderFactories == null)
throw new ArgumentNullException(nameof(hexCursorProviderFactories));
canvas = new HexViewCanvas(this);
Buffer = buffer;
thisHexLineTransformSource = new MyHexLineTransformSource(this);
this.bufferLineProviderFactoryService = bufferLineProviderFactoryService;
mouseHoverHelper = new MouseHoverHelper(this);
physicalLineCache = new PhysicalLineCache(32);
visiblePhysicalLines = new List<PhysicalLine>();
invalidatedRegions = new List<HexBufferSpan>();
this.formattedHexSourceFactoryService = formattedHexSourceFactoryService;
zoomLevel = VSTE.ZoomConstants.DefaultZoom;
DsImage.SetZoom(VisualElement, zoomLevel / 100);
this.adornmentLayerDefinitionService = adornmentLayerDefinitionService;
this.lineTransformProviderService = lineTransformProviderService;
this.wpfHexViewCreationListeners = wpfHexViewCreationListeners.Where(a => roles.ContainsAny(a.Metadata.TextViewRoles)).ToArray();
recreateLineTransformProvider = true;
normalAdornmentLayerCollection = new HexAdornmentLayerCollection(this, HexLayerKind.Normal);
overlayAdornmentLayerCollection = new HexAdornmentLayerCollection(this, HexLayerKind.Overlay);
underlayAdornmentLayerCollection = new HexAdornmentLayerCollection(this, HexLayerKind.Underlay);
canvas.IsVisibleChanged += WpfHexView_IsVisibleChanged;
Roles = roles;
Options = hexEditorOptionsFactoryService.GetOptions(this);
Options.Parent = parentOptions;
ViewScroller = new HexViewScrollerImpl(this);
hasKeyboardFocus = canvas.IsKeyboardFocusWithin;
oldViewState = new HexViewState(this);
aggregateClassifier = hexViewClassifierAggregatorService.GetClassifier(this);
hexAndAdornmentSequencer = hexAndAdornmentSequencerFactoryService.Create(this);
classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(this);
editorFormatMap = editorFormatMapService.GetEditorFormatMap(this);
spaceReservationStack = spaceReservationStackProvider.Create(this);
textLayer = new TextLayer(GetAdornmentLayer(PredefinedHexAdornmentLayers.Text));
HexSelection = new HexSelectionImpl(this, GetAdornmentLayer(PredefinedHexAdornmentLayers.Selection), editorFormatMap);
HexCaret = new HexCaretImpl(this, GetAdornmentLayer(PredefinedHexAdornmentLayers.Caret), classificationFormatMap, classificationTypeRegistryService);
canvas.Children.Add(underlayAdornmentLayerCollection);
canvas.Children.Add(normalAdornmentLayerCollection);
canvas.Children.Add(overlayAdornmentLayerCollection);
canvas.Focusable = true;
canvas.FocusVisualStyle = null;
InitializeOptions();
Options.OptionChanged += EditorOptions_OptionChanged;
Buffer.ChangedLowPriority += HexBuffer_ChangedLowPriority;
Buffer.BufferSpanInvalidated += Buffer_BufferSpanInvalidated;
aggregateClassifier.ClassificationChanged += AggregateClassifier_ClassificationChanged;
hexAndAdornmentSequencer.SequenceChanged += HexAndAdornmentSequencer_SequenceChanged;
classificationFormatMap.ClassificationFormatMappingChanged += ClassificationFormatMap_ClassificationFormatMappingChanged;
editorFormatMap.FormatMappingChanged += EditorFormatMap_FormatMappingChanged;
spaceReservationStack.GotAggregateFocus += SpaceReservationStack_GotAggregateFocus;
spaceReservationStack.LostAggregateFocus += SpaceReservationStack_LostAggregateFocus;
UpdateBackground();
CreateFormattedLineSource(ViewportWidth);
var dummy = BufferLines;
HexSelection.Initialize();
HexCaret.Initialize();
InitializeZoom();
UpdateRemoveExtraTextLineVerticalPixels();
if (Roles.Contains(PredefinedHexViewRoles.Interactive))
RegisteredCommandElement = commandService.Register(VisualElement, this);
else
//.........这里部分代码省略.........
示例4: WpfTextView
#pragma warning restore 0169
public WpfTextView(ITextViewModel textViewModel, ITextViewRoleSet roles, IEditorOptions parentOptions, IEditorOptionsFactoryService editorOptionsFactoryService, ICommandService commandService, ISmartIndentationService smartIndentationService, IFormattedTextSourceFactoryService formattedTextSourceFactoryService, IViewClassifierAggregatorService viewClassifierAggregatorService, ITextAndAdornmentSequencerFactoryService textAndAdornmentSequencerFactoryService, IClassificationFormatMapService classificationFormatMapService, IEditorFormatMapService editorFormatMapService, IAdornmentLayerDefinitionService adornmentLayerDefinitionService, ILineTransformProviderService lineTransformProviderService, ISpaceReservationStackProvider spaceReservationStackProvider, IWpfTextViewConnectionListenerServiceProvider wpfTextViewConnectionListenerServiceProvider, IBufferGraphFactoryService bufferGraphFactoryService, Lazy<IWpfTextViewCreationListener, IDeferrableContentTypeAndTextViewRoleMetadata>[] wpfTextViewCreationListeners) {
if (textViewModel == null)
throw new ArgumentNullException(nameof(textViewModel));
if (roles == null)
throw new ArgumentNullException(nameof(roles));
if (parentOptions == null)
throw new ArgumentNullException(nameof(parentOptions));
if (editorOptionsFactoryService == null)
throw new ArgumentNullException(nameof(editorOptionsFactoryService));
if (commandService == null)
throw new ArgumentNullException(nameof(commandService));
if (smartIndentationService == null)
throw new ArgumentNullException(nameof(smartIndentationService));
if (formattedTextSourceFactoryService == null)
throw new ArgumentNullException(nameof(formattedTextSourceFactoryService));
if (viewClassifierAggregatorService == null)
throw new ArgumentNullException(nameof(viewClassifierAggregatorService));
if (textAndAdornmentSequencerFactoryService == null)
throw new ArgumentNullException(nameof(textAndAdornmentSequencerFactoryService));
if (classificationFormatMapService == null)
throw new ArgumentNullException(nameof(classificationFormatMapService));
if (editorFormatMapService == null)
throw new ArgumentNullException(nameof(editorFormatMapService));
if (adornmentLayerDefinitionService == null)
throw new ArgumentNullException(nameof(adornmentLayerDefinitionService));
if (lineTransformProviderService == null)
throw new ArgumentNullException(nameof(lineTransformProviderService));
if (spaceReservationStackProvider == null)
throw new ArgumentNullException(nameof(spaceReservationStackProvider));
if (wpfTextViewCreationListeners == null)
throw new ArgumentNullException(nameof(wpfTextViewCreationListeners));
if (wpfTextViewConnectionListenerServiceProvider == null)
throw new ArgumentNullException(nameof(wpfTextViewConnectionListenerServiceProvider));
if (bufferGraphFactoryService == null)
throw new ArgumentNullException(nameof(bufferGraphFactoryService));
mouseHoverHelper = new MouseHoverHelper(this);
physicalLineCache = new PhysicalLineCache(32);
visiblePhysicalLines = new List<PhysicalLine>();
invalidatedRegions = new List<SnapshotSpan>();
this.formattedTextSourceFactoryService = formattedTextSourceFactoryService;
zoomLevel = ZoomConstants.DefaultZoom;
DsImage.SetZoom(VisualElement, zoomLevel / 100);
this.adornmentLayerDefinitionService = adornmentLayerDefinitionService;
this.lineTransformProviderService = lineTransformProviderService;
this.wpfTextViewCreationListeners = wpfTextViewCreationListeners.Where(a => roles.ContainsAny(a.Metadata.TextViewRoles)).ToArray();
recreateLineTransformProvider = true;
normalAdornmentLayerCollection = new AdornmentLayerCollection(this, LayerKind.Normal);
overlayAdornmentLayerCollection = new AdornmentLayerCollection(this, LayerKind.Overlay);
underlayAdornmentLayerCollection = new AdornmentLayerCollection(this, LayerKind.Underlay);
IsVisibleChanged += WpfTextView_IsVisibleChanged;
Properties = new PropertyCollection();
TextViewModel = textViewModel;
BufferGraph = bufferGraphFactoryService.CreateBufferGraph(TextViewModel.VisualBuffer);
Roles = roles;
Options = editorOptionsFactoryService.GetOptions(this);
Options.Parent = parentOptions;
ViewScroller = new ViewScroller(this);
hasKeyboardFocus = IsKeyboardFocusWithin;
oldViewState = new ViewState(this);
aggregateClassifier = viewClassifierAggregatorService.GetClassifier(this);
textAndAdornmentSequencer = textAndAdornmentSequencerFactoryService.Create(this);
classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(this);
editorFormatMap = editorFormatMapService.GetEditorFormatMap(this);
spaceReservationStack = spaceReservationStackProvider.Create(this);
textLayer = new TextLayer(GetAdornmentLayer(PredefinedAdornmentLayers.Text));
Selection = new TextSelection(this, GetAdornmentLayer(PredefinedAdornmentLayers.Selection), editorFormatMap);
TextCaret = new TextCaret(this, GetAdornmentLayer(PredefinedAdornmentLayers.Caret), smartIndentationService, classificationFormatMap);
Children.Add(underlayAdornmentLayerCollection);
Children.Add(normalAdornmentLayerCollection);
Children.Add(overlayAdornmentLayerCollection);
Cursor = Cursors.IBeam;
Focusable = true;
FocusVisualStyle = null;
InitializeOptions();
Options.OptionChanged += EditorOptions_OptionChanged;
TextBuffer.ChangedLowPriority += TextBuffer_ChangedLowPriority;
TextViewModel.DataModel.ContentTypeChanged += DataModel_ContentTypeChanged;
aggregateClassifier.ClassificationChanged += AggregateClassifier_ClassificationChanged;
textAndAdornmentSequencer.SequenceChanged += TextAndAdornmentSequencer_SequenceChanged;
classificationFormatMap.ClassificationFormatMappingChanged += ClassificationFormatMap_ClassificationFormatMappingChanged;
editorFormatMap.FormatMappingChanged += EditorFormatMap_FormatMappingChanged;
spaceReservationStack.GotAggregateFocus += SpaceReservationStack_GotAggregateFocus;
spaceReservationStack.LostAggregateFocus += SpaceReservationStack_LostAggregateFocus;
UpdateBackground();
CreateFormattedLineSource(ViewportWidth);
InitializeZoom();
UpdateRemoveExtraTextLineVerticalPixels();
if (Roles.Contains(PredefinedTextViewRoles.Interactive))
RegisteredCommandElement = commandService.Register(VisualElement, this);
else
RegisteredCommandElement = NullRegisteredCommandElement.Instance;
wpfTextViewConnectionListenerServiceProvider.Create(this);
//.........这里部分代码省略.........