예제 #1
0
        protected override void onEdit(DiagramDesigner.DesignerItem item, string name)
        {
            if (item != null && item.Tag != null && item.Tag is Entity)
            {
                DiagramDesigner.DesignerItem block = GetBlockByName(name);
                Entity entity = (Entity)item.Tag;

                if (string.IsNullOrWhiteSpace(name))
                {
                    Kernel.Util.MessageDisplayer.DisplayError("Empty name", "The name can't be empty!");
                    item.Renderer.Text = entity.name;
                    EditCurrentSelection();
                    return;
                }

                if (block != null && !block.Equals(item))
                {
                    Kernel.Util.MessageDisplayer.DisplayError("Duplicate name", "There is another block named: " + name + ".");
                    item.Renderer.Text = entity.name;
                    EditCurrentSelection();
                    return;
                }
                entity.name = name;
                this.SelectionService.SelectItem(item);
                notifyModifyBlock(item);
            }
        }
예제 #2
0
        private void BringToFront/*将制定元素移到最前面*/ (DesignerItem designerItem)
        {
            var canvas = designerItem.Parent as Canvas;

            if (canvas == null)
            {
                return;
            }

            List <UIElement> childrenSorted =
                (from UIElement item in canvas.Children
                 orderby Canvas.GetZIndex(item as UIElement) ascending
                 select item as UIElement).ToList();

            int i = 0;
            int j = 0;

            foreach (UIElement item in childrenSorted)
            {
                if (designerItem.Equals(item))
                {
                    int idx = Canvas.GetZIndex(item);
                    Canvas.SetZIndex(item, childrenSorted.Count - 1 + j++);
                }
                else
                {
                    Canvas.SetZIndex(item, i++);
                }
            }
        }
예제 #3
0
 protected override void onEdit(DiagramDesigner.DesignerItem item, string name)
 {
     if (item != null && item.Tag != null && item.Tag is TransformationTreeItem)
     {
         DiagramDesigner.DesignerItem block  = GetBlockByName(name);
         TransformationTreeItem       entity = (TransformationTreeItem)item.Tag;
         if (block != null && !block.Equals(item))
         {
             Kernel.Util.MessageDisplayer.DisplayError("Duplicate name", "There is another block named: " + name + ".");
             item.Renderer.Text = entity.name;
             EditCurrentSelection();
             return;
         }
         entity.name = name;
         this.SelectionService.SelectItem(item);
         notifyModifyBlock(item);
     }
 }
예제 #4
0
 protected bool ValidateEdition(DiagramDesigner.DesignerItem item, string name)
 {
     if (string.IsNullOrWhiteSpace(name))
     {
         Kernel.Util.MessageDisplayer.DisplayError("Empty name", "The name can't be empty!");
         return(false);
     }
     if (item != null && item.Tag != null && item.Tag is TransformationTreeItem)
     {
         DiagramDesigner.DesignerItem block  = this.TransformationTreeDiagramView.designerCanvas.GetBlockByName(name);
         TransformationTreeItem       entity = (TransformationTreeItem)item.Tag;
         if (block != null && !block.Equals(item))
         {
             Kernel.Util.MessageDisplayer.DisplayError("Duplicate name", "There is another TreeItem named: " + name + ".");
             return(false);
         }
     }
     return(true);
 }
예제 #5
0
        /*将制定元素移到最前面*/
        private void BringToFront(DesignerItem designerItem)
        {
            var canvas = designerItem.Parent as Canvas;
            if (canvas == null) return;

            List<UIElement> childrenSorted =
                (from UIElement item in canvas.Children
                 orderby Canvas.GetZIndex(item as UIElement) ascending
                 select item as UIElement).ToList();

            int i = 0;
            int j = 0;
            foreach (UIElement item in childrenSorted)
            {
                if (designerItem.Equals(item))
                {
                    int idx = Canvas.GetZIndex(item);
                    Canvas.SetZIndex(item, childrenSorted.Count - 1 + j++);
                }
                else
                {
                    Canvas.SetZIndex(item, i++);
                }
            }
        }