Esempio n. 1
0
 public PSMAttributeTextBox GetTextBoxOfAttribute(PSMAttribute psmAttribute)
 {
     if (RepresentantsCollection.ContainsKey(psmAttribute.PSMClass))
     {
         PSMClassView cv = (PSMClassView)RepresentantsCollection[psmAttribute.PSMClass];
         return(cv.AttributeTextBoxes.FirstOrDefault(tb => tb.PSMAttribute == psmAttribute));
     }
     return(null);
 }
Esempio n. 2
0
        public void SetSelection(Component component, bool focusComponent = false)
        {
            ClearSelection(false);
            ComponentViewBase view;

            RepresentantsCollection.TryGetValue(component, out view);
            bool textboxfound = false;

            if (view == null)
            {
                EditableTextBox t = null;
                if (component is PIMAttribute)
                {
                    view = RepresentantsCollection[((PIMAttribute)component).PIMClass];
                    t    = ((PIMClassView)view).AttributeTextBoxes.FirstOrDefault(tb => tb.PIMAttribute == component);
                }
                if (component is ModelOperation)
                {
                    view = RepresentantsCollection[((ModelOperation)component).PIMClass];
                    t    = ((PIMClassView)view).OperationTextBoxes.FirstOrDefault(tb => tb.ModelOperation == component);
                }
                if (component is PSMAttribute)
                {
                    view = RepresentantsCollection[((PSMAttribute)component).PSMClass];
                    t    = ((PSMClassView)view).FirstOrDefault(tb => tb.PSMAttribute == component);
                }
                if (t != null)
                {
                    t.Selected   = true;
                    textboxfound = true;
                }
            }
            if (view != null)
            {
                if (!textboxfound)
                {
                    view.SelectAndSelectCreatedControls();
                }
                if (focusComponent)
                {
                    //view.Focus();
                    double x = 0;
                    double y = 0;
                    if (view is INodeComponentViewBase)
                    {
                        x = Canvas.GetLeft(((INodeComponentViewBase)view).MainNode);
                        y = Canvas.GetTop(((INodeComponentViewBase)view).MainNode);
                    }
                    if (view is IConnectorViewBase)
                    {
                        x = ((IConnectorViewBase)view).Connector.GetBounds().Left;
                        y = ((IConnectorViewBase)view).Connector.GetBounds().Top;
                    }

#if SILVERLIGHT
#else
                    ScrollViewer scrollViewer = ExolutioCanvasWithZoomer.scrollViewer;
                    if (!double.IsNaN(x))
                    {
                        scrollViewer.ScrollToHorizontalOffset(x);
                    }
                    if (!double.IsNaN(y))
                    {
                        scrollViewer.ScrollToVerticalOffset(y);
                    }
#endif
                }
            }
            InvokeSelectionChanged();
        }