Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / Tools / System.Activities.Core.Presentation / System / Activities / Presentation / TypeCollectionPropertyEditor.cs / 1407647 / TypeCollectionPropertyEditor.cs
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//---------------------------------------------------------------
namespace System.Activities.Presentation
{
using System.Activities.Core.Presentation.Themes;
using System.Activities.Presentation.Model;
using System.Activities.Presentation.Converters;
using System.Activities.Presentation.PropertyEditing;
using System.Activities.Presentation.View;
using System.Windows;
using System.Runtime;
using System.Collections.Generic;
using System.Reflection;
using System.Diagnostics.CodeAnalysis;
using System.ComponentModel;
using System.Collections;
sealed class TypeCollectionPropertyEditor : DialogPropertyValueEditor
{
public const string AllowDuplicate = "AllowDuplicate";
public TypeCollectionPropertyEditor()
{
this.InlineEditorTemplate = EditorCategoryTemplateDictionary.Instance.GetCategoryTemplate("TypeCollection_InlineTemplate");
}
public override void ShowDialog(PropertyValue propertyValue, IInputElement commandSource)
{
ModelPropertyEntryToOwnerActivityConverter propertyEntryConverter =
new ModelPropertyEntryToOwnerActivityConverter();
ModelItem activityModelItem =
(ModelItem)propertyEntryConverter.Convert(propertyValue.ParentProperty, typeof(ModelItem), false, null);
ModelItem parentModelItem =
(ModelItem)propertyEntryConverter.Convert(propertyValue.ParentProperty, typeof(ModelItem), true, null);
EditingContext context = ((IModelTreeItem)activityModelItem).ModelTreeManager.Context;
ModelItemCollection inputData = parentModelItem.Properties[propertyValue.ParentProperty.PropertyName].Collection;
IEnumerable rawInputData = inputData.GetCurrentValue() as IEnumerable;
Fx.Assert(rawInputData != null, "rawInputData is null or is not IEnumerable.");
ModelProperty editingProperty = activityModelItem.Properties[propertyValue.ParentProperty.PropertyName];
bool allowDuplication = EditorOptionsAttribute.GetOptionValue(editingProperty.Attributes, TypeCollectionPropertyEditor.AllowDuplicate, true);
EditorWindow editorWindow = new EditorWindow(activityModelItem, rawInputData, context, activityModelItem.View, allowDuplication);
if (editorWindow.ShowOkCancel())
{
using (var commitEditingScope = inputData.BeginEdit(System.Activities.Core.Presentation.SR.ChangeTypeCollectionEditingScopeDesc))
{
inputData.Clear();
foreach (Type i in ((TypeCollectionDesigner)editorWindow.Content).UpdatedTypeCollection)
{
inputData.Add(i);
}
commitEditingScope.Complete();
}
}
}
sealed class EditorWindow : WorkflowElementDialog
{
public EditorWindow(ModelItem activity, IEnumerable data, EditingContext context, DependencyObject owner, bool allowDuplicate)
{
this.ModelItem = activity;
this.Context = context;
this.Owner = owner;
this.EnableMaximizeButton = false;
this.EnableMinimizeButton = false;
this.MinWidth = 450;
this.MinHeight = 260;
this.WindowResizeMode = ResizeMode.CanResize;
this.WindowSizeToContent = SizeToContent.Manual;
TypeCollectionDesigner content = new TypeCollectionDesigner()
{
Context = context,
InitialTypeCollection = data,
AllowDuplicate = allowDuplicate,
ParentDialog = this,
};
this.Title = (string)content.Resources["controlTitle"];
this.Content = content;
this.OnOk = content.OnOK;
this.HelpKeyword = HelpKeywords.TypeCollectionEditor;
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- IncrementalReadDecoders.cs
- SSmlParser.cs
- PropertyPath.cs
- ShimAsPublicXamlType.cs
- Vector3DCollection.cs
- InheritablePropertyChangeInfo.cs
- SqlSelectStatement.cs
- SqlUserDefinedTypeAttribute.cs
- TypeGeneratedEventArgs.cs
- ObjectStateFormatter.cs
- WebPartChrome.cs
- DefaultTextStoreTextComposition.cs
- indexingfiltermarshaler.cs
- WebCategoryAttribute.cs
- ObjectItemCollection.cs
- UpdatePanel.cs
- Inline.cs
- DecoderFallback.cs
- XmlArrayAttribute.cs
- Floater.cs
- StackSpiller.Bindings.cs
- RightsManagementProvider.cs
- RepeaterCommandEventArgs.cs
- XmlNamespaceMappingCollection.cs
- Axis.cs
- RectConverter.cs
- AutomationAttributeInfo.cs
- LinkLabel.cs
- DocumentViewer.cs
- DataControlLinkButton.cs
- StateMachineWorkflowDesigner.cs
- DockPanel.cs
- CodeAttachEventStatement.cs
- ConnectivityStatus.cs
- DataGridHelper.cs
- PriorityItem.cs
- ToolStripButton.cs
- ParallelDesigner.cs
- HtmlInputCheckBox.cs
- ProfileManager.cs
- CodeGroup.cs
- RichTextBox.cs
- StrongName.cs
- UrlAuthFailedErrorFormatter.cs
- GeometryHitTestParameters.cs
- FormatterServices.cs
- BookmarkUndoUnit.cs
- DataMemberListEditor.cs
- Script.cs
- EntitySqlException.cs
- GreenMethods.cs
- IncrementalReadDecoders.cs
- DataGridColumnCollectionEditor.cs
- OciEnlistContext.cs
- oledbconnectionstring.cs
- ParameterReplacerVisitor.cs
- ModifiableIteratorCollection.cs
- StickyNote.cs
- DataGridViewCellValidatingEventArgs.cs
- OleDbDataReader.cs
- RootBrowserWindowAutomationPeer.cs
- ProjectionPruner.cs
- FixedDocument.cs
- TransactionProxy.cs
- Transform.cs
- ContractMethodInfo.cs
- ExtensibleClassFactory.cs
- BasicSecurityProfileVersion.cs
- TreeNodeCollectionEditor.cs
- ProfileInfo.cs
- SQLByteStorage.cs
- SecurityContext.cs
- SettingsContext.cs
- HttpServerVarsCollection.cs
- PerspectiveCamera.cs
- MetadataItem_Static.cs
- PseudoWebRequest.cs
- XmlElementAttribute.cs
- ProfileGroupSettings.cs
- EnumerableRowCollectionExtensions.cs
- FlowLayoutSettings.cs
- CodeRegionDirective.cs
- TcpAppDomainProtocolHandler.cs
- ResourcesBuildProvider.cs
- PresentationAppDomainManager.cs
- Section.cs
- PropertyValueChangedEvent.cs
- StoreAnnotationsMap.cs
- PopOutPanel.cs
- PropertyToken.cs
- TextInfo.cs
- RegexWorker.cs
- PageContent.cs
- TextTreeObjectNode.cs
- TreeWalkHelper.cs
- LinkedList.cs
- DomNameTable.cs
- PersistenceTypeAttribute.cs
- Style.cs
- WebPartConnectVerb.cs