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
- CfgParser.cs
- DesignBindingValueUIHandler.cs
- SoapHttpTransportImporter.cs
- CodeCastExpression.cs
- WindowsFormsDesignerOptionService.cs
- SortableBindingList.cs
- ServerValidateEventArgs.cs
- RuntimeResourceSet.cs
- ValidationErrorCollection.cs
- XmlConverter.cs
- ByteConverter.cs
- Drawing.cs
- HMAC.cs
- BaseTemplateCodeDomTreeGenerator.cs
- ReadOnlyTernaryTree.cs
- SqlConnectionPoolGroupProviderInfo.cs
- ConfigUtil.cs
- WebServiceResponseDesigner.cs
- DeclaredTypeValidator.cs
- ParenthesizePropertyNameAttribute.cs
- CodeCompiler.cs
- SendingRequestEventArgs.cs
- NonParentingControl.cs
- BindingEntityInfo.cs
- BuiltInPermissionSets.cs
- MulticastOption.cs
- ImmutableCommunicationTimeouts.cs
- TypeInfo.cs
- SynchronizedCollection.cs
- X509ThumbprintKeyIdentifierClause.cs
- LinkDescriptor.cs
- GetWinFXPath.cs
- HttpConfigurationSystem.cs
- FacetDescription.cs
- BamlLocalizer.cs
- SqlTypesSchemaImporter.cs
- FragmentNavigationEventArgs.cs
- MetadataCollection.cs
- UrlMappingCollection.cs
- VisualTarget.cs
- Stream.cs
- State.cs
- BaseCAMarshaler.cs
- Label.cs
- DocumentApplicationJournalEntry.cs
- UInt16Converter.cs
- LogEntryUtils.cs
- ObservableCollectionDefaultValueFactory.cs
- ImmComposition.cs
- ModifierKeysValueSerializer.cs
- WithStatement.cs
- PropertyStore.cs
- MenuCommand.cs
- documentsequencetextcontainer.cs
- TextParentUndoUnit.cs
- DataGridViewRowsAddedEventArgs.cs
- shaperfactoryquerycachekey.cs
- PenLineCapValidation.cs
- TraceSection.cs
- TextElementEditingBehaviorAttribute.cs
- NullableFloatSumAggregationOperator.cs
- _FtpControlStream.cs
- VisualBrush.cs
- ComplusTypeValidator.cs
- FlatButtonAppearance.cs
- GeometryHitTestResult.cs
- SecurityNegotiationException.cs
- StringAnimationUsingKeyFrames.cs
- NativeMethods.cs
- documentsequencetextcontainer.cs
- LineInfo.cs
- ChtmlMobileTextWriter.cs
- ToolStripRenderer.cs
- DebugView.cs
- RangeBaseAutomationPeer.cs
- Int64AnimationUsingKeyFrames.cs
- SchemaHelper.cs
- SkewTransform.cs
- UxThemeWrapper.cs
- MeshGeometry3D.cs
- StackSpiller.Bindings.cs
- MembershipSection.cs
- ExternalException.cs
- HtmlTableRow.cs
- HelpProvider.cs
- smtppermission.cs
- HScrollBar.cs
- DBDataPermission.cs
- XmlAttribute.cs
- UrlMappingsSection.cs
- DataAccessor.cs
- AnnotationMap.cs
- Transform.cs
- CodeLinePragma.cs
- CodeTypeParameter.cs
- Facet.cs
- DataSvcMapFileSerializer.cs
- TextElementAutomationPeer.cs
- PropertyRecord.cs
- RemoteX509Token.cs