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
- ControlPropertyNameConverter.cs
- NumericPagerField.cs
- figurelength.cs
- RangeValueProviderWrapper.cs
- LinkTarget.cs
- Int16Storage.cs
- CodeFieldReferenceExpression.cs
- ListItemParagraph.cs
- StylusCaptureWithinProperty.cs
- PtsCache.cs
- XMLDiffLoader.cs
- DesignerSelectionListAdapter.cs
- StringDictionary.cs
- RolePrincipal.cs
- ElementsClipboardData.cs
- DataGridBeginningEditEventArgs.cs
- SettingsPropertyValue.cs
- ISO2022Encoding.cs
- PageSettings.cs
- AuthorizationSection.cs
- SystemMulticastIPAddressInformation.cs
- DataControlFieldCollection.cs
- _NegotiateClient.cs
- EdmToObjectNamespaceMap.cs
- SkipStoryboardToFill.cs
- HtmlTitle.cs
- TextSelectionHighlightLayer.cs
- Msec.cs
- TokenBasedSetEnumerator.cs
- BindingMemberInfo.cs
- RelationshipManager.cs
- VoiceSynthesis.cs
- UnsafeNativeMethodsPenimc.cs
- ListSourceHelper.cs
- BitmapEffect.cs
- ObjectCloneHelper.cs
- COM2ExtendedTypeConverter.cs
- PersonalizableAttribute.cs
- SmtpClient.cs
- BuildResult.cs
- CellParaClient.cs
- GenericRootAutomationPeer.cs
- RemoveFromCollection.cs
- BinaryObjectInfo.cs
- WebAdminConfigurationHelper.cs
- XPathPatternParser.cs
- UnsafeNativeMethods.cs
- ImpersonateTokenRef.cs
- TextDecorationCollectionConverter.cs
- TraceSwitch.cs
- Mapping.cs
- CheckableControlBaseAdapter.cs
- ThreadStaticAttribute.cs
- InvokeWebServiceDesigner.cs
- MailDefinitionBodyFileNameEditor.cs
- MinMaxParagraphWidth.cs
- DbProviderSpecificTypePropertyAttribute.cs
- IFlowDocumentViewer.cs
- EventHandlerService.cs
- TextTreeUndoUnit.cs
- NestedContainer.cs
- SystemKeyConverter.cs
- ClipboardData.cs
- XmlCollation.cs
- COM2TypeInfoProcessor.cs
- MsmqAuthenticationMode.cs
- RelOps.cs
- ConfigurationPermission.cs
- XPathDocumentBuilder.cs
- DataGridTablesFactory.cs
- InternalCache.cs
- CommandValueSerializer.cs
- ChildrenQuery.cs
- HtmlInputControl.cs
- Transform3DGroup.cs
- MD5.cs
- RegionData.cs
- Activator.cs
- clipboard.cs
- DataChangedEventManager.cs
- StringPropertyBuilder.cs
- ConfigsHelper.cs
- PolyLineSegment.cs
- LOSFormatter.cs
- sqlser.cs
- XmlSiteMapProvider.cs
- SqlConnectionHelper.cs
- WebHeaderCollection.cs
- RegistrationProxy.cs
- MatrixStack.cs
- DetailsViewModeEventArgs.cs
- TopClause.cs
- MailWebEventProvider.cs
- FtpWebRequest.cs
- ColumnResizeUndoUnit.cs
- ProcessHostFactoryHelper.cs
- WebAdminConfigurationHelper.cs
- RegisteredExpandoAttribute.cs
- DateTimeFormat.cs
- SQLInt16.cs