internal ActionNodePropertiesEditor(ActionNodeConfiguration node, NodeSelectionManager nodeSelectionManager)
        {
            InitializeComponent();
            this.node = node;
            this.nodeSelectionManager = nodeSelectionManager;

            uiName.Text = node.Name;

            #region Prepare next node selector
            uiNextNodeSelector.Initialize(nodeSelectionManager, node, () => node.NextNode, delegate(NodeConfiguration nextNode) {
                node.NextNode = nextNode;
            });
            #endregion

            #region Prepare actions editing
            uiActionsListEditor.Initialize(AddAction);
            uiActionsListEditor.ItemRemoved += RemoveAction;
            uiActionsListEditor.ItemSelected += SetActiveAction;

            uiActionConfigurationRegion.Visibility = Visibility.Collapsed;
            foreach (ActionConfiguration action in node.Actions) {
                uiActionsListEditor.AddItem(CreateActionRepresentation(action));
            }
            uiActionsListEditor.SelectItem(uiActionsListEditor.Items.FirstOrDefault());
            #endregion
        }
        internal EntryNodePropertiesEditor(EntryNodeConfiguration node, NodeSelectionManager nodeSelectionManager)
        {
            InitializeComponent();
            this.node = node;
            this.nodeSelectionManager = nodeSelectionManager;

            uiName.Text = node.Name;

            #region Prepare next node selector
            uiNextNodeSelector.Initialize(nodeSelectionManager, node, () => node.NextNode, delegate(NodeConfiguration nextNode) {
                node.NextNode = nextNode;
            });
            #endregion
        }
        internal TerminatorNodePropertiesEditor(TerminatorNodeConfiguration node, NodeSelectionManager nodeSelectionManager)
        {
            InitializeComponent();
            this.node = node;
            this.nodeSelectionManager = nodeSelectionManager;

            uiName.Text = node.Name;
            uiIsReturningOutput.IsChecked = node.IsReturningOutput;
            uiResultMessage.IsEnabled = node.IsReturningOutput;

            if (node.ResultMessageSelection == null) {
                node.ResultMessageSelection = new TokenSelection();
            }
            uiResultMessage.Selection = node.ResultMessageSelection;
        }
        internal CbrNodePropertiesEditor(CbrNodeConfiguration node, NodeSelectionManager nodeSelectionManager)
        {
            InitializeComponent();
            this.node = node;
            this.nodeSelectionManager = nodeSelectionManager;

            uiName.Text = node.Name;

            if (node.TestedSelection == null) {
                node.TestedSelection = new TokenSelection();
            }
            uiTestedMessage.Selection = node.TestedSelection;

            uiDefaultTargetSelector.Initialize(nodeSelectionManager, node, () => node.DefaultTarget, delegate(NodeConfiguration defaultTarget) {
                node.DefaultTarget = defaultTarget;
            });

            #region Prepare branches
            uiBranches.Initialize(delegate {
                XrmUri branchKey = new XrmUri();
                node.Branches.Add(branchKey, null);
                return CreateBranchPresentation(branchKey);
            });
            uiBranches.ItemRemoved += delegate(FrameworkElement uiBranch) {
                XrmUri branchKey = (XrmUri)uiBranch.Tag;
                node.Branches.Remove(branchKey);
                nodeSelectionManager.MessageflowGraphPresenter.RaiseGraphChanged();
            };
            uiBranches.ItemAdded += delegate(FrameworkElement uiBranch) {
                nodeSelectionManager.MessageflowGraphPresenter.RaiseGraphChanged();
            };
            foreach (XrmUri branchKey in node.Branches.Keys) {
                uiBranches.AddItem(CreateBranchPresentation(branchKey));
            }
            #endregion

            #region Prepare uiTestXml
            uiTestXml.SyntaxHighlighting = ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.Instance.GetDefinition("XML");
            uiTestXml.Options.ConvertTabsToSpaces = true;
            uiTestXml.Options.IndentationSize = 4;
            uiTestXml.ShowLineNumbers = true;
            #endregion
        }