示例#1
0
 protected bool ContainsKey(INodeProxy node)
 {
     if (node.HasMetadata(Key) && node.GetNodeMetadata(Key) != null)
     {
         return(true);
     }
     return(false);
 }
示例#2
0
 protected bool ContainsKey(INodeProxy node)
 {
     if (node.HasMetadata(Key) && node.GetNodeMetadata(Key) != null)
     {
         return true;
     }
     return false;
 }
示例#3
0
 public VideoSizeHelper(INodeProxy nodeProxy)
 {
     MetadataContext videoSizeKey = new MetadataContext() { MetadataName = "Video.Size", NodeUid = nodeProxy.Id };
     string videoSize = null;
     if (nodeProxy.HasMetadata(videoSizeKey))
     {
         videoSize = nodeProxy.GetNodeMetadata(videoSizeKey).MetadataValue;
     }
     Size = ParseVideoSize(videoSize);
 }
示例#4
0
        public VideoSizeHelper(INodeProxy nodeProxy)
        {
            MetadataContext videoSizeKey = new MetadataContext()
            {
                MetadataName = "Video.Size", NodeUid = nodeProxy.Id
            };
            string videoSize = null;

            if (nodeProxy.HasMetadata(videoSizeKey))
            {
                videoSize = nodeProxy.GetNodeMetadata(videoSizeKey).MetadataValue;
            }
            Size = ParseVideoSize(videoSize);
        }
 public void ShowNodePropertiesDialog(INodeProxy node)
 {
     NodePropertiesDialog npd = new NodePropertiesDialog();
     npd.DataContext = node;
     MetadataContext noteKey = new MetadataContext()
     {
         NodeUid = node.Id,
         MetadataName = "Note"
     };
     if (node.HasMetadata(noteKey))
     {
         npd.Note = node.GetNodeMetadata(noteKey).MetadataValue;
     }
     npd.Closed += new EventHandler(NodePropertiesDialog_Close);
     npd.Show();
 }
        public void ShowNodePropertiesDialog(INodeProxy node)
        {
            NodePropertiesDialog npd = new NodePropertiesDialog();

            npd.DataContext = node;
            MetadataContext noteKey = new MetadataContext()
            {
                NodeUid      = node.Id,
                MetadataName = "Note"
            };

            if (node.HasMetadata(noteKey))
            {
                npd.Note = node.GetNodeMetadata(noteKey).MetadataValue;
            }
            npd.Closed += new EventHandler(NodePropertiesDialog_Close);
            npd.Show();
        }
示例#7
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            if (this.isTemplateApplied) return;

            this.nodeProxy = DataContext as INodeProxy;
            if (nodeProxy == null) 
            {
                throw new Exception("The DataContext was not a valid NodeProxy");
            }

            this.imagePart = GetTemplateChild(NodeControl.ImagePartName) as Rectangle;
            if (this.imagePart != null)
            {
                this.imagePart.SetValue(Canvas.LeftProperty, 0.0);
                this.imagePart.SetValue(Canvas.TopProperty, 0.0);
                ImageBrush nodeImageBrush = this.imagePart.Fill as ImageBrush;
                if (nodeImageBrush != null)
                {
                    nodeImageBrush.ImageFailed += new EventHandler<ExceptionRoutedEventArgs>(nodeImageBrush_ImageFailed);
                }
            }

            this.playMediaImagePart = GetTemplateChild(NodeControl.PlayMediaImagePartName) as Rectangle;
            if (this.playMediaImagePart != null)
            {
                this.playMediaImagePart.MouseLeftButtonDown += new MouseButtonEventHandler(playMediaImagePart_MouseLeftButtonUp);
                MetadataContext videoSourceKey = new MetadataContext()
                {
                    MetadataName = "Video.Source",
                    NodeUid = nodeProxy.Id
                };
                if (nodeProxy.HasMetadata(videoSourceKey) && !string.IsNullOrEmpty(nodeProxy.GetNodeMetadata(videoSourceKey).MetadataValue))
                {
                    this.playMediaImagePart.Visibility = System.Windows.Visibility.Visible;
                }
                else
                {
                    this.playMediaImagePart.Visibility = System.Windows.Visibility.Collapsed;
                }
                ImageBrush brush = playMediaImagePart.Fill as ImageBrush;
                if (brush != null)
                {
                    brush.ImageFailed += new EventHandler<ExceptionRoutedEventArgs>(brush_ImageFailed);
                }
            }
            this.pauseMediaImagePart = GetTemplateChild(NodeControl.PauseMediaImagePartName) as Rectangle;
            if (this.pauseMediaImagePart != null)
            {
                this.pauseMediaImagePart.MouseLeftButtonDown += new MouseButtonEventHandler(pauseMediaImagePart_MouseLeftButtonUp);
                this.pauseMediaImagePart.Visibility = System.Windows.Visibility.Collapsed;
                ImageBrush brush = pauseMediaImagePart.Fill as ImageBrush;
                if (brush != null)
                {
                    brush.ImageFailed += new EventHandler<ExceptionRoutedEventArgs>(brush_ImageFailed);
                }
            }


            this.textBlockPart = GetTemplateChild(NodeControl.TextBlockPartName) as TextBlock;
            this.textBlockBorderPart = GetTemplateChild(NodeControl.TextBlockBorderName) as Border;
            this.textBoxPart = GetTemplateChild(NodeControl.TextBoxPartName) as TextBox;
            this.transCntTextBlockPart = GetTemplateChild(NodeControl.TranscludionsCountTextBlockPartName) as TextBlock;
            this.childCntTextBlockPart = GetTemplateChild(NodeControl.ChildCountTextBlockPartName) as TextBlock;
            this.noteTextBlockPart = GetTemplateChild(NodeControl.NoteTextBlockPartName) as TextBlock;

            Rect textLocation = GetTextLocation();
            if (this.textBlockBorderPart != null)
            {
                this.textBlockBorderPart.SetValue(Canvas.LeftProperty, textLocation.X);
                this.textBlockBorderPart.SetValue(Canvas.TopProperty, textLocation.Y);
                this.textBlockBorderPart.Width = textLocation.Width;
                this.textBlockBorderPart.Height = textLocation.Height;
            }
            if (this.textBlockPart != null)
            {
                this.textBlockPart.Width = textLocation.Width;
                this.textBlockPart.Height = textLocation.Height;
                if (this.textBlockBorderPart != null)
                {
                    if (textLocation.Height < this.textBlockPart.ActualHeight)
                    {
                        this.textBlockBorderPart.Height = this.textBlockPart.ActualHeight;
                        this.textBlockPart.Height = this.textBlockPart.ActualHeight;
                    }
                    else
                    {
                        if (this.textBlockPart.ActualHeight > 10)
                        {
                            this.textBlockBorderPart.Height = this.textBlockPart.ActualHeight;
                            this.textBlockPart.Height = this.textBlockPart.ActualHeight;
                        }
                    }
                }
                this.textBlockHeight = this.textBlockPart.ActualHeight;
                this.textBlockWidth = this.textBlockPart.ActualWidth;
                this.textBlockPart.MouseLeftButtonDown += new MouseButtonEventHandler(OnNodeTextBlockMouseLeftButtonDown);
            }

            if (this.textBoxPart != null)
            {
                this.textBoxPart.SetValue(Canvas.LeftProperty, textLocation.X);
                this.textBoxPart.SetValue(Canvas.TopProperty, textLocation.Y);
                this.textBoxPart.Width = textLocation.Width + 5;
                this.textBoxPart.Height = textLocation.Height + 5;
                this.textBoxPart.KeyDown += new KeyEventHandler(TextBoxPart_KeyDown);
            }

            if (this.transCntTextBlockPart != null)
            {
                if (this.transCntTextBlockPart.Text == "1")
                {
                    this.transCntTextBlockPart.Visibility = Visibility.Collapsed;
                }
                else
                {
                    this.transCntTextBlockPart.Visibility = Visibility.Visible;
                }
            }

            if (this.childCntTextBlockPart != null)
            {
                if (nodeProxy.NodeType.Name == "CompendiumMapNode")
                {
                    this.childCntTextBlockPart.Visibility = Visibility.Visible;
                    this.childCntTextBlockPart.Text = GetMapNodeChildCount(nodeProxy);
                }
                else
                {
                    this.childCntTextBlockPart.Visibility = Visibility.Collapsed;
                }
            }

            if (this.noteTextBlockPart != null)
            {
                MetadataContext noteKey = new MetadataContext() 
                {
                    MetadataName = "Note",
                    NodeUid = nodeProxy.Id
                };
                if (nodeProxy.HasMetadata(noteKey) && !string.IsNullOrEmpty(nodeProxy.GetNodeMetadata(noteKey).MetadataValue))
                {
                    this.noteTextBlockPart.Visibility = Visibility.Visible;
                    ToolTipService.SetToolTip(this.noteTextBlockPart, nodeProxy.GetNodeMetadata(noteKey).MetadataValue);
                }
                else
                {
                    this.noteTextBlockPart.Visibility = Visibility.Collapsed;
                }
            }

            BitmapImage nodeImg = new BitmapImage();
            //for optimal memory usage and speed only create as many ImageBrush objects as there are images.
            if (ImageUrl != null)
            {
                if (!nodeImageCache.ContainsKey(ImageUrl))
                {
                    nodeImg.UriSource = new Uri(ImageUrl);

                    ImageBrush imageBrush = new ImageBrush();
                    imageBrush.ImageSource = nodeImg;

                    NodeImage = imageBrush;
                    nodeImageCache.Add(ImageUrl, imageBrush);
                }
                else
                {
                    NodeImage = nodeImageCache[ImageUrl];
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(NodeImageName))
                {
                    
                    switch (NodeImageName)
                    {
                        case "Map":
                            nodeImg.UriSource = new Uri("/SilverlightMappingToolBasic;component/Images/network.png", UriKind.Relative);
                            NodeImage = new ImageBrush() { ImageSource = nodeImg };
                            break;
                        case "Pro":
                            nodeImg.UriSource = new Uri("/SilverlightMappingToolBasic;component/Images/plus.png", UriKind.Relative);
                            NodeImage = new ImageBrush() { ImageSource = nodeImg };
                            break;
                        case "Con":
                            nodeImg.UriSource = new Uri("/SilverlightMappingToolBasic;component/Images/minus.png", UriKind.Relative);
                            NodeImage = new ImageBrush() { ImageSource = nodeImg };
                            break;
                        case "Decision":
                            nodeImg.UriSource = new Uri("/SilverlightMappingToolBasic;component/Images/generic.png", UriKind.Relative);
                            NodeImage = new ImageBrush() { ImageSource = nodeImg };
                            break;
                        case "Idea":
                            nodeImg.UriSource = new Uri("/SilverlightMappingToolBasic;component/Images/exclamation.png", UriKind.Relative);
                            NodeImage = new ImageBrush() { ImageSource = nodeImg };
                            break;
                        case "Question":
                            nodeImg.UriSource = new Uri("/SilverlightMappingToolBasic;component/Images/question.png", UriKind.Relative);
                            NodeImage = new ImageBrush() { ImageSource = nodeImg };
                            break;
                        default:
                            nodeImg.UriSource = new Uri("/SilverlightMappingToolBasic;component/Images/generic.png", UriKind.Relative);
                            NodeImage = new ImageBrush() { ImageSource = nodeImg };
                            break;
                    }
                }
            }

            this.okButtonPart = GetTemplateChild(NodeControl.OkButtonPartName) as Button;
            this.cancelButtonPart = GetTemplateChild(NodeControl.CancelButtonPartName) as Button;

            if (this.textBlockBorderPart != null 
                && this.okButtonPart != null && this.cancelButtonPart != null)
            {
                double left = (double)textBlockBorderPart.GetValue(Canvas.LeftProperty);
                double top = (double)textBlockBorderPart.GetValue(Canvas.TopProperty);

                this.okButtonPart.SetValue(Canvas.LeftProperty, left + this.textBoxPart.Width - 100);
                this.okButtonPart.SetValue(Canvas.TopProperty, top + this.textBoxPart.Height);
                this.okButtonPart.Click += new RoutedEventHandler(OnNodeTextBoxOkClick);

                this.cancelButtonPart.SetValue(Canvas.LeftProperty, left + this.textBoxPart.Width - 50);
                this.cancelButtonPart.SetValue(Canvas.TopProperty, top + this.textBoxPart.Height);
                this.cancelButtonPart.Click += new RoutedEventHandler(OnNodeTextBoxCancelClick);
            }

            if (InEditState)
            {
                GoToState(NodeControl.EdittingStateName, false);
                if (this.textBoxPart != null)
                {
                    this.textBoxPart.Focus();
                }
            }
            else
            {
                this.GoToState(NodeControl.NormalStateName, false);
            }

            this.isTemplateApplied = true;
        }
示例#8
0
        public void RefreshMetadata(INodeProxy node)
        {
            nodeProxy.Metadata = node.Metadata;
            DataContext        = nodeProxy;

            if (nodeProxy != null && isTemplateApplied)
            {
                if (transCntTextBlockPart != null)
                {
                    if (this.transCntTextBlockPart.Text == "1")
                    {
                        this.transCntTextBlockPart.Visibility = Visibility.Collapsed;
                    }
                    else
                    {
                        this.transCntTextBlockPart.Visibility = Visibility.Visible;
                    }
                }
                if (this.childCntTextBlockPart != null)
                {
                    if (nodeProxy.NodeType.Name == "CompendiumMapNode")
                    {
                        this.childCntTextBlockPart.Visibility = Visibility.Visible;
                        this.childCntTextBlockPart.Text       = GetMapNodeChildCount(nodeProxy);
                    }
                    else
                    {
                        this.childCntTextBlockPart.Visibility = Visibility.Collapsed;
                    }
                }
                if (noteTextBlockPart != null)
                {
                    MetadataContext noteKey = new MetadataContext()
                    {
                        MetadataName = "Note",
                        NodeUid      = nodeProxy.Id
                    };
                    if (nodeProxy.HasMetadata(noteKey) && !string.IsNullOrEmpty(nodeProxy.GetNodeMetadata(noteKey).MetadataValue))
                    {
                        string note = nodeProxy.GetNodeMetadata(noteKey).MetadataValue;
                        if (!string.IsNullOrEmpty(note))
                        {
                            this.noteTextBlockPart.Visibility = Visibility.Visible;
                            ToolTipService.SetToolTip(this.noteTextBlockPart, note);
                        }
                        else
                        {
                            this.noteTextBlockPart.Visibility = Visibility.Collapsed;
                        }
                    }
                    else
                    {
                        this.noteTextBlockPart.Visibility = Visibility.Collapsed;
                    }
                }

                if (playMediaImagePart != null && pauseMediaImagePart != null)
                {
                    MetadataContext videoSourceKey = new MetadataContext()
                    {
                        MetadataName = "Video.Source",
                        NodeUid      = nodeProxy.Id
                    };
                    if (nodeProxy.HasMetadata(videoSourceKey) && !string.IsNullOrEmpty(nodeProxy.GetNodeMetadata(videoSourceKey).MetadataValue))
                    {
                        this.playMediaImagePart.Visibility = System.Windows.Visibility.Visible;
                    }
                    else
                    {
                        this.playMediaImagePart.Visibility  = System.Windows.Visibility.Collapsed;
                        this.pauseMediaImagePart.Visibility = System.Windows.Visibility.Collapsed;
                    }
                }
            }
        }
示例#9
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            if (this.isTemplateApplied)
            {
                return;
            }

            this.nodeProxy = DataContext as INodeProxy;
            if (nodeProxy == null)
            {
                throw new Exception("The DataContext was not a valid NodeProxy");
            }

            this.imagePart = GetTemplateChild(NodeControl.ImagePartName) as Rectangle;
            if (this.imagePart != null)
            {
                this.imagePart.SetValue(Canvas.LeftProperty, 0.0);
                this.imagePart.SetValue(Canvas.TopProperty, 0.0);
                ImageBrush nodeImageBrush = this.imagePart.Fill as ImageBrush;
                if (nodeImageBrush != null)
                {
                    nodeImageBrush.ImageFailed += new EventHandler <ExceptionRoutedEventArgs>(nodeImageBrush_ImageFailed);
                }
            }

            this.playMediaImagePart = GetTemplateChild(NodeControl.PlayMediaImagePartName) as Rectangle;
            if (this.playMediaImagePart != null)
            {
                this.playMediaImagePart.MouseLeftButtonDown += new MouseButtonEventHandler(playMediaImagePart_MouseLeftButtonUp);
                MetadataContext videoSourceKey = new MetadataContext()
                {
                    MetadataName = "Video.Source",
                    NodeUid      = nodeProxy.Id
                };
                if (nodeProxy.HasMetadata(videoSourceKey) && !string.IsNullOrEmpty(nodeProxy.GetNodeMetadata(videoSourceKey).MetadataValue))
                {
                    this.playMediaImagePart.Visibility = System.Windows.Visibility.Visible;
                }
                else
                {
                    this.playMediaImagePart.Visibility = System.Windows.Visibility.Collapsed;
                }
                ImageBrush brush = playMediaImagePart.Fill as ImageBrush;
                if (brush != null)
                {
                    brush.ImageFailed += new EventHandler <ExceptionRoutedEventArgs>(brush_ImageFailed);
                }
            }
            this.pauseMediaImagePart = GetTemplateChild(NodeControl.PauseMediaImagePartName) as Rectangle;
            if (this.pauseMediaImagePart != null)
            {
                this.pauseMediaImagePart.MouseLeftButtonDown += new MouseButtonEventHandler(pauseMediaImagePart_MouseLeftButtonUp);
                this.pauseMediaImagePart.Visibility           = System.Windows.Visibility.Collapsed;
                ImageBrush brush = pauseMediaImagePart.Fill as ImageBrush;
                if (brush != null)
                {
                    brush.ImageFailed += new EventHandler <ExceptionRoutedEventArgs>(brush_ImageFailed);
                }
            }


            this.textBlockPart         = GetTemplateChild(NodeControl.TextBlockPartName) as TextBlock;
            this.textBlockBorderPart   = GetTemplateChild(NodeControl.TextBlockBorderName) as Border;
            this.textBoxPart           = GetTemplateChild(NodeControl.TextBoxPartName) as TextBox;
            this.transCntTextBlockPart = GetTemplateChild(NodeControl.TranscludionsCountTextBlockPartName) as TextBlock;
            this.childCntTextBlockPart = GetTemplateChild(NodeControl.ChildCountTextBlockPartName) as TextBlock;
            this.noteTextBlockPart     = GetTemplateChild(NodeControl.NoteTextBlockPartName) as TextBlock;

            Rect textLocation = GetTextLocation();

            if (this.textBlockBorderPart != null)
            {
                this.textBlockBorderPart.SetValue(Canvas.LeftProperty, textLocation.X);
                this.textBlockBorderPart.SetValue(Canvas.TopProperty, textLocation.Y);
                this.textBlockBorderPart.Width  = textLocation.Width;
                this.textBlockBorderPart.Height = textLocation.Height;
            }
            if (this.textBlockPart != null)
            {
                this.textBlockPart.Width  = textLocation.Width;
                this.textBlockPart.Height = textLocation.Height;
                if (this.textBlockBorderPart != null)
                {
                    if (textLocation.Height < this.textBlockPart.ActualHeight)
                    {
                        this.textBlockBorderPart.Height = this.textBlockPart.ActualHeight;
                        this.textBlockPart.Height       = this.textBlockPart.ActualHeight;
                    }
                    else
                    {
                        if (this.textBlockPart.ActualHeight > 10)
                        {
                            this.textBlockBorderPart.Height = this.textBlockPart.ActualHeight;
                            this.textBlockPart.Height       = this.textBlockPart.ActualHeight;
                        }
                    }
                }
                this.textBlockHeight = this.textBlockPart.ActualHeight;
                this.textBlockWidth  = this.textBlockPart.ActualWidth;
                this.textBlockPart.MouseLeftButtonDown += new MouseButtonEventHandler(OnNodeTextBlockMouseLeftButtonDown);
            }

            if (this.textBoxPart != null)
            {
                this.textBoxPart.SetValue(Canvas.LeftProperty, textLocation.X);
                this.textBoxPart.SetValue(Canvas.TopProperty, textLocation.Y);
                this.textBoxPart.Width    = textLocation.Width + 5;
                this.textBoxPart.Height   = textLocation.Height + 5;
                this.textBoxPart.KeyDown += new KeyEventHandler(TextBoxPart_KeyDown);
            }

            if (this.transCntTextBlockPart != null)
            {
                if (this.transCntTextBlockPart.Text == "1")
                {
                    this.transCntTextBlockPart.Visibility = Visibility.Collapsed;
                }
                else
                {
                    this.transCntTextBlockPart.Visibility = Visibility.Visible;
                }
            }

            if (this.childCntTextBlockPart != null)
            {
                if (nodeProxy.NodeType.Name == "CompendiumMapNode")
                {
                    this.childCntTextBlockPart.Visibility = Visibility.Visible;
                    this.childCntTextBlockPart.Text       = GetMapNodeChildCount(nodeProxy);
                }
                else
                {
                    this.childCntTextBlockPart.Visibility = Visibility.Collapsed;
                }
            }

            if (this.noteTextBlockPart != null)
            {
                MetadataContext noteKey = new MetadataContext()
                {
                    MetadataName = "Note",
                    NodeUid      = nodeProxy.Id
                };
                if (nodeProxy.HasMetadata(noteKey) && !string.IsNullOrEmpty(nodeProxy.GetNodeMetadata(noteKey).MetadataValue))
                {
                    this.noteTextBlockPart.Visibility = Visibility.Visible;
                    ToolTipService.SetToolTip(this.noteTextBlockPart, nodeProxy.GetNodeMetadata(noteKey).MetadataValue);
                }
                else
                {
                    this.noteTextBlockPart.Visibility = Visibility.Collapsed;
                }
            }

            BitmapImage nodeImg = new BitmapImage();

            //for optimal memory usage and speed only create as many ImageBrush objects as there are images.
            if (ImageUrl != null)
            {
                if (!nodeImageCache.ContainsKey(ImageUrl))
                {
                    nodeImg.UriSource = new Uri(ImageUrl);

                    ImageBrush imageBrush = new ImageBrush();
                    imageBrush.ImageSource = nodeImg;

                    NodeImage = imageBrush;
                    nodeImageCache.Add(ImageUrl, imageBrush);
                }
                else
                {
                    NodeImage = nodeImageCache[ImageUrl];
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(NodeImageName))
                {
                    switch (NodeImageName)
                    {
                    case "Map":
                        nodeImg.UriSource = new Uri("/SilverlightMappingToolBasic;component/Images/network.png", UriKind.Relative);
                        NodeImage         = new ImageBrush()
                        {
                            ImageSource = nodeImg
                        };
                        break;

                    case "Pro":
                        nodeImg.UriSource = new Uri("/SilverlightMappingToolBasic;component/Images/plus.png", UriKind.Relative);
                        NodeImage         = new ImageBrush()
                        {
                            ImageSource = nodeImg
                        };
                        break;

                    case "Con":
                        nodeImg.UriSource = new Uri("/SilverlightMappingToolBasic;component/Images/minus.png", UriKind.Relative);
                        NodeImage         = new ImageBrush()
                        {
                            ImageSource = nodeImg
                        };
                        break;

                    case "Decision":
                        nodeImg.UriSource = new Uri("/SilverlightMappingToolBasic;component/Images/generic.png", UriKind.Relative);
                        NodeImage         = new ImageBrush()
                        {
                            ImageSource = nodeImg
                        };
                        break;

                    case "Idea":
                        nodeImg.UriSource = new Uri("/SilverlightMappingToolBasic;component/Images/exclamation.png", UriKind.Relative);
                        NodeImage         = new ImageBrush()
                        {
                            ImageSource = nodeImg
                        };
                        break;

                    case "Question":
                        nodeImg.UriSource = new Uri("/SilverlightMappingToolBasic;component/Images/question.png", UriKind.Relative);
                        NodeImage         = new ImageBrush()
                        {
                            ImageSource = nodeImg
                        };
                        break;

                    default:
                        nodeImg.UriSource = new Uri("/SilverlightMappingToolBasic;component/Images/generic.png", UriKind.Relative);
                        NodeImage         = new ImageBrush()
                        {
                            ImageSource = nodeImg
                        };
                        break;
                    }
                }
            }

            this.okButtonPart     = GetTemplateChild(NodeControl.OkButtonPartName) as Button;
            this.cancelButtonPart = GetTemplateChild(NodeControl.CancelButtonPartName) as Button;

            if (this.textBlockBorderPart != null &&
                this.okButtonPart != null && this.cancelButtonPart != null)
            {
                double left = (double)textBlockBorderPart.GetValue(Canvas.LeftProperty);
                double top  = (double)textBlockBorderPart.GetValue(Canvas.TopProperty);

                this.okButtonPart.SetValue(Canvas.LeftProperty, left + this.textBoxPart.Width - 100);
                this.okButtonPart.SetValue(Canvas.TopProperty, top + this.textBoxPart.Height);
                this.okButtonPart.Click += new RoutedEventHandler(OnNodeTextBoxOkClick);

                this.cancelButtonPart.SetValue(Canvas.LeftProperty, left + this.textBoxPart.Width - 50);
                this.cancelButtonPart.SetValue(Canvas.TopProperty, top + this.textBoxPart.Height);
                this.cancelButtonPart.Click += new RoutedEventHandler(OnNodeTextBoxCancelClick);
            }

            if (InEditState)
            {
                GoToState(NodeControl.EdittingStateName, false);
                if (this.textBoxPart != null)
                {
                    this.textBoxPart.Focus();
                }
            }
            else
            {
                this.GoToState(NodeControl.NormalStateName, false);
            }

            this.isTemplateApplied = true;
        }