|
//*****************************************************************************
// 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.Activities;
using System.Activities.Presentation.Converters;
using System.Activities.Presentation.Model;
using System.Activities.Presentation.PropertyEditing;
using System.Linq;
using System.Windows;
using System.Xml.Linq;
using Microsoft.VisualBasic.Activities;
using RKiss.MessageMediationActivityLibrary.Design.Dialogs.Forms;
#endregion
namespace RKiss.MessageMediationActivityLibrary.Design.Editors
{
public class MessageMediationEditor : XmlValueExpressionEditor
{
public override void ShowDialog(PropertyValue propertyValue, IInputElement commandSource)
{
try
{
if (propertyValue != null)
{
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);
// properties
var qSourceUri = item2.Properties.FirstOrDefault(p => p.Name == "SourceUri");
// values
string sourceUri = qSourceUri == null ? string.Empty : qSourceUri.ComputedValue as string;
string xmltext = propertyValue.Value != null ? ((propertyValue.Value as InArgument<XElement>).Expression as VisualBasicValue<XElement>).ExpressionText : string.Empty;
CreateMessageForm dialog = new CreateMessageForm(xmltext, sourceUri);
dialog.ShowDialog();
if (dialog.DialogResult == System.Windows.Forms.DialogResult.OK)
{
item2.Properties["SourceUri"].SetValue(dialog.SourceUri);
if (string.IsNullOrEmpty(dialog.XmlText))
propertyValue.Value = null;
else
{
var vbv = new VisualBasicValue<XElement>(dialog.XmlText);
propertyValue.Value = new InArgument<XElement>(vbv);
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}
|
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.