Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / Tools / System.Activities.Core.Presentation / System / Activities / Core / Presentation / InteropDesigner.xaml.cs / 1305376 / InteropDesigner.xaml.cs
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//---------------------------------------------------------------
namespace System.Activities.Core.Presentation
{
using System.Activities.Statements;
using System.ComponentModel;
using System.Activities.Presentation.PropertyEditing;
using System.Activities.Presentation;
using System.Activities.Presentation.Metadata;
using System.Windows.Threading;
using System.Activities.Presentation.View;
using System.IO;
using System.Runtime;
partial class InteropDesigner
{
static Func filter;
public InteropDesigner()
{
this.InitializeComponent();
}
public static Func Filter
{
get
{
if (InteropDesigner.filter == null)
{
// We will build tye Tyname for System.Workflow.ComponentModel.Activity
string typeName = typeof(Activity).AssemblyQualifiedName;
typeName = typeName.Replace("System.Activities", "System.Workflow.ComponentModel");
Type activityType = null;
try
{
activityType = Type.GetType(typeName);
}
catch (System.Exception e)
{
if (Fx.IsFatal(e))
{
throw;
}
activityType = null;
}
if (activityType != null)
{
//Interop.Body has to be a 3.5 Activity
InteropDesigner.filter = (type) => activityType.IsAssignableFrom(type);
}
}
return InteropDesigner.filter;
}
}
protected override void OnModelItemChanged(object newItem)
{
base.OnModelItemChanged(newItem);
this.ModelItem.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(OnModelItemPropertyChanged);
}
void OnModelItemPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (e.PropertyName == "ActivityType")
{
//Whenever ActivityType property changes, the activity will generate a new set of
// dynamic properties. the property browser will not pick up the changes till
// we select some other modelitem and then select this back.
// modelItem.root is theone that will be always available.
this.Dispatcher.BeginInvoke(DispatcherPriority.SystemIdle, (Action)(() =>
{
Selection.SelectOnly(this.Context, this.ModelItem.Root);
}));
this.Dispatcher.BeginInvoke(DispatcherPriority.SystemIdle, (Action)(() =>
{
Selection.SelectOnly(this.Context, this.ModelItem);
}));
}
}
public static void RegisterMetadataDelayed()
{
WorkflowViewService.AddDelayedDesignerRegistration("System.Activities.Statements.Interop", () =>
{
AttributeTableBuilder builder = new AttributeTableBuilder();
string typeName = typeof(InteropDesigner).AssemblyQualifiedName;
typeName = typeName.Replace("System.Activities.Core.Presentation.InteropDesigner", "System.Activities.Statements.Interop");
typeName = typeName.Replace("System.Activities.Core.Presentation", "System.Workflow.Runtime");
Type activityType;
try
{
activityType = Type.GetType(typeName);
}
catch (System.Exception e)
{
if (Fx.IsFatal(e))
{
throw;
}
activityType = null;
}
//activityType will be null in ClientSKU since System.Workflow.Runtime.dll is not a part of clientSKU.
if (activityType != null)
{
builder.AddCustomAttributes(activityType, new DesignerAttribute(typeof(InteropDesigner)));
builder.AddCustomAttributes(
activityType,
"ActivityType",
new EditorOptionsAttribute { Name = TypePropertyEditor.BrowseTypeDirectly, Value = true });
builder.AddCustomAttributes(
activityType,
"ActivityType",
new EditorOptionsAttribute { Name = TypePropertyEditor.Filter, Value = Filter });
builder.AddCustomAttributes(
activityType,
"ActivityType",
new RefreshPropertiesAttribute(RefreshProperties.All));
builder.AddCustomAttributes(activityType, new ActivityDesignerOptionsAttribute { AllowDrillIn = false });
MetadataStore.AddAttributeTable(builder.CreateTable());
}
});
}
}
}
// 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
- DetailsViewDeleteEventArgs.cs
- NamespaceMapping.cs
- BehaviorEditorPart.cs
- DataGridToolTip.cs
- TranslateTransform3D.cs
- ZipIOExtraField.cs
- FontStretches.cs
- TableColumn.cs
- XmlExpressionDumper.cs
- ResourcePool.cs
- ConfigurationConverterBase.cs
- QilReference.cs
- DataKeyArray.cs
- XmlSchemaAnnotated.cs
- SoapHeaders.cs
- ScriptingWebServicesSectionGroup.cs
- QueryCorrelationInitializer.cs
- DocumentViewerConstants.cs
- DataGridColumnHeadersPresenterAutomationPeer.cs
- SchemaLookupTable.cs
- ClientBuildManagerCallback.cs
- SelectQueryOperator.cs
- ToolStripRenderer.cs
- BlurBitmapEffect.cs
- AsyncParams.cs
- GridViewCancelEditEventArgs.cs
- UpWmlPageAdapter.cs
- DataGridViewButtonColumn.cs
- TextServicesDisplayAttributePropertyRanges.cs
- WorkflowTerminatedException.cs
- Vector3D.cs
- SignedInfo.cs
- OLEDB_Util.cs
- RegexMatch.cs
- Win32PrintDialog.cs
- DataGridColumnReorderingEventArgs.cs
- LinkLabelLinkClickedEvent.cs
- ServiceEndpointCollection.cs
- DesignerTextBoxAdapter.cs
- DataSourceSelectArguments.cs
- IsolatedStorageSecurityState.cs
- XmlEncoding.cs
- Form.cs
- AppSettingsSection.cs
- MachineSettingsSection.cs
- IndependentlyAnimatedPropertyMetadata.cs
- ObjectDataProvider.cs
- BuilderElements.cs
- Control.cs
- AppDomain.cs
- AtomMaterializer.cs
- InternalUserCancelledException.cs
- GiveFeedbackEvent.cs
- AssemblyBuilderData.cs
- Timeline.cs
- TextPattern.cs
- AutoCompleteStringCollection.cs
- DispatcherExceptionFilterEventArgs.cs
- _DigestClient.cs
- WebServiceMethodData.cs
- XmlNamespaceDeclarationsAttribute.cs
- DataObjectPastingEventArgs.cs
- RtType.cs
- SocketException.cs
- WebPartDisplayModeCancelEventArgs.cs
- SafeFileHandle.cs
- PointHitTestResult.cs
- COM2PictureConverter.cs
- LabelAutomationPeer.cs
- QuotedPairReader.cs
- HelpInfo.cs
- ResizeGrip.cs
- GrammarBuilderBase.cs
- AttributeData.cs
- DataBoundLiteralControl.cs
- BaseParagraph.cs
- OdbcFactory.cs
- httpserverutility.cs
- Pair.cs
- TypefaceCollection.cs
- BaseHashHelper.cs
- HostVisual.cs
- XmlSchemaSimpleContentRestriction.cs
- WindowsGraphics.cs
- MobileControlsSectionHelper.cs
- OleAutBinder.cs
- ResourceSetExpression.cs
- RawMouseInputReport.cs
- LoadWorkflowByKeyAsyncResult.cs
- RuleRef.cs
- InternalResources.cs
- DataObjectAttribute.cs
- DataGridViewCellContextMenuStripNeededEventArgs.cs
- LinqDataSourceView.cs
- ScriptResourceInfo.cs
- DbTransaction.cs
- Debug.cs
- ConnectionDemuxer.cs
- CapabilitiesRule.cs
- ColorAnimation.cs