private void generateCodeToolStripMenuItem_Click(object sender, System.EventArgs e) { var generator = new CalculationCodeGenerator(); const string newLine = "\r\n "; var codeBlocks = designerControl1.Items.OfType<NodeComponent>() .Where(node => !string.IsNullOrEmpty(node.Name)) .Select(node => string.Format("let {0} = {1}{2}", node.Name, newLine, generator.GenerateCode(node, newLine))); var viewer = new FormCodeViewer { Code = string.Join("\r\n", codeBlocks) }; viewer.Show(this); }
public void SetUp() { _generator = new CalculationCodeGenerator(); }