- AzureMessagingActivityPack_src.zip
- AzureMessagingActivityPack
- AzureMessagingActivityPack.sln
- AzureMessagingActivityPack.suo
- AzureMessagingActivityPack
- 3rdParty
- MessageMediationActivityLibrary.Design.dll
- MessageMediationActivityLibrary.dll
- Microsoft.Activities.Azure.Design.dll
- Microsoft.Activities.Azure.dll
- Microsoft.ServiceBus.dll
- Microsoft.VisualStudio.ActivityPack.Azure.dll
- Microsoft.WindowsAzure.StorageClient.dll
- Microsoft.XmlNotepad.dll
- RKiss.Activities.Azure.Messaging.Design.dll
- RKiss.Activities.Azure.Messaging.dll
- RKiss.Activities.Azure.Messaging.pdb
- SimulatorPubSub.exe
- SimulatorPubSub.exe.config
- AzureMessagingActivityPack.suo
- RKiss.Activities.Azure.Messaging.Designer
- RKiss.Activities.Azure.Messaging
- license.rtf
- ServiceBusTest
- ManagingSubscriptionRules.lnk
- Publisher.lnk
- Receiver.lnk
- Sender.lnk
- StoragePublisher.lnk
- StorageReceiver.lnk
- Subscriber.lnk
- SubscriptionManager.lnk
- WorkflowDesignerTester.lnk
- WorkflowPublisher1.lnk
- Test
- ConsoleApplications
- ConsoleManagingSubscriptionRules
- ConsolePublisherApplication
- ConsoleReceiverApplication
- ConsoleSBApplication.suo
- ConsoleSenderApplication
- ConsoleStorageSubscriberApplication
- ConsoleSubscriberApplication
- Logger
- Management
- SubscriptionManager
- Publishers
- WorkflowPublisher1
- WorkflowPublisher2
- Routers
- PubSubRouter
- Subscribers
|
//*****************************************************************************
// Description.....WF4 Message Mediation Library
//
// Author..........Roman Kiss, rkiss@pathcom.com
// Copyright © 2009 ATZ Consulting Inc. (see included license.rtf file)
//
// Date Created: 07/07/09
//
// Date Modified By Description
//-----------------------------------------------------------------------------
// 07/07/09 Roman Kiss Initial Revision
//
//*****************************************************************************
//
#region namespaces
using System;
using System.Linq;
using System.Activities;
using System.Activities.Presentation;
using System.Activities.Presentation.Model;
using System.Activities.Presentation.Converters;
using System.Activities.Presentation.PropertyEditing;
using System.Windows;
using System.Reflection;
using System.Xml.Linq;
using Microsoft.VisualBasic.Activities;
#endregion
namespace RKiss.Activities.Azure.Messaging.Editors
{
/// <summary>
/// Editor for IDictionary<string, Argument> property
/// </summary>
public class DynamicArgumentDictionaryEditor : DialogPropertyValueEditor
{
public DynamicArgumentDictionaryEditor()
{
Type type = Type.GetType("System.Activities.Core.Presentation.Themes.EditorCategoryTemplateDictionary, System.Activities.Core.Presentation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
Uri resourceLocator = new Uri(type.Assembly.GetName().Name + ";component/System/Activities/Core/Presentation/Themes/EditorCategoryTemplateDictionary.xaml", UriKind.RelativeOrAbsolute);
ResourceDictionary resources = (ResourceDictionary)Application.LoadComponent(resourceLocator);
base.InlineEditorTemplate = resources["ArgumentCollection_InlineTemplate"] as DataTemplate;
}
public override void ShowDialog(PropertyValue propertyValue, IInputElement commandSource)
{
ModelPropertyEntryToOwnerActivityConverter converter = new ModelPropertyEntryToOwnerActivityConverter();
ModelItem activity = (ModelItem)converter.Convert(propertyValue.ParentProperty, typeof(ModelItem), false, null);
ModelItem item2 = (ModelItem)converter.Convert(propertyValue.ParentProperty, typeof(ModelItem), true, null);
//workaround: EditingContext context = ((IModelTreeItem)activity).ModelTreeManager.Context;
Type type = Type.GetType("System.Activities.Presentation.Model.IModelTreeItem, System.Activities.Presentation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
ModelTreeManager manager = (ModelTreeManager)type.GetProperties().FirstOrDefault(e => e.Name == "ModelTreeManager").GetValue(activity, null);
EditingContext context = (EditingContext)typeof(ModelTreeManager).GetProperties(BindingFlags.Instance | BindingFlags.NonPublic).FirstOrDefault(e => e.Name == "Context").GetValue(manager, null);
ModelItemDictionary dictionary = item2.Properties[propertyValue.ParentProperty.PropertyName].Dictionary;
DynamicArgumentDesignerOptions options = new DynamicArgumentDesignerOptions()
{
Title = propertyValue.ParentProperty.DisplayName
};
if (DynamicArgumentDialog.ShowDialog(activity, dictionary, context, activity.View, options))
{
}
}
}
public class DynamicArgumentDictionaryEditor2 : DialogPropertyValueEditor
{
public DynamicArgumentDictionaryEditor2()
{
Type type = Type.GetType("System.Activities.Presentation.View.EditorResources, System.Activities.Presentation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
Uri resourceLocator = new Uri(type.Assembly.GetName().Name + ";component/System/WorkflowModel/Design/View/EditorResources.xaml", UriKind.RelativeOrAbsolute);
ResourceDictionary resources = (ResourceDictionary)Application.LoadComponent(resourceLocator);
base.InlineEditorTemplate = resources["DynamicArgumentDictionaryInlineTemplate"] as DataTemplate;
//System.Windows.Resources.StreamResourceInfo xamlResourceInfo = Application.GetResourceStream(resourceLocator);
//using (System.IO.StreamReader sr1 = new System.IO.StreamReader(xamlResourceInfo.Stream))
//{
// string xamstring = sr1.ReadToEnd();
// var xamlObject = System.Windows.Markup.XamlReader.LoadBaml(xamlResourceInfo.Stream, new System.Windows.Markup.ParserContext(), null, true);
//}
}
}
public class ExpressionValueEditor : DialogPropertyValueEditor
{
public ExpressionValueEditor()
{
Type type = Type.GetType("System.Activities.Presentation.View.EditorResources, System.Activities.Presentation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
Uri resourceLocator = new Uri(type.Assembly.GetName().Name + ";component/System/WorkflowModel/Design/View/EditorResources.xaml", UriKind.RelativeOrAbsolute);
ResourceDictionary resources = (ResourceDictionary)Application.LoadComponent(resourceLocator);
base.InlineEditorTemplate = resources["inlineExpressionEditorTemplate"] as DataTemplate;
}
public override void ShowDialog(PropertyValue propertyValue, IInputElement commandSource)
{
string xmltext = ((propertyValue.Value as InArgument<XElement>).Expression as VisualBasicValue<XElement>).ExpressionText;
MessageBox.Show(xmltext );
(propertyValue.Value as InArgument<XElement>).Expression = new VisualBasicValue<XElement>("<abc>Hello world</abc>");
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.