/// <summary> /// a vissza gombbal a LevelSelector oldalra lehet visszalépni /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BackToLS_Click(object sender, RoutedEventArgs e) { this.Gameplay = null; this.bwVM.StopTimer(); this.DataContext = null; this.bwVM = null; LevelSelector levelSel = new LevelSelector(this.mainFrame); this.mainFrame.Content = levelSel; }
/// <summary> /// A page betöltődésekor lefutó metódus, ami felteszi a grafikus felületre a setupnak megfelelően a Blockkokat, ill. /// feliratkoztat a Mouse metódusokra /// </summary> /// <param name="sender"> a Page_Loaded metódus object típusú paramétere </param> /// <param name="e">a Page_Loaded metódus RoutedEventArgs típusú paramétere</param> private void Page_Loaded(object sender, RoutedEventArgs e) { this.bwVM = new BoardWindowViewModel(this.level); this.DataContext = this.bwVM; for (int i = 0; i < this.bwVM.GamePlay.LevelSetup.Count; i++) { Image img = this.bwVM.GamePlay.LevelSetup[i].BlockImage; img.Name = "blockimage" + i.ToString(); Canvas.SetTop(img, this.bwVM.GamePlay.LevelSetup[i].OnTableX * 100); Canvas.SetLeft(img, this.bwVM.GamePlay.LevelSetup[i].OnTableY * 100); img.MouseDown += this.OnMouseDown; img.MouseUp += this.OnMouseUp; img.MouseMove += this.OnMouseMove; this.boardCanvas.Children.Add(img); } }