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
- WorkflowServiceHostFactory.cs
- ConsumerConnectionPoint.cs
- GenericFlowSwitchHelper.cs
- PathFigure.cs
- PeerDuplexChannel.cs
- InstalledFontCollection.cs
- ItemType.cs
- MobileUserControlDesigner.cs
- FastEncoderWindow.cs
- InternalUserCancelledException.cs
- DataSet.cs
- WinFormsUtils.cs
- Encoding.cs
- HostingPreferredMapPath.cs
- FormViewPageEventArgs.cs
- MetadataHelper.cs
- RestHandler.cs
- TextServicesCompartment.cs
- DesignTimeDataBinding.cs
- CodeIdentifier.cs
- CommentAction.cs
- FrameworkEventSource.cs
- EdmMember.cs
- QilLoop.cs
- ActiveXHost.cs
- arabicshape.cs
- HostedTransportConfigurationManager.cs
- LinkedResourceCollection.cs
- TrackingMemoryStreamFactory.cs
- TextDecorationCollectionConverter.cs
- Math.cs
- NativeMethods.cs
- _KerberosClient.cs
- StateManagedCollection.cs
- NameSpaceEvent.cs
- ConfigurationConverterBase.cs
- XmlSubtreeReader.cs
- SmtpReplyReaderFactory.cs
- ToggleButtonAutomationPeer.cs
- Image.cs
- Underline.cs
- InkCanvasAutomationPeer.cs
- TaskExceptionHolder.cs
- SafeProcessHandle.cs
- DefaultValidator.cs
- ExecutedRoutedEventArgs.cs
- LOSFormatter.cs
- DataGridViewCellStateChangedEventArgs.cs
- GlyphShapingProperties.cs
- MgmtConfigurationRecord.cs
- PersonalizationStateQuery.cs
- EntityDataReader.cs
- OrderedDictionary.cs
- SizeAnimationBase.cs
- FileDialog.cs
- XmlSerializer.cs
- Track.cs
- MultiByteCodec.cs
- PluralizationServiceUtil.cs
- Popup.cs
- DateTimeOffset.cs
- streamingZipPartStream.cs
- Monitor.cs
- ZoomingMessageFilter.cs
- DataSourceHelper.cs
- ScopedKnownTypes.cs
- BaseUriWithWildcard.cs
- WebPartHelpVerb.cs
- SchemaLookupTable.cs
- ReadWriteObjectLock.cs
- StatusBar.cs
- _NestedSingleAsyncResult.cs
- JsonStringDataContract.cs
- _SingleItemRequestCache.cs
- XmlNodeReader.cs
- DataGridViewCellFormattingEventArgs.cs
- BackStopAuthenticationModule.cs
- ProfileEventArgs.cs
- HandlerFactoryWrapper.cs
- RichTextBoxConstants.cs
- TypedDataSetSchemaImporterExtension.cs
- CardSpaceShim.cs
- DiscoveryCallbackBehavior.cs
- DataRowCollection.cs
- IFlowDocumentViewer.cs
- WebCodeGenerator.cs
- GZipStream.cs
- LinkLabel.cs
- AuthenticodeSignatureInformation.cs
- CacheModeConverter.cs
- EncodingDataItem.cs
- ConfigurationFileMap.cs
- HttpResponseWrapper.cs
- WebPartDescription.cs
- ThreadAbortException.cs
- ProbeDuplexCD1AsyncResult.cs
- BindingManagerDataErrorEventArgs.cs
- SequenceRange.cs
- AsymmetricKeyExchangeFormatter.cs
- StringBuilder.cs