public override ElementInfo GetElementInfo(int n) { if (n == 0) { var ei = new ElementInfo(ElementInfo.MakeLink("subcircuits.html", "Model Name"), 0, -1, -1); models = CustomCompositeModel.GetModelList(); ei.Choice = new ComboBox(); int i; for (i = 0; i != models.Count; i++) { var ccm = models[i]; ei.Choice.Items.Add(ccm.Name); if (ccm == model) { ei.Choice.SelectedIndex = i; } } return(ei); } if (n == 1) { var ei = new ElementInfo("", 0, -1, -1); ei.Button = new Button() { Text = "Edit Model" }; return(ei); } return(null); }
public override void SetElementValue(int n, ElementInfo ei) { if (n == 0) { model = models[ei.Choice.SelectedIndex]; lastModelName = modelName = model.Name; UpdateModels(); SetPoints(); return; } if (n == 1) { if (model.Name == "default") { MessageBox.Show("Can't edit this model."); return; } var dlg = new EditCompositeModelDialog(); dlg.SetModel(model); dlg.CreateDialog(); CirSim.DialogShowing = dlg; dlg.Show(); return; } }
public void updateModels(StringTokenizer st) { model = CustomCompositeModel.GetModelWithName(modelName); if (model == null) { return; } postCount = model.ExtList.Count; var externalNodes = new int[postCount]; int i; for (i = 0; i != postCount; i++) { externalNodes[i] = model.ExtList[i].node; } if (st == null) { st = new StringTokenizer(model.ElmDump, " "); } loadComposite(st, model.NodeList, externalNodes); allocNodes(); SetPoints(); }