Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WinForms / System / WinForms / Design / ImageCollectionCodeDomSerializer.cs / 1 / ImageCollectionCodeDomSerializer.cs
namespace System.Windows.Forms.Design { using System.Design; using System.CodeDom; using System.Collections; using System.ComponentModel; using System.ComponentModel.Design; using System.Diagnostics; using System.Reflection; using System.ComponentModel.Design.Serialization; using System.Collections.Specialized; using System.Windows.Forms; ////// /// This serializer serializes string dictionaries. /// // public class ImageListCodeDomSerializer : CodeDomSerializer { ////// /// This method takes a CodeDomObject and deserializes into a real object. /// We don't do anything here. /// public override object Deserialize(IDesignerSerializationManager manager, object codeObject) { // if (manager == null || codeObject == null) { throw new ArgumentNullException( manager == null ? "manager" : "codeObject"); } // Find our base class's serializer. // CodeDomSerializer serializer = (CodeDomSerializer)manager.GetSerializer(typeof(Component), typeof(CodeDomSerializer)); if (serializer == null) { Debug.Fail("Unable to find a CodeDom serializer for 'Component'. Has someone tampered with the serialization providers?"); return null; } return serializer.Deserialize(manager, codeObject); } ////// /// Serializes the given object into a CodeDom object. /// public override object Serialize(IDesignerSerializationManager manager, object value) { CodeDomSerializer baseSerializer = (CodeDomSerializer)manager.GetSerializer(typeof(ImageList).BaseType, typeof(CodeDomSerializer)); object codeObject = baseSerializer.Serialize(manager, value); ImageList imageList = value as ImageList; if (imageList != null) { StringCollection imageKeys = imageList.Images.Keys; if (codeObject is CodeStatementCollection) { CodeExpression imageListObject = GetExpression(manager, value); if (imageListObject != null) { CodeExpression imageListImagesProperty = new CodePropertyReferenceExpression(imageListObject, "Images"); if (imageListImagesProperty != null) { for (int i = 0; i < imageKeys.Count; i++) { if ((imageKeys[i] != null) || (imageKeys[i].Length != 0)){ CodeMethodInvokeExpression setNameMethodCall = new CodeMethodInvokeExpression(imageListImagesProperty, "SetKeyName", new CodeExpression [] { new CodePrimitiveExpression(i), // SetKeyName(int, new CodePrimitiveExpression(imageKeys[i]) // string); }); ((CodeStatementCollection)codeObject).Add(setNameMethodCall); } } } } } } return codeObject; } } // Class ImageListCodeDomSerializer } // Namespace System.Windows.Forms.Design // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- UpdatePanelTrigger.cs
- DataGridViewCellStyleContentChangedEventArgs.cs
- DomainUpDown.cs
- BigInt.cs
- ConnectionProviderAttribute.cs
- DesignerRegion.cs
- FilterEventArgs.cs
- PathFigure.cs
- DataControlPagerLinkButton.cs
- MSAAEventDispatcher.cs
- IDReferencePropertyAttribute.cs
- ResourceDisplayNameAttribute.cs
- _Semaphore.cs
- XPathDocumentIterator.cs
- TrustLevelCollection.cs
- ValidationErrorEventArgs.cs
- DictionarySectionHandler.cs
- SafeHandles.cs
- GridViewAutomationPeer.cs
- ClickablePoint.cs
- SoapExtensionImporter.cs
- ScaleTransform.cs
- PagerSettings.cs
- FixedTextBuilder.cs
- CodeAttachEventStatement.cs
- DataTableReader.cs
- HttpServerVarsCollection.cs
- ZipIOCentralDirectoryFileHeader.cs
- baseaxisquery.cs
- PreviewPageInfo.cs
- ComponentChangingEvent.cs
- EncryptedPackage.cs
- oledbconnectionstring.cs
- ClientScriptManager.cs
- XmlAttributeOverrides.cs
- UnsafeNativeMethodsTablet.cs
- DecimalFormatter.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- Panel.cs
- BamlVersionHeader.cs
- XmlDictionaryWriter.cs
- HTMLTextWriter.cs
- FilterQuery.cs
- securitycriticaldataformultiplegetandset.cs
- SourceFileBuildProvider.cs
- PositiveTimeSpanValidator.cs
- SweepDirectionValidation.cs
- GeometryModel3D.cs
- FixedSOMPageConstructor.cs
- BindableAttribute.cs
- Border.cs
- DataGridViewColumnEventArgs.cs
- IdentifierCollection.cs
- EntityDataSourceWizardForm.cs
- HashAlgorithm.cs
- SerializationTrace.cs
- ScrollableControl.cs
- WinEventTracker.cs
- HttpRequestCacheValidator.cs
- StreamGeometry.cs
- PreviewKeyDownEventArgs.cs
- ServiceActivationException.cs
- GeometryCombineModeValidation.cs
- SpStreamWrapper.cs
- SystemColors.cs
- AdornerHitTestResult.cs
- JulianCalendar.cs
- Visual.cs
- ControlValuePropertyAttribute.cs
- SqlConnectionPoolGroupProviderInfo.cs
- HierarchicalDataSourceIDConverter.cs
- ColorAnimation.cs
- InstanceKeyCollisionException.cs
- followingsibling.cs
- AuthStoreRoleProvider.cs
- RegexInterpreter.cs
- FixedPageProcessor.cs
- XmlSchemaSimpleTypeList.cs
- MetadataArtifactLoaderCompositeFile.cs
- ServiceDescriptionReflector.cs
- SqlMethodAttribute.cs
- ObjectAnimationUsingKeyFrames.cs
- MenuAutomationPeer.cs
- EllipseGeometry.cs
- FontNameEditor.cs
- XmlSchemaExporter.cs
- Int16.cs
- TimeZone.cs
- EntityKeyElement.cs
- ObjectDisposedException.cs
- Selection.cs
- DaylightTime.cs
- SymLanguageVendor.cs
- ContextQuery.cs
- SqlDataAdapter.cs
- ReaderContextStackData.cs
- SqlRecordBuffer.cs
- Stream.cs
- columnmapkeybuilder.cs
- ObjectDataSourceView.cs