// when selecting a formula from the tree view private void funcList_AfterSelect(object sender, TreeViewEventArgs e) { MathFormulary math = new MathFormulary(); PhysicsFormulary physicsFormulary = new PhysicsFormulary(); Print("checks " + e.Node.Text); foreach (BaseFormula formula in math.formulas) { if (formula.Name == e.Node.Text) { Print("found"); BaseFormulary.TextboxPlacement(formula.VarCount, this); break; } } /* * if (e.Node.Name == "matematik") * { * Print("Matematik"); * ShowMath(); * } * else if (funcList.Parent.Name.Equals(physicsFormulary.treeNode.Name)) * { * ShowPhysics(); * } */ }
public void ShowPhysics() { PhysicsFormulary.PotentialEnergy potential = new PhysicsFormulary.PotentialEnergy(); PhysicsFormulary physicsFormulary = new PhysicsFormulary(); // loop through all formulas in the MathFormulary foreach (BaseFormula formula in physicsFormulary.formulas) { // if the current formula is the one selected if (formula.Name == funcList.SelectedNode.Text) { // set the current formula as the currentFormula or the selected formula currentFormula = formula; potential.Shared(); } // get out of loop break; } }