public UI(Element lineDiagram, Document doc) { // Initialize component InitializeComponent(); // Set DataContext this.DataContext = this; // Set document document = doc; // Get ordered parameters from document line diagram. paramList = LineDiagram.getOrderedLineDiagramParameters(lineDiagram).ToList <Parameter>(); // Create a list of Parameter controls. paramControlList = new List <ParamControl>(); foreach (Parameter param in paramList) { if (!param.IsReadOnly) { ParamControl paramControl = new ParamControl(param); paramControlList.Add(paramControl); } } }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { // Get uiApp. UIApplication uiApp = commandData.Application; // Get UI document. UIDocument uiDoc = uiApp.ActiveUIDocument; // Get current document. Document doc = uiDoc.Document; // Get line diagram. Element lineDiagram = LineDiagram.getLineDiagram(doc); // UI init. UI ui = new UI(lineDiagram, doc); ui.ShowDialog(); if (commitChanges == true) { using (Transaction transaction = new Transaction(doc, "Modifying Parameters")) { try { transaction.Start(); SetParams.setParams(); transaction.Commit(); } catch (Exception e) { message = e.Message; return(Result.Failed); } } } return(Result.Succeeded); }