public void LoadMap(MapDatabase _MapDatabase) { this._MapDatabase = _MapDatabase; foreach(MapDatabase.Layer _Layer in _MapDatabase._Layers) { foreach(MapDatabase.Image _dImage in _Layer._Images) { Image _Image = new Image(); BitmapImage bm = new BitmapImage(); bm.SetSource(Menu._Resources[_dImage.Path]); _Image.Source = bm; //= new BitmapImage(new Uri(_dImage.Path, UriKind.Relative)); _Image.Width = _dImage.Width; _Image.Height = _dImage.Height; _Canvas.Children.Add(_Image); Canvas.SetLeft(_Image, _dImage.X); Canvas.SetTop(_Image, _dImage.Y); } foreach(MapDatabase.Polygon _dPolygon in _Layer._Polygons) { if(_dPolygon._Color != Colors.Black) { if(_dPolygon._Points.First() == _dPolygon._Points.Last()) { Polygon _Polygon = new Polygon(); foreach(Point _Point in _dPolygon._Points) { _Polygon.Points.Add(_Point); } _Polygon.Fill = new SolidColorBrush(_dPolygon._Color); _Canvas.Children.Add(_Polygon); } else { Polyline _Polygon = new Polyline(); _Polygon.Stroke = new SolidColorBrush(_dPolygon._Color); _Polygon.StrokeThickness = 3; foreach(Point _Point in _dPolygon._Points) { _Polygon.Points.Add(_Point); } _Canvas.Children.Add(_Polygon); } } else _Polygons.Add(_dPolygon); } } _Canvas.Children.Add(_Canvas1); }