private void RenderProforma(string proformaFileName) { IModelLoader modelLoader = new XmlModelLoader(proformaFileName); _modelBaseElement = modelLoader.LoadModel(); IControlBuilderFactory factory = new ControlBuilderFactory(); var control = factory.SelectFactory(_modelBaseElement).GenerateControl(_modelBaseElement); StackPanel.Children.Add(control); }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { var openFileDialog = new OpenFileDialog(); var dialogResult = openFileDialog.ShowDialog(); if (dialogResult == DialogResult.OK) { treeView.Nodes.Clear(); IModelLoader modelLoader = new XmlModelLoader(openFileDialog.FileName); _modelBaseGroupElement = modelLoader.LoadModel(); var elementTreeNode = new ElementTreeNode { Element = _modelBaseGroupElement, Name = _modelBaseGroupElement.Name, Text = _modelBaseGroupElement.Name }; elementTreeNode.ContextMenuStrip = groupContextMenuStrip; ProcessGroupElement(_modelBaseGroupElement, elementTreeNode); treeView.Nodes.Add(elementTreeNode); } }