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
- DbBuffer.cs
- IERequestCache.cs
- AssemblyInfo.cs
- XmlException.cs
- OneOf.cs
- TableLayoutPanelCellPosition.cs
- PublisherMembershipCondition.cs
- PointAnimationUsingPath.cs
- StringDictionary.cs
- EntityCommandDefinition.cs
- EventHandlers.cs
- BooleanSwitch.cs
- SecurityCapabilities.cs
- _LoggingObject.cs
- StickyNote.cs
- PlanCompiler.cs
- SafeRightsManagementEnvironmentHandle.cs
- EntityCommandDefinition.cs
- Typography.cs
- ScrollEvent.cs
- ToolStripSplitButton.cs
- ControlCachePolicy.cs
- CompilerError.cs
- RequestQueryProcessor.cs
- RotateTransform.cs
- NotSupportedException.cs
- CommandField.cs
- StylusButtonEventArgs.cs
- AttributeEmitter.cs
- QueryAsyncResult.cs
- CaseInsensitiveHashCodeProvider.cs
- PermissionToken.cs
- TimelineClockCollection.cs
- Scene3D.cs
- METAHEADER.cs
- StopRoutingHandler.cs
- ReadOnlyHierarchicalDataSource.cs
- ThrowOnMultipleAssignment.cs
- EllipticalNodeOperations.cs
- XmlCharCheckingWriter.cs
- OracleDataReader.cs
- ListControlConvertEventArgs.cs
- WebServiceClientProxyGenerator.cs
- AccessControlList.cs
- _SSPISessionCache.cs
- COSERVERINFO.cs
- SHA384.cs
- dbdatarecord.cs
- NamedObject.cs
- PagedDataSource.cs
- AbstractDataSvcMapFileLoader.cs
- RotationValidation.cs
- SortFieldComparer.cs
- RadioButton.cs
- SaveFileDialog.cs
- HttpRuntimeSection.cs
- CounterSampleCalculator.cs
- HttpRuntimeSection.cs
- ProcessingInstructionAction.cs
- AccessedThroughPropertyAttribute.cs
- HTTPNotFoundHandler.cs
- SocketPermission.cs
- SessionPageStatePersister.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- WorkflowItemPresenter.cs
- PrefixQName.cs
- MouseWheelEventArgs.cs
- entitydatasourceentitysetnameconverter.cs
- DataListAutoFormat.cs
- XmlDataSourceView.cs
- CryptoConfig.cs
- MdImport.cs
- UniqueConstraint.cs
- XmlWriterTraceListener.cs
- DataGridTextBoxColumn.cs
- TypeSemantics.cs
- MissingFieldException.cs
- NameNode.cs
- AttributeSetAction.cs
- DPTypeDescriptorContext.cs
- DateTimeUtil.cs
- WsatConfiguration.cs
- Accessible.cs
- ApplicationServiceManager.cs
- ObjectDataSourceEventArgs.cs
- SchemaCollectionPreprocessor.cs
- ItemCollection.cs
- TearOffProxy.cs
- WebPartEditVerb.cs
- AttributeProviderAttribute.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- XPathDocumentBuilder.cs
- DoubleAnimationClockResource.cs
- RawMouseInputReport.cs
- MonthChangedEventArgs.cs
- Style.cs
- SettingsProviderCollection.cs
- HexParser.cs
- InvokeProviderWrapper.cs
- SortQuery.cs