Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Services / Monitoring / system / Diagnosticts / Design / StringDictionaryEditor.cs / 1 / StringDictionaryEditor.cs
namespace System.Diagnostics.Design { using System.Runtime.InteropServices; using System.Diagnostics; using System; using System.IO; using System.Collections; using System.ComponentModel; using System.ComponentModel.Design; using System.Windows.Forms; using System.Drawing; using System.Drawing.Design; using System.Windows.Forms.ComponentModel; using System.Windows.Forms.Design; using System.Collections.Specialized; using System.Design; internal class EditableDictionaryEntry { public string _name; public string _value; public EditableDictionaryEntry(string name, string value) { _name = name; _value = value; } public string Name { get { return _name; } set { _name = value; } } public string Value { get { return _value; } set { _value = value; } } } internal class StringDictionaryEditor : CollectionEditor { public StringDictionaryEditor(Type type) : base(type) {} protected override Type CreateCollectionItemType() { return typeof(EditableDictionaryEntry); } protected override object CreateInstance(Type itemType) { return new EditableDictionaryEntry("name", "value"); } protected override object SetItems(object editValue, object[] value) { StringDictionary dictionary = editValue as StringDictionary; if (dictionary == null) { throw new ArgumentNullException("editValue"); } dictionary.Clear(); foreach (EditableDictionaryEntry entry in value) { dictionary[entry.Name] = entry.Value; } return dictionary; } protected override object[] GetItems(object editValue) { if (editValue != null) { StringDictionary dictionary = editValue as StringDictionary; if (dictionary == null) { throw new ArgumentNullException("editValue"); } object[] ret = new object[dictionary.Count]; int pos = 0; foreach (DictionaryEntry entry in dictionary) { EditableDictionaryEntry newEntry = new EditableDictionaryEntry((string)entry.Key, (string)entry.Value); ret[pos++] = newEntry; } return ret; } return new object[0]; } protected override CollectionForm CreateCollectionForm() { CollectionForm form = base.CreateCollectionForm(); form.Text = SR.GetString(SR.StringDictionaryEditorTitle); form.CollectionEditable = true; return form; } } } // 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
- DeferrableContentConverter.cs
- MenuItem.cs
- ForeignConstraint.cs
- ListDesigner.cs
- StaticResourceExtension.cs
- odbcmetadatacolumnnames.cs
- SafeMILHandle.cs
- ExpressionEvaluator.cs
- WSFederationHttpBindingElement.cs
- NetDataContractSerializer.cs
- Span.cs
- WrapPanel.cs
- ContextMarshalException.cs
- CacheEntry.cs
- WebServiceReceiveDesigner.cs
- TextEditorLists.cs
- NavigatingCancelEventArgs.cs
- SqlServices.cs
- BitVector32.cs
- DrawingBrush.cs
- SortQueryOperator.cs
- OrderByQueryOptionExpression.cs
- VectorConverter.cs
- CodeParameterDeclarationExpression.cs
- XamlGridLengthSerializer.cs
- StylusPointProperties.cs
- MaterialGroup.cs
- ComplexTypeEmitter.cs
- MemberInitExpression.cs
- LocatorPart.cs
- MetadataItemCollectionFactory.cs
- AlternateView.cs
- ControlHelper.cs
- PrintingPermissionAttribute.cs
- SendMessageChannelCache.cs
- SqlCacheDependencySection.cs
- FragmentNavigationEventArgs.cs
- BaseTemplateBuildProvider.cs
- ApplicationHost.cs
- ItemList.cs
- GeneratedView.cs
- QilIterator.cs
- MenuItemStyleCollection.cs
- DirtyTextRange.cs
- AttributeUsageAttribute.cs
- BuildResultCache.cs
- ColumnHeader.cs
- LocatorBase.cs
- WebPartCollection.cs
- IisHelper.cs
- QilChoice.cs
- HttpConfigurationContext.cs
- RbTree.cs
- Range.cs
- NavigatorOutput.cs
- ScrollViewer.cs
- StorageComplexPropertyMapping.cs
- BuildProvider.cs
- CellLabel.cs
- VersionConverter.cs
- SimpleType.cs
- ToolStripRenderEventArgs.cs
- TextTreeUndo.cs
- MouseActionValueSerializer.cs
- ReadWriteObjectLock.cs
- ConfigurationStrings.cs
- bidPrivateBase.cs
- MenuTracker.cs
- HttpFileCollection.cs
- Bitmap.cs
- GcHandle.cs
- SqlParameterCollection.cs
- DataContractJsonSerializerOperationFormatter.cs
- DynamicRenderer.cs
- CodeAccessPermission.cs
- StylusEventArgs.cs
- DataGridViewColumnHeaderCell.cs
- XmlAnyElementAttributes.cs
- WriteLine.cs
- InvokePatternIdentifiers.cs
- WindowsTitleBar.cs
- HostProtectionPermission.cs
- EdmItemCollection.OcAssemblyCache.cs
- BaseProcessProtocolHandler.cs
- DynamicMethod.cs
- Stackframe.cs
- CodeAssignStatement.cs
- BrowserPolicyValidator.cs
- ProxySimple.cs
- DataGridViewUtilities.cs
- ConvertersCollection.cs
- Expander.cs
- PrimitiveCodeDomSerializer.cs
- BezierSegment.cs
- XmlSchemaResource.cs
- PointAnimationUsingKeyFrames.cs
- ActivityTypeCodeDomSerializer.cs
- EntityDataSourceStatementEditor.cs
- TypeSemantics.cs
- GenericTypeParameterBuilder.cs