Esempio n. 1
0
 private void OnMouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
 {
     if (classController != null)
     {
         classController.ShowAttributeDialog(attribute);
     }
 }
Esempio n. 2
0
        public PSMAttributeTextBox(PSMAttribute Attribute, IControlsPSMAttributes attributesController)
        {
            this.attribute       = Attribute;
            this.classController = attributesController;

            #region property context menu

            this.ContextMenu = new ContextMenu();

            ContextMenuItem miPropagatePIMLess = new ContextMenuItem("Propagate to PIM");
            miPropagatePIMLess.Icon      = ContextMenuIcon.GetContextIcon("AddAttributes");
            miPropagatePIMLess.Click    += delegate { attributesController.PropagatePIMLess(attribute); };
            miPropagatePIMLess.IsEnabled = attribute.RepresentedAttribute == null;
            attribute.PropertyChanged   +=
                delegate(object sender, PropertyChangedEventArgs e)
            {
                if (e.PropertyName == "RepresentedAttribute")
                {
                    miPropagatePIMLess.IsEnabled = attribute.RepresentedAttribute == null;
                }
            };
            this.ContextMenu.Items.Add(miPropagatePIMLess);

            ContextMenuItem remove = new ContextMenuItem("Remove attribute");
            remove.Icon   = ContextMenuIcon.GetContextIcon("delete2");
            remove.Click += delegate { attributesController.RemoveAttribute(attribute); };
            this.ContextMenu.Items.Add(remove);

            if (attributesController is PSM_AttributeContainerController)
            {
                ContextMenuItem returnAttribute = new ContextMenuItem("Move back to class");
                returnAttribute.Click += delegate { ((PSM_AttributeContainerController)attributesController).MoveAttributeBackToClass(attribute); };
                this.ContextMenu.Items.Add(returnAttribute);
            }
            else
            {
                ContextMenuItem miMoveToAC = new ContextMenuItem("Move to attribute container");
                miMoveToAC.Click += delegate { ((PSM_ClassController)attributesController).MoveAttributesToAttributeContainer(null, attribute); };
                this.ContextMenu.Items.Add(miMoveToAC);
            }

            ContextMenuItem change = new ContextMenuItem("Properties...");
            change.Icon   = ContextMenuIcon.GetContextIcon("pencil");
            change.Click += delegate { attributesController.ShowAttributeDialog(attribute); };
            this.ContextMenu.Items.Add(change);

            moveUp        = new ContextMenuItem("Move up");
            moveUp.Click += delegate { attributesController.MoveAttributeUp(attribute); };
            this.ContextMenu.Items.Add(moveUp);


            moveDown        = new ContextMenuItem("Move down");
            moveDown.Click += delegate { attributesController.MoveAttributeDown(attribute); };
            this.ContextMenu.Items.Add(moveDown);


            #endregion

            attribute.PropertyChanged += delegate { RefreshTextContent(); };
            MouseDoubleClick          += OnMouseDoubleClick;
            RefreshTextContent();
        }