Esempio n. 1
0
        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("错误操作!");
            }
        }
Esempio n. 2
0
        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);
            }
        }
Esempio n. 3
0
 private void btnAddMaze_Click(object sender, RoutedEventArgs e)
 {
     md = new MazeData();
     initMazeGrid();
     EditMaze();
 }
Esempio n. 4
0
        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);
            }
        }
Esempio n. 5
0
        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("错误操作!");
            }
        }
Esempio n. 6
0
 private void btnAddMaze_Click(object sender, RoutedEventArgs e)
 {
     md = new MazeData();
     initMazeGrid();
     EditMaze();
 }
Esempio n. 7
0
 public MazePath(MazeData _md, ref Grid g)
 {
     md = _md;
     speed = 10;
 }
Esempio n. 8
0
 public MazePath(MazeData _md, ref Grid g)
 {
     md    = _md;
     speed = 10;
 }