public XmlNode GenerateXML() { // Create XML Node and Attributes XmlDocument d = new XmlDocument(); XmlNode output = d.CreateNode("element", "Action", null); XmlAttribute type = d.CreateAttribute("Type"); XmlAttribute deleteLine = d.CreateAttribute("DeleteLine"); XmlAttribute fileName = d.CreateAttribute("FileName"); XmlAttribute variable = d.CreateAttribute("Variable"); XmlAttribute condition = d.CreateAttribute("Condition"); // Assign attribute values type.Value = "FileRead"; deleteLine.Value = DeleteLine.ToString(); fileName.Value = FileName; variable.Value = Variable; condition.Value = Condition; // Append Attributes output.Attributes.Append(type); if (null != DeleteLine) { output.Attributes.Append(deleteLine); } output.Attributes.Append(fileName); output.Attributes.Append(variable); if (!string.IsNullOrEmpty(Condition)) { output.Attributes.Append(condition); } return(output); }
private void DestroyLine(int line) { foreach (var cube in storedCubes) { int x = (int)cube.GetPosition().x; int y = (int)cube.GetPosition().y; if (y == line) { field[x, y] = null; cube.Destroy(); } } DeleteLine?.Invoke(); }
/// <summary> /// start of paint connection line /// </summary> /// <param name="sender">logic element</param> /// <param name="e">parameters of mouse event</param> public void element_MouseDown(object sender, MouseEventArgs e) { drawLine = new DrawLine(); if (e.Button == MouseButtons.Left) { drawLine.setStartPoint(e.X + (sender as UserControl).Location.X, e.Y + (sender as UserControl).Location.Y); isClicked = true; } else if (e.Button == MouseButtons.Right) { MyUserControl temp = sender as MyUserControl; Disconect.disconnect(temp); DeleteLine.delete(userControls, drawedLines, temp); Invalidate(); } }