Ejemplo n.º 1
0
        private String[] GetCodeParseBlock(System.Windows.UIElement element)
        {
            String[] code = null;

            #region BEGIN
            if (element.GetType() == typeof(LMD_BLOCKS.BlockBegin))
            {
                LMD_BLOCKS.BlockBegin b = (LMD_BLOCKS.BlockBegin)element;
                code = ML.GetBegin();
            }
            #endregion
            #region CALCULATE
            else if (element.GetType() == typeof(LMD_BLOCKS.BlockCalculate))
            {
                LMD_BLOCKS.BlockCalculate b = (LMD_BLOCKS.BlockCalculate)element;
                code = ML.GetCalculate(b);
            }
            #endregion
            #region CONDITION
            else if (element.GetType() == typeof(LMD_BLOCKS.BlockCondition))
            {
                LMD_BLOCKS.BlockCondition b = (LMD_BLOCKS.BlockCondition)element;
                code = ML.GetCondition(b);
            }
            #endregion
            #region END
            else if (element.GetType() == typeof(LMD_BLOCKS.BlockEnd))
            {
                LMD_BLOCKS.BlockEnd b = (LMD_BLOCKS.BlockEnd)element;
                code = ML.GetEnd();
            }
            #endregion
            #region INPUT
            else if (element.GetType() == typeof(LMD_BLOCKS.BlockInput))
            {
                LMD_BLOCKS.BlockInput b = (LMD_BLOCKS.BlockInput)element;
                code = ML.GetInput(b);
            }
            #endregion
            #region OUTPUT
            else if (element.GetType() == typeof(LMD_BLOCKS.BlockOutput))
            {
                LMD_BLOCKS.BlockOutput b = (LMD_BLOCKS.BlockOutput)element;
                code = ML.GetOutput(b);
            }
            #endregion

            return(code);
        }
Ejemplo n.º 2
0
        public static String[] OUTPUT(LMD_BLOCKS.BlockOutput b)
        {
            String[] code = new String[1];

            if (b.GetVariable() != "")
            {
                code[0] = "	cout << \"" + b.GetText() + "\" << " + b.GetVariable() + ";";
            }
            else
            {
                code[0] = "	cout << \"" + b.GetText() + "\";";
            }

            return(code);
        }
Ejemplo n.º 3
0
        public static String[] OUTPUT(LMD_BLOCKS.BlockOutput b)
        {
            String[] code = new String[1];

            if (b.GetVariable() != "")
            {
                code[0] = "		Console.WriteLine(\""+ b.GetText() + "\"+" + b.GetVariable() + ");";
            }
            else
            {
                code[0] = "		Console.WriteLine(\""+ b.GetText() + "\");";
            }

            return(code);
        }
Ejemplo n.º 4
0
        public static String[] OUTPUT(LMD_BLOCKS.BlockOutput b)
        {
            String[] code = new String[1];

            if (b.GetVariable() != "")
            {
                code[0] = "	write(\'" + b.GetText() + "\' + " + b.GetVariable() + ");";
            }
            else
            {
                code[0] = "	write(\'" + b.GetText() + "\');";
            }

            return(code);
        }
Ejemplo n.º 5
0
        public String[] GetOutput(LMD_BLOCKS.BlockOutput b)
        {
            String[] result = null;
            switch (PresentLanguage)
            {
            case LANGUAGE.C_SHARP: result = C_Sharp.OUTPUT(b); break;

            case LANGUAGE.C_PLUS_PLUS: result = C_PlusPlus.OUTPUT(b); break;

            case LANGUAGE.JAVA: result = Java.OUTPUT(b); break;

            case LANGUAGE.PASCALABC: result = PascalABC.OUTPUT(b); break;
            }

            return(result);
        }
        public void AddBlock(TYPE_BLOCK type)
        {
            canvas.Children.Remove(SelectUIElement);
            SelectUIElement = null;
            selectTypeBlock = TYPE_BLOCK.none;
            date_select     = true;
            selectTypeBlock = type;
            LMD_BLOCKS.BLOCK_JOINT.BASE_BLOCK b_b = null;

            switch (type)
            {
            case TYPE_BLOCK.begin:
                LMD_BLOCKS.BlockBegin bb = new LMD_BLOCKS.BlockBegin();
                bb.expanderClickItem += bb_expanderClickItem;
                SelectUIElement       = bb;
                b_b = new LMD_BLOCKS.BLOCK_JOINT.BEGIN();
                break;

            case TYPE_BLOCK.end:
                LMD_BLOCKS.BlockEnd be = new LMD_BLOCKS.BlockEnd();
                be.expanderClickItem += bb_expanderClickItem;
                SelectUIElement       = be;
                b_b = new LMD_BLOCKS.BLOCK_JOINT.END();
                break;

            case TYPE_BLOCK.input:
                LMD_BLOCKS.BlockInput bi = new LMD_BLOCKS.BlockInput();
                bi.expanderClickItem += bb_expanderClickItem;
                SelectUIElement       = bi;
                b_b = new LMD_BLOCKS.BLOCK_JOINT.INPUT();
                break;

            case TYPE_BLOCK.output:
                LMD_BLOCKS.BlockOutput bo = new LMD_BLOCKS.BlockOutput();
                bo.expanderClickItem += bb_expanderClickItem;
                SelectUIElement       = bo;
                b_b = new LMD_BLOCKS.BLOCK_JOINT.OUTPUT();
                break;

            case TYPE_BLOCK.calculate:
                LMD_BLOCKS.BlockCalculate bca = new LMD_BLOCKS.BlockCalculate();
                bca.expanderClickItem += bb_expanderClickItem;
                SelectUIElement        = bca;
                b_b = new LMD_BLOCKS.BLOCK_JOINT.CALCULATE();
                break;

            case TYPE_BLOCK.condition:
                LMD_BLOCKS.BlockCondition bco = new LMD_BLOCKS.BlockCondition();
                bco.expanderClickItem += bb_expanderClickItem;
                bco.clickJoint        += bco_clickJoint;
                SelectUIElement        = bco;
                b_b = new LMD_BLOCKS.BLOCK_JOINT.CONDITION();
                break;

            case TYPE_BLOCK.camera:  break;

            case TYPE_BLOCK.joint: joint_select = true; break;
            }

            b_b.element             = SelectUIElement;
            b_b.element.MouseEnter += element_MouseEnter;
            b_b.element.MouseLeave += element_MouseLeave;
            blocks.Add(b_b);

            SelectUIElement.Opacity = 0.5;
            canvas.Children.Add(SelectUIElement);

            Canvas.SetLeft(SelectUIElement, -500);
            Canvas.SetTop(SelectUIElement, -500);
        }