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
- OutputScopeManager.cs
- DetailsViewCommandEventArgs.cs
- XMLSyntaxException.cs
- ServiceInfoCollection.cs
- ActiveXContainer.cs
- Highlights.cs
- MetabaseSettingsIis7.cs
- AllMembershipCondition.cs
- WindowsUpDown.cs
- ReaderContextStackData.cs
- TextRangeBase.cs
- CodeCommentStatement.cs
- TextProviderWrapper.cs
- OleDbCommandBuilder.cs
- QueryableDataSourceHelper.cs
- Polyline.cs
- TextServicesManager.cs
- ControlDesigner.cs
- SrgsElementFactory.cs
- AssemblyHash.cs
- CompilationLock.cs
- ProcessInfo.cs
- HopperCache.cs
- InputElement.cs
- ServiceProviders.cs
- ResourceContainer.cs
- RoleGroup.cs
- StringPropertyBuilder.cs
- SamlAction.cs
- WebPartConnectVerb.cs
- ToolboxComponentsCreatingEventArgs.cs
- AlignmentXValidation.cs
- ConfigDefinitionUpdates.cs
- FixedLineResult.cs
- DataGridViewRowStateChangedEventArgs.cs
- SessionEndingCancelEventArgs.cs
- WebEncodingValidatorAttribute.cs
- TextEditorCharacters.cs
- XamlTypeMapper.cs
- RoutedEventHandlerInfo.cs
- ConfigXmlText.cs
- HierarchicalDataBoundControlAdapter.cs
- XamlPointCollectionSerializer.cs
- PropertyToken.cs
- HtmlTableCellCollection.cs
- MappingSource.cs
- CodeSubDirectoriesCollection.cs
- TreeBuilderBamlTranslator.cs
- DataGridColumnHeader.cs
- CryptoKeySecurity.cs
- CodeBlockBuilder.cs
- Point3DCollection.cs
- DataColumnMappingCollection.cs
- RecordsAffectedEventArgs.cs
- ProcessManager.cs
- SizeIndependentAnimationStorage.cs
- DataGridColumnCollection.cs
- _ConnectOverlappedAsyncResult.cs
- MessageQueueEnumerator.cs
- StrongNameIdentityPermission.cs
- RouteParameter.cs
- MobileTemplatedControlDesigner.cs
- ScrollData.cs
- XamlInt32CollectionSerializer.cs
- DropTarget.cs
- LoginCancelEventArgs.cs
- XMLSyntaxException.cs
- input.cs
- ObjectResult.cs
- DependencyObject.cs
- RemoveStoryboard.cs
- XmlReflectionMember.cs
- GroupBox.cs
- ConnectionManagementSection.cs
- ClientBuildManager.cs
- DrawingContextDrawingContextWalker.cs
- CompiledELinqQueryState.cs
- DocumentReference.cs
- LoginNameDesigner.cs
- VariableAction.cs
- SafeViewOfFileHandle.cs
- DesignSurface.cs
- PageContentAsyncResult.cs
- PropertyGroupDescription.cs
- PageAsyncTaskManager.cs
- Lasso.cs
- _BaseOverlappedAsyncResult.cs
- SerialErrors.cs
- SystemException.cs
- Executor.cs
- X509UI.cs
- JsonReader.cs
- CodeIdentifier.cs
- ColorConvertedBitmap.cs
- WindowsStartMenu.cs
- BodyGlyph.cs
- LineSegment.cs
- TemplateControl.cs
- HierarchicalDataSourceConverter.cs
- SelectedDatesCollection.cs