private void Button_Click(object sender, RoutedEventArgs e)
        {
            expander.IsExpanded = false;
            EXPANDER_FUNCTION func = EXPANDER_FUNCTION.none;
            String            msg  = ((Button)sender).Content.ToString();

            switch (msg)
            {
            case "Задать имя": func = EXPANDER_FUNCTION.rename; break;

            case "Связать": func = EXPANDER_FUNCTION.joint; break;

            case "Свойства": func = EXPANDER_FUNCTION.properties; break;

            case "Копировать": func = EXPANDER_FUNCTION.copy; break;

            case "Вырезать": func = EXPANDER_FUNCTION.cut; break;

            case "Удалить": func = EXPANDER_FUNCTION.delete; break;

            default: func = EXPANDER_FUNCTION.none; break;
            }

            if (expanderClickItem != null)
            {
                expanderClickItem(func, this);
            }
        }
Example #2
0
        private void expander_expanderClickItem(EXPANDER_FUNCTION function, UIElement element)
        {
            BlockJoint bj = (BlockJoint)((LMD_GUI.LMD_CircleExpander)element).Tag;             // Блок следующей/предидущей связи

            switch (function)
            {
            case EXPANDER_FUNCTION.joint:
                if (workspace.selectJoint == null)
                {
                    workspace.selectJoint = new BlockJoint(workspace);
                    workspace.selectJoint.element_begin   = bj.element_begin;
                    workspace.selectJoint.createNewJoint += workspace.selectJoint_createNewJoint;
                    workspace.selectJoint.removeJoint    += workspace.selectJoint_removeJoint;
                    workspace.selectJoint.SelectXY(Canvas.GetLeft(element) + 10, Canvas.GetTop(element) + 10);
                    workspace.selectJoint.type_line = TYPE_LINE.line_block;
                    workspace.joint_select          = true;
                }
                else if (workspace.selectJoint != null)                         // Линия к линии
                {
                    SelectXY(Canvas.GetLeft(workspace.selectJoint.element_begin) + 10,
                             Canvas.GetTop(workspace.selectJoint.element_begin) + 10);
                    workspace.selectJoint.type_line   = TYPE_LINE.end_condition;
                    workspace.selectJoint.element_end = bj.element_begin;
                    workspace.selectJoint.Create(workspace.canvas, Canvas.GetLeft(element) + 10, Canvas.GetTop(element) + 10);
                    workspace.joint_select = false;

                    createNewJoint(this);
                }
                break;

            case EXPANDER_FUNCTION.properties: break;

            case EXPANDER_FUNCTION.delete: ThisRemove(); break;
            }
        }