void puzzleModel_PuzzelChanged(object sender, PuzzelChangedEventArgs e) { if (Puzzles.ContainsKey(e.Puzzel)) { PuzzleHelper.SetLocation(Puzzles[e.Puzzel], e.Puzzel.Location.X, e.Puzzel.Location.Y); } }
private void CreateChunks() { foreach (Puzzel puzzel in puzzleModel.Puzzles) { CroppedBitmap chunk = new CroppedBitmap(_loadedBitmap, new Int32Rect((puzzel.Matrix.Row * (int)puzzleModel.PuzzleSize.Width), (puzzel.Matrix.Column * (int)puzzleModel.PuzzleSize.Height), (int)puzzleModel.PuzzleSize.Width, (int)puzzleModel.PuzzleSize.Height)); Image chunkImage = new Image(); chunkImage.Source = chunk; PuzzleHelper.SetLocation(chunkImage, puzzel.Location.X, puzzel.Location.Y); Puzzles.Add(puzzel, chunkImage); _sprites.Add(chunkImage); } }