protected void Button_Clicked(object sender, EventArgs e) { string name = (sender as Button).Name; switch (name) { case "plus": ratio.Text = "X" + drawing.IncreasSpeed(); break; case "minus": ratio.Text = "X" + drawing.IDecreasSpeed(); break; case "add": DataAtom temp = new DataAtom(); XmlDocument doc = new XmlDocument(); doc.Load(xmlDocument); XmlElement eml = doc.DocumentElement; //gets root element of xmldocument XmlNode data = eml.SelectSingleNode(string.Format("element[name='{0}']", atomSelect.SelectedItem as string)); temp.Name = data["name"].InnerText; temp.Shells = (int.Parse(data["shells"].InnerText)); temp.Weight = int.Parse(data["weight"].InnerText); temp.OuterWeight = int.Parse(data["outerweight"].InnerText); temp.Mol = int.Parse(data["molecule"].InnerText); drawing.Add(temp); break; case "clear": for (int i = 0; i < drawing.Childrens.Count(); i++) { drawing.Childrens[i] = null; } drawing.Childrens.Clear(); break; case "path": drawing.ActivatePath(); break; case "pause": drawing.pause(); break; case "clean": drawing.Clean(); break; case "regular": drawing.regView(); break; } }