public static String Transrate(WorkObject f_workObject) { String Result = ""; //전처리부 foreach (Module t_module in f_workObject.m_listModule) { if (t_module.m_strPrethreadedCode != "" && t_module.m_strPrethreadedCode != null) { Result += t_module.m_strPrethreadedCode + "\n"; } } Result += "\n"; foreach (Module t_module in f_workObject.m_listModule) { if (t_module.m_strDeclarationCode != "" && t_module.m_strDeclarationCode != null) { Result += t_module.m_strDeclarationCode + "\n"; } } Result += "\n"; //초기화부 Result += "void setup()"; Result += "\n{\n"; foreach (Module t_module in f_workObject.m_listModule) { Result += "\t" + t_module.m_strInitializationCode + "\n"; } Result += "\n}\n"; //슈퍼루프 Result += "void loop()"; Result += "\n{\n"; //런타임코드 실행부 foreach (Module t_module in f_workObject.m_listModule) { if (t_module.m_strRuntimeCode != "" && t_module.m_strRuntimeCode != null) { Result += "\t" + t_module.m_strRuntimeCode + "\n"; } } //트리거 foreach (Trigger t_triger in f_workObject.m_listTrigger) { Result += "\t//" + t_triger.m_strName + "\n"; Result += "\tif("; //조건부 foreach (Condition t_condition in t_triger.m_listCondition) { Result += t_condition.m_strWho.m_strCondition.Replace("#VALUE#", t_condition.m_strWhen).Replace("#LOGIC#", t_condition.Logic); Result += t_condition.m_strAddOperator; } Result += ")"; //실행부 Result += "\n\t{\n"; foreach (Operation t_operation in t_triger.m_listOperation) { Result += "\t\t" + t_operation.m_strWhat.m_strOperation.Replace("#VALUE#", t_operation.m_strHow).Replace("#LOGIC#", t_operation.Logic) + "\n"; } Result += "\t}\n"; } Result += "}\n"; return(Result); }
public Form_Module(List <Module> f_moduleList, WorkObject workObject) { InitializeComponent(); this.workObject = workObject; foreach (Module module in f_moduleList) { Button f_btCurrentModule = new Button(); f_btCurrentModule.Name = module.m_strName; f_btCurrentModule.Size = new System.Drawing.Size(200, 200); f_btCurrentModule.Text = module.m_strName; f_btCurrentModule.UseVisualStyleBackColor = true; f_btCurrentModule.TextAlign = ContentAlignment.BottomCenter; CommonClass.ResizeInsert(f_btCurrentModule, module.m_bmImage); m_flpModuleList.Controls.Add(f_btCurrentModule); f_btCurrentModule.Click += new System.EventHandler((object sender, EventArgs e) => { Selected = module.Clone(); m_flpLabelPin.Controls.Clear(); m_flpEditPin.Controls.Clear(); Label f_lbName = new Label(); f_lbName.Font = new Font("한컴 윤고딕 230", 13F); f_lbName.Name = "Name"; f_lbName.Text = "장치 이름"; f_lbName.ForeColor = Color.White; f_lbName.Size = new System.Drawing.Size(60, 30); f_lbName.Margin = new System.Windows.Forms.Padding(10); m_flpLabelPin.Controls.Add(f_lbName); TextBox f_tbName = new TextBox(); f_tbName.Font = new Font("한컴 윤고딕 230", 13F); f_tbName.Text = Selected.m_strName; f_tbName.Name = "Name"; f_tbName.Size = new System.Drawing.Size(140, 30); f_tbName.Margin = new System.Windows.Forms.Padding(5); f_tbName.TextChanged += new System.EventHandler((object sender2, EventArgs e2) => { Selected.m_strName = f_tbName.Text; }); m_flpEditPin.Controls.Add(f_tbName); foreach (Pin pin in Selected.m_pinList) { Label f_lbPin = new Label(); f_lbPin.Font = new Font("한컴 윤고딕 230", 13F); f_lbPin.Name = pin.m_strName; f_lbPin.Text = pin.m_strName; f_lbPin.ForeColor = Color.White; f_lbPin.Size = new System.Drawing.Size(140, 30); f_lbPin.Margin = new System.Windows.Forms.Padding(5); m_flpLabelPin.Controls.Add(f_lbPin); TextBox f_tbPin = new TextBox(); f_tbPin.Font = new Font("한컴 윤고딕 230", 13F); f_tbPin.Name = pin.m_strName; f_tbPin.Size = new System.Drawing.Size(140, 30); f_tbPin.Margin = new System.Windows.Forms.Padding(5); f_tbPin.TextChanged += new System.EventHandler((object sender2, EventArgs e2) => { pin.m_strPin = ((TextBox)sender2).Text; }); m_flpEditPin.Controls.Add(f_tbPin); } m_flpLabelParam.Controls.Clear(); m_flpEditParam.Controls.Clear(); foreach (Param param in Selected.m_paramList) { Label f_lbParam = new Label(); f_lbParam.Font = new Font("한컴 윤고딕 230", 13F); f_lbParam.Name = param.m_strName; f_lbParam.Text = param.m_strName; f_lbParam.Size = new System.Drawing.Size(140, 30); f_lbParam.Margin = new System.Windows.Forms.Padding(10); m_flpLabelParam.Controls.Add(f_lbParam); TextBox f_tbParam = new TextBox(); f_tbParam.Font = new Font("한컴 윤고딕 230", 13F); f_tbParam.Name = param.m_strName; f_tbParam.Size = new System.Drawing.Size(140, 30); f_tbParam.Margin = new System.Windows.Forms.Padding(5); f_tbParam.TextChanged += new System.EventHandler((object sender2, EventArgs e2) => { param.m_strValue = ((TextBox)sender2).Text; }); m_flpEditParam.Controls.Add(f_tbParam); } }); } }