Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / Tools / System.Activities.Presentation / System / Activities / Presentation / View / TypeResolvingOptions.cs / 1305376 / TypeResolvingOptions.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.Activities.Presentation.View { using System.Runtime; using System.Collections.ObjectModel; using System.Diagnostics.CodeAnalysis; [Fx.Tag.XamlVisible(false)] public class TypeResolvingOptions { public FuncFilter { get; set; } [SuppressMessage(FxCop.Category.Usage, FxCop.Rule.CollectionPropertiesShouldBeReadOnly, Justification = "Setter is provided to data binding on this property.")] internal ObservableCollection MostRecentlyUsedTypes { get; set; } public bool BrowseTypeDirectly { get; set; } internal static TypeResolvingOptions Merge(TypeResolvingOptions lhs, TypeResolvingOptions rhs) { if (lhs == null) { return rhs; } else if (rhs == null) { return lhs; } return new TypeResolvingOptions { Filter = FuncAnd(lhs.Filter, rhs.Filter), MostRecentlyUsedTypes = Intersect(lhs.MostRecentlyUsedTypes, rhs.MostRecentlyUsedTypes), BrowseTypeDirectly = lhs.BrowseTypeDirectly && rhs.BrowseTypeDirectly }; } static Func FuncAnd(Func lhs, Func rhs) { if (lhs == null) { return rhs; } else if (rhs == null) { return lhs; } return new Func ((e) => lhs(e) && rhs(e)); } static ObservableCollection Intersect (ObservableCollection lhs, ObservableCollection rhs) { if (lhs == null) { return rhs; } else if (rhs == null) { return lhs; } ObservableCollection collection = new ObservableCollection (); foreach (T t in lhs) { if (rhs.Contains(t)) { collection.Add(t); } } return collection; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.Activities.Presentation.View { using System.Runtime; using System.Collections.ObjectModel; using System.Diagnostics.CodeAnalysis; [Fx.Tag.XamlVisible(false)] public class TypeResolvingOptions { public Func Filter { get; set; } [SuppressMessage(FxCop.Category.Usage, FxCop.Rule.CollectionPropertiesShouldBeReadOnly, Justification = "Setter is provided to data binding on this property.")] internal ObservableCollection MostRecentlyUsedTypes { get; set; } public bool BrowseTypeDirectly { get; set; } internal static TypeResolvingOptions Merge(TypeResolvingOptions lhs, TypeResolvingOptions rhs) { if (lhs == null) { return rhs; } else if (rhs == null) { return lhs; } return new TypeResolvingOptions { Filter = FuncAnd(lhs.Filter, rhs.Filter), MostRecentlyUsedTypes = Intersect(lhs.MostRecentlyUsedTypes, rhs.MostRecentlyUsedTypes), BrowseTypeDirectly = lhs.BrowseTypeDirectly && rhs.BrowseTypeDirectly }; } static Func FuncAnd(Func lhs, Func rhs) { if (lhs == null) { return rhs; } else if (rhs == null) { return lhs; } return new Func ((e) => lhs(e) && rhs(e)); } static ObservableCollection Intersect (ObservableCollection lhs, ObservableCollection rhs) { if (lhs == null) { return rhs; } else if (rhs == null) { return lhs; } ObservableCollection collection = new ObservableCollection (); foreach (T t in lhs) { if (rhs.Contains(t)) { collection.Add(t); } } return collection; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AdornedElementPlaceholder.cs
- DataContractSerializerElement.cs
- Int16AnimationUsingKeyFrames.cs
- TdsParserSafeHandles.cs
- ControllableStoryboardAction.cs
- TextAutomationPeer.cs
- ConfigurationStrings.cs
- ToolBarButtonClickEvent.cs
- SeekableReadStream.cs
- ThreadAbortException.cs
- FixedTextBuilder.cs
- ComboBox.cs
- HostVisual.cs
- RbTree.cs
- Compilation.cs
- CharacterBufferReference.cs
- SAPIEngineTypes.cs
- XmlImplementation.cs
- UrlMappingsModule.cs
- HttpAsyncResult.cs
- DateTimePicker.cs
- BindingCompleteEventArgs.cs
- ListenerSessionConnection.cs
- ScriptHandlerFactory.cs
- WebHeaderCollection.cs
- SortedList.cs
- LabelAutomationPeer.cs
- GridViewRow.cs
- GestureRecognizer.cs
- PieceDirectory.cs
- MetafileHeader.cs
- MessageQueue.cs
- TypeDelegator.cs
- CacheMode.cs
- ServiceChannelProxy.cs
- ParallelEnumerableWrapper.cs
- ScalarType.cs
- SQlBooleanStorage.cs
- HttpDictionary.cs
- OracleDateTime.cs
- CompiledQueryCacheKey.cs
- ListSortDescription.cs
- WebMessageEncodingElement.cs
- ZoneIdentityPermission.cs
- EventMappingSettingsCollection.cs
- TableHeaderCell.cs
- RoleManagerSection.cs
- Expression.cs
- SqlNotificationEventArgs.cs
- SocketAddress.cs
- ElementUtil.cs
- OleDbTransaction.cs
- DataTableTypeConverter.cs
- HiddenFieldPageStatePersister.cs
- EncoderBestFitFallback.cs
- SubMenuStyle.cs
- MachineKeyConverter.cs
- InvalidChannelBindingException.cs
- PointAnimationUsingKeyFrames.cs
- FigureParaClient.cs
- HttpStreamMessage.cs
- HexParser.cs
- OracleCommandSet.cs
- CompiledXpathExpr.cs
- ExceptionUtil.cs
- TextElement.cs
- BitmapEffect.cs
- Rect3DValueSerializer.cs
- SecurityDescriptor.cs
- OpenTypeLayoutCache.cs
- LineGeometry.cs
- LayoutInformation.cs
- SplashScreenNativeMethods.cs
- ItemList.cs
- BinaryConverter.cs
- ItemList.cs
- SettingsProperty.cs
- OleDbReferenceCollection.cs
- ListSortDescriptionCollection.cs
- DbConnectionInternal.cs
- SystemColors.cs
- SettingsContext.cs
- XamlTypeMapper.cs
- TextTreeExtractElementUndoUnit.cs
- FileDialogCustomPlaces.cs
- RealizationDrawingContextWalker.cs
- DateTimeUtil.cs
- InlineCollection.cs
- TypedRowGenerator.cs
- DataTable.cs
- ExternalCalls.cs
- ADMembershipProvider.cs
- WebBrowserNavigatingEventHandler.cs
- _BasicClient.cs
- XmlDataImplementation.cs
- FontFamilyConverter.cs
- _NetRes.cs
- X509InitiatorCertificateClientElement.cs
- OutputScope.cs
- GraphicsContext.cs