private void btnCreateRandomMaze_Click(object sender, RoutedEventArgs e) { try { //Error prevention int width = Convert.ToInt32(tbMazeWidth.Text); int height = Convert.ToInt32(tbMazeHeight.Text); string mazename = tbMazeNewName.Text.Trim(); if (width < 3 && height < 3) { MessageBox.Show("迷宫大小输入错误"); return; } if (string.IsNullOrWhiteSpace(mazename)) { MessageBox.Show("请输入迷宫名字"); return; } md = new MazeData(); md.CreateMaze(width, height, mazename); initMazeGrid(); } catch { MessageBox.Show("错误操作!"); } }
private void FlashMazeList() { try { md = new MazeData(); string[] mazelist = MazeData.getMazeList(); this.tbMazeName.Text = strMaze; this.MazeList.Items.Clear(); for (int i = 0; i < mazelist.Length; i++) { TextBlock tb = new TextBlock(); tb.Text = mazelist[i]; this.MazeList.Items.Add(tb); } } catch (Exception ex) { throw new Exception("刷新错误", ex); } }
private void btnAddMaze_Click(object sender, RoutedEventArgs e) { md = new MazeData(); initMazeGrid(); EditMaze(); }
public MazePath(MazeData _md, ref Grid g) { md = _md; speed = 10; }