示例#1
0
        /// <summary>
        /// Shows component form
        /// </summary>
        public void ShowForm()
        {
            if (component is IShowForm)
            {
                IShowForm sf = component as IShowForm;
                sf.Show();
                return;
            }
            IChildObjectLabel panel = ContainerPerformer.GetPanel(component as IObjectLabel) as IChildObjectLabel;

            panel.ShowForm();
        }
示例#2
0
        private static void removeForm(INamedComponent component)
        {
            if (component is NamedComponent)
            {
                NamedComponent nc = component as NamedComponent;
                nc.RemoveForm();
                return;
            }
            if (component is IShowForm)
            {
                IShowForm sf = component as IShowForm;
                sf.RemoveForm();
                return;
            }
            IChildObjectLabel l = ContainerPerformer.GetPanel(component as IObjectLabel) as IChildObjectLabel;

            l.RemoveForm();
        }
示例#3
0
        private void MouseUp(object sender, MouseEventArgs e)
        {
            Control caption = sender as Control;

            IsMoved = false;
            pDesktop.SetBlocking(false);
            PanelDesktop   Desktop = pDesktop;
            ICategoryArrow arrow   = Desktop.ActiveArrow;

            if (!StaticExtensionDiagramUIForms.IsArrowClick(e))
            {
                return;
            }
            try
            {
                if (arrow == null)
                {
                    pDesktop.Redraw();
                    return;
                }
                int x = this.label.X + caption.Left + e.X;
                int y = this.label.Y + caption.Top + e.Y;
                for (int i = 0; i < Desktop.Controls.Count; i++)
                {
                    if (!(Desktop.Controls[i] is IChildObjectLabel) & !(Desktop.Controls[i] is IObjectLabelUI))
                    {
                        continue;
                    }
                    Control c = Desktop.Controls[i];
                    bool    hor = x <c.Left | x> c.Left + c.Width;
                    bool    vert = y <c.Top | y> c.Top + c.Height;
                    if (hor | vert)
                    {
                        continue;
                    }
                    IObjectLabel label = null;
                    if (Desktop.Controls[i] is IObjectLabelUI)
                    {
                        label = Desktop.Controls[i] as IObjectLabel;
                    }
                    else
                    {
                        IChildObjectLabel child = Desktop.Controls[i] as IChildObjectLabel;
                        label = child.Label;
                    }

                    arrow.Target = label.Object;
                    IArrowLabel lab = Desktop.Tools.Factory.CreateArrowLabel(Desktop.Tools.Active, arrow, this.label, label);
                    lab.Arrow.SetAssociatedObject(lab);
                    Desktop.AddArrowLabel(lab);
                    break;
                }
            }
            catch (Exception ex)
            {
                ex.ShowError(10);
                if (arrow != null)
                {
                    if (arrow is IRemovableObject)
                    {
                        IRemovableObject rem = arrow as IRemovableObject;
                        rem.RemoveObject();
                    }
                }
                ex.ShowError(1);
            }
            Desktop.ActiveArrow = null;
            Desktop.Redraw();
        }
示例#4
0
 /// <summary>
 /// Checks whether object belongs to this pair
 /// </summary>
 /// <param name="label">The object label</param>
 /// <returns>True if belongs and false otherwise</returns>
 internal bool belongs(IChildObjectLabel label)
 {
     return((label.Label == objects[0]) | (label.Label == objects[1]));
 }
示例#5
0
        /// <summary>
        /// The on mouse up event handler
        /// </summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The event arguments</param>
        protected void onMouseUpMoveEventHandler(object sender, MouseEventArgs e)
        {
            isMoved         = false;
            Desktop.IsMoved = false;
            Desktop.SetBlocking(false);
            ICategoryArrow arrow = Desktop.ActiveArrow;

            if (!e.IsArrowClick())
            {
                return;
            }
            try
            {
                if (arrow == null)
                {
                    Desktop.Redraw();
                    return;
                }
                int x = Left + e.X;
                int y = Top + e.Y;
                for (int i = 0; i < Desktop.Controls.Count; i++)
                {
                    if (!(Desktop.Controls[i] is IChildObjectLabel) & !(Desktop.Controls[i] is IObjectLabel))
                    {
                        continue;
                    }
                    Control c = Desktop.Controls[i];
                    bool    hor = x <c.Left | x> c.Left + c.Width;
                    bool    vert = y <c.Top | y> c.Top + c.Height;
                    if (hor | vert)
                    {
                        continue;
                    }
                    IObjectLabel label = null;
                    if (Desktop.Controls[i] is IObjectLabel)
                    {
                        label = Desktop.Controls[i] as IObjectLabel;
                    }
                    else
                    {
                        IChildObjectLabel child = Desktop.Controls[i] as IChildObjectLabel;
                        label = child.Label;
                    }

                    arrow.Target = label.Object;
                    IArrowLabel lab = Desktop.Tools.Factory.CreateArrowLabel(Desktop.Tools.Active, arrow, this, label);
                    lab.Arrow.SetAssociatedObject(lab);
                    Desktop.AddArrowLabel(lab);
                    break;
                }
            }
            catch (Exception ex)
            {
                ex.ShowError(10);
                if (arrow != null)
                {
                    if (arrow is IRemovableObject)
                    {
                        IRemovableObject rem = arrow as IRemovableObject;
                        rem.RemoveObject();
                    }
                }
                ex.ShowError(1);;
            }
            Desktop.ActiveArrow = null;
            Desktop.Redraw();
        }