Code:
/ DotNET / DotNET / 8.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
- GZipStream.cs
- RoleGroup.cs
- UriTemplateTrieNode.cs
- PlaceHolder.cs
- CurrentChangingEventArgs.cs
- SslStream.cs
- GlyphManager.cs
- DbMetaDataColumnNames.cs
- RankException.cs
- RegexCharClass.cs
- NamedObject.cs
- StatusBar.cs
- HttpServerUtilityBase.cs
- AddInToken.cs
- SqlClientWrapperSmiStreamChars.cs
- Help.cs
- FontSizeConverter.cs
- SoapIgnoreAttribute.cs
- XpsDigitalSignature.cs
- sqlpipe.cs
- DataGridItemCollection.cs
- WebBrowserUriTypeConverter.cs
- SchemaNamespaceManager.cs
- TaskFormBase.cs
- FixedFindEngine.cs
- TextTreeInsertElementUndoUnit.cs
- SmtpNegotiateAuthenticationModule.cs
- SamlAssertionKeyIdentifierClause.cs
- RightsManagementPermission.cs
- DataList.cs
- CqlBlock.cs
- HttpException.cs
- SimpleType.cs
- CodeDOMUtility.cs
- FamilyTypeface.cs
- HtmlElementErrorEventArgs.cs
- CodeMemberEvent.cs
- DataSourceHelper.cs
- DesignerObject.cs
- QilReplaceVisitor.cs
- WindowsTitleBar.cs
- SamlConstants.cs
- HttpRawResponse.cs
- PackagePartCollection.cs
- EmulateRecognizeCompletedEventArgs.cs
- CodeAccessPermission.cs
- GeneralTransformGroup.cs
- FrameworkReadOnlyPropertyMetadata.cs
- Stream.cs
- wgx_exports.cs
- SafeUserTokenHandle.cs
- Completion.cs
- DirectoryInfo.cs
- LongTypeConverter.cs
- XmlUrlEditor.cs
- Label.cs
- WindowPattern.cs
- InternalBufferOverflowException.cs
- MatrixAnimationUsingPath.cs
- ComboBoxRenderer.cs
- CalendarModeChangedEventArgs.cs
- HttpHandlersSection.cs
- WebBrowserSiteBase.cs
- DetailsViewUpdateEventArgs.cs
- XmlNavigatorStack.cs
- VisualTreeFlattener.cs
- RSAPKCS1SignatureDeformatter.cs
- EmptyCollection.cs
- MimePart.cs
- XmlNamedNodeMap.cs
- _LocalDataStoreMgr.cs
- TypeLoadException.cs
- QilDataSource.cs
- UnsafeNativeMethodsMilCoreApi.cs
- SqlStream.cs
- sqlstateclientmanager.cs
- StoreAnnotationsMap.cs
- EntitySetBaseCollection.cs
- XmlSchemaValidator.cs
- CopyOfAction.cs
- RoleGroupCollection.cs
- Helpers.cs
- InternalTypeHelper.cs
- ConfigXmlCDataSection.cs
- _LazyAsyncResult.cs
- ResolvedKeyFrameEntry.cs
- ResolveCriteria.cs
- PageSettings.cs
- ScaleTransform3D.cs
- PictureBoxDesigner.cs
- ControlSerializer.cs
- OutOfProcStateClientManager.cs
- WebHttpBehavior.cs
- XhtmlConformanceSection.cs
- CancelEventArgs.cs
- SchemaObjectWriter.cs
- Crypto.cs
- ErrorTableItemStyle.cs
- ActionFrame.cs
- UInt64Converter.cs