public void Add(ScenePoint sp) { XmlNode xn; xn = xd.ChildNodes.Item(1); XmlElement xmlelem; xmlelem = xd.CreateElement(sp.Category.ToString()); xmlelem.AppendChild(xd.CreateTextNode(sp.position.ToString())); xn.AppendChild(xmlelem); xd.Save(fileName); }
private void MapCanvas_MouseDown(object sender, MouseButtonEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) { if (Keyboard.IsKeyDown(Key.LeftShift)) { Update(); } else { Point mouseP = new Point((e.GetPosition(MapCanvas).X - Shift.X) / Zoom, (e.GetPosition(MapCanvas).Y - Shift.Y) / Zoom); ScenePoint sp = new ScenePoint(currentCate, mouseP); MapCanvas.Children.Add(sp.Ellipse); UpdateHeightCanvas(); } } else if (e.RightButton == MouseButtonState.Pressed) { isDown = true; preMouse = e.GetPosition(MapCanvas); } UpdateRoad(); }