Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities / Microsoft / VisualBasic / Activities / XamlIntegration / VisualBasicSettingsConverter.cs / 1407647 / VisualBasicSettingsConverter.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace Microsoft.VisualBasic.Activities.XamlIntegration { using System; using System.ComponentModel; using System.Runtime; using System.Globalization; using System.Activities; // this class is necessary in order for our value serializer to get called by XAML, // even though the functionality is a no-op public sealed class VisualBasicSettingsConverter : TypeConverter { public VisualBasicSettingsConverter() : base() { } public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { if (sourceType == TypeHelper.StringType) { return true; } return base.CanConvertFrom(context, sourceType); } public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == TypeHelper.StringType) { return false; } return base.CanConvertTo(context, destinationType); } public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { string sourceString = value as string; if (sourceString != null) { if (sourceString.Equals(VisualBasicSettingsValueSerializer.ImplementationVisualBasicSettingsValue)) { // this is the VBSettings for the internal implementation // suppress its Xaml serialization VisualBasicSettings settings = CollectXmlNamespacesAndAssemblies(context); if (settings != null) { settings.SuppressXamlSerialization = true; } return settings; } if (!(sourceString.Equals(String.Empty) || sourceString.Equals(VisualBasicSettingsValueSerializer.VisualBasicSettingsValue))) { throw FxTrace.Exception.AsError(new InvalidOperationException(SR.InvalidVisualBasicSettingsValue)); } return CollectXmlNamespacesAndAssemblies(context); } return base.ConvertFrom(context, culture, value); } public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { return base.ConvertTo(context, culture, value, destinationType); } VisualBasicSettings CollectXmlNamespacesAndAssemblies(ITypeDescriptorContext context) { return VisualBasicExpressionConverter.CollectXmlNamespacesAndAssemblies(context); } } } // 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
- BaseTreeIterator.cs
- FontSourceCollection.cs
- IdentityManager.cs
- BitmapEffect.cs
- ListBoxItemAutomationPeer.cs
- ResourceWriter.cs
- ApplicationId.cs
- StylusPointCollection.cs
- XsdBuildProvider.cs
- BoolExpression.cs
- UriSection.cs
- Perspective.cs
- ExpandedProjectionNode.cs
- InternalSafeNativeMethods.cs
- smtppermission.cs
- InvokeProviderWrapper.cs
- Menu.cs
- UserControlDocumentDesigner.cs
- ILGenerator.cs
- SoapIncludeAttribute.cs
- StringValidatorAttribute.cs
- SecurityUtils.cs
- DbParameterHelper.cs
- WorkflowItemsPresenter.cs
- SqlNodeAnnotations.cs
- GenerateTemporaryTargetAssembly.cs
- HtmlTableRowCollection.cs
- ContextStack.cs
- SupportsEventValidationAttribute.cs
- ConnectionsZone.cs
- WebBaseEventKeyComparer.cs
- VerificationAttribute.cs
- PriorityChain.cs
- WpfGeneratedKnownProperties.cs
- DefaultDiscoveryService.cs
- TemplateManager.cs
- wmiprovider.cs
- XPathParser.cs
- PropertyRef.cs
- DynamicDataRouteHandler.cs
- TagNameToTypeMapper.cs
- ProcessProtocolHandler.cs
- MessageQueuePermission.cs
- StylusPointDescription.cs
- SqlGenericUtil.cs
- ColumnResizeUndoUnit.cs
- SequentialOutput.cs
- XmlElementCollection.cs
- BamlReader.cs
- CacheDependency.cs
- Journaling.cs
- WindowsSspiNegotiation.cs
- XmlSchemaExporter.cs
- TextCompositionManager.cs
- TextModifierScope.cs
- TextRangeEditLists.cs
- SafeNativeMethodsMilCoreApi.cs
- PkcsMisc.cs
- FixedSOMContainer.cs
- XmlnsCompatibleWithAttribute.cs
- FontConverter.cs
- TrackingProfileSerializer.cs
- TextEffect.cs
- EntityAdapter.cs
- ResourceCategoryAttribute.cs
- TdsRecordBufferSetter.cs
- ErrorEventArgs.cs
- PathFigure.cs
- ThemeInfoAttribute.cs
- SvcMapFile.cs
- MarkupCompiler.cs
- EntitySqlQueryState.cs
- RelOps.cs
- StrokeNodeOperations2.cs
- OleServicesContext.cs
- CompiledRegexRunner.cs
- Membership.cs
- ToolStripItemRenderEventArgs.cs
- EntityTypeBase.cs
- BuildResult.cs
- HtmlString.cs
- DbProviderServices.cs
- ActivityStateQuery.cs
- LoadedOrUnloadedOperation.cs
- Menu.cs
- SqlParameter.cs
- RectValueSerializer.cs
- XPathExpr.cs
- CreateUserWizardStep.cs
- RadioButtonPopupAdapter.cs
- SizeAnimation.cs
- SiteMapDataSource.cs
- RayMeshGeometry3DHitTestResult.cs
- SqlServices.cs
- ListControl.cs
- UpdateCommandGenerator.cs
- CompleteWizardStep.cs
- HttpTransportSecurity.cs
- KeyValueConfigurationElement.cs
- XmlSchemaExporter.cs