Code:
/ FX-1434 / FX-1434 / 1.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
- DesignerLoader.cs
- Pointer.cs
- URLString.cs
- ElementProxy.cs
- OdbcError.cs
- CompoundFileStreamReference.cs
- DataGridViewCellPaintingEventArgs.cs
- ObjectItemCollection.cs
- AssemblyAttributes.cs
- DataServicePagingProviderWrapper.cs
- StylusButtonCollection.cs
- AdornerDecorator.cs
- TextServicesLoader.cs
- HtmlSelect.cs
- Control.cs
- SafeNativeMethods.cs
- HtmlMeta.cs
- QilCloneVisitor.cs
- CaretElement.cs
- DataSourceCacheDurationConverter.cs
- CharStorage.cs
- ContentPosition.cs
- DataGridViewControlCollection.cs
- safemediahandle.cs
- BuiltInExpr.cs
- AutoGeneratedFieldProperties.cs
- errorpatternmatcher.cs
- OutputScope.cs
- ComEventsInfo.cs
- CompiledAction.cs
- KeyValuePairs.cs
- Substitution.cs
- filewebresponse.cs
- ListViewSortEventArgs.cs
- Main.cs
- VersionedStream.cs
- GACIdentityPermission.cs
- SmtpNtlmAuthenticationModule.cs
- Match.cs
- PrintPreviewGraphics.cs
- WorkflowServiceBehavior.cs
- BoolLiteral.cs
- MD5.cs
- TextBounds.cs
- WS2007HttpBinding.cs
- SamlAuthorizationDecisionStatement.cs
- DataGridViewSelectedRowCollection.cs
- WindowCollection.cs
- XPathArrayIterator.cs
- PagesSection.cs
- BadImageFormatException.cs
- SvcMapFile.cs
- OleDbTransaction.cs
- SqlMetaData.cs
- TargetInvocationException.cs
- ActivityDesignerLayoutSerializers.cs
- EncodingNLS.cs
- EmbeddedMailObjectsCollection.cs
- WebSysDisplayNameAttribute.cs
- SizeLimitedCache.cs
- ScriptResourceAttribute.cs
- HttpContextServiceHost.cs
- DataGridHelper.cs
- XmlSchemaParticle.cs
- CheckedPointers.cs
- BasePattern.cs
- SystemColors.cs
- Transform3DCollection.cs
- DocumentSequenceHighlightLayer.cs
- LocalFileSettingsProvider.cs
- ProxyHwnd.cs
- VectorKeyFrameCollection.cs
- ChannelTerminatedException.cs
- XmlDeclaration.cs
- Config.cs
- ExceptionHelpers.cs
- _ListenerRequestStream.cs
- QilChoice.cs
- VersionConverter.cs
- BindValidator.cs
- DataGridViewCellStateChangedEventArgs.cs
- AspNetSynchronizationContext.cs
- SamlSecurityTokenAuthenticator.cs
- ISAPIRuntime.cs
- MethodBody.cs
- _NegoStream.cs
- PopupRootAutomationPeer.cs
- SqlGenerator.cs
- ReadWriteObjectLock.cs
- DateTimeEditor.cs
- Buffer.cs
- Process.cs
- StylusShape.cs
- XXXOnTypeBuilderInstantiation.cs
- ConsoleKeyInfo.cs
- SatelliteContractVersionAttribute.cs
- DataGridTablesFactory.cs
- TableCell.cs
- MergeFilterQuery.cs
- VirtualDirectoryMapping.cs