public EditLevelViewModel(GameWorld gameWorld, Point currentPoint) { CurrentPoint = currentPoint; GameWorld = gameWorld; MapGraphicsTileSet = new MapGraphicsTileSet(System.IO.Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName) + "\\MapTiles.xml"); _errorTilePosition = -1; }
/// <summary> /// Contstructor Method /// </summary> /// <param name="points">A list of points used to determine where to grab tiles from</param> public BuildMap(List<PointLatLng> points) { _backgroundWorker = new System.ComponentModel.BackgroundWorker(); _points = points; _mapGraphicsTileSet = new MapGraphicsTileSet(System.IO.Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName) + "\\MapTiles.xml"); _gameWorld = new GameWorld(); _backgroundWorker.WorkerReportsProgress = true; _backgroundWorker.WorkerSupportsCancellation = true; _backgroundWorker.DoWork += new DoWorkEventHandler(_backgroundWorker_DoWork); }
private void LoadFile() { Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.Filter = "Valid Files (.png, *.xml)|*.png;*.xml"; Nullable<bool> result = dlg.ShowDialog(); if (result == true) { _filename = dlg.FileName; if (_filename.Contains(".xml")) { MapGraphicsTileSet mapGraphicsTileSet = new MapGraphicsTileSet(_filename); _graphicsTiles = mapGraphicsTileSet.MapTiles.ToDictionary(instance => instance.TileStartPoint); LoadValues(); _mapTiles = new BitmapImage(new Uri(_filename.Replace(".xml", ".png"))); } else _mapTiles = new BitmapImage(new Uri(_filename)); DrawImageOnCanvas(_currentPoint); } else OnRequestClose(); }