public static String[] INPUT(LMD_BLOCKS.BlockInput b) { String[] code = new String[2]; String variable = b.GetVariable(); String view = b.GetPreviewText(); if (view != "") { code[0] = " Console.WriteLine(\""+ b.GetPreviewText() + "\");"; if (variable != "") { INFO_VARIABLE info_variable = ManagerVariables.GetVar(variable); code[1] = " "+ b.GetVariable() + " = " + info_variable.type + ".Parse(Console.ReadLine());"; } else { code[1] = " Console.ReadLine();"; } } else { if (variable != "") { INFO_VARIABLE info_variable = ManagerVariables.GetVar(variable); code[0] = " "+ b.GetVariable() + " = " + info_variable.type + ".Parse(Console.ReadLine());"; } else { code[0] = " Console.ReadLine();"; } } return(code); }
public static String[] INPUT(LMD_BLOCKS.BlockInput b) { String[] code = new String[2]; String variable = b.GetVariable(); String view = b.GetPreviewText(); if (view != "") { code[0] = " cout << \"" + b.GetPreviewText() + "\";"; if (variable != "") { INFO_VARIABLE info_variable = ManagerVariables.GetVar(variable); code[1] = " cin >> " + b.GetVariable() + ";"; } else { code[1] = " // Ввод данных пропущен"; } } else { if (variable != "") { INFO_VARIABLE info_variable = ManagerVariables.GetVar(variable); code[1] = " cin >> " + b.GetVariable() + ";"; } else { code[1] = " // Блок ввода не реализован"; } } return(code); }
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); }
public String[] GetInput(LMD_BLOCKS.BlockInput b) { String[] result = null; switch (PresentLanguage) { case LANGUAGE.C_SHARP: result = C_Sharp.INPUT(b); break; case LANGUAGE.C_PLUS_PLUS: result = C_PlusPlus.INPUT(b); break; case LANGUAGE.JAVA: result = Java.INPUT(b); break; case LANGUAGE.PASCALABC: result = PascalABC.INPUT(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); }