Пример #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("错误操作!");
            }
        }
Пример #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);
            }
        }
Пример #3
0
 private void btnAddMaze_Click(object sender, RoutedEventArgs e)
 {
     md = new MazeData();
     initMazeGrid();
     EditMaze();
 }
Пример #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);
            }
        }
Пример #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("错误操作!");
            }
        }
Пример #6
0
 private void btnAddMaze_Click(object sender, RoutedEventArgs e)
 {
     md = new MazeData();
     initMazeGrid();
     EditMaze();
 }
Пример #7
0
 public MazePath(MazeData _md, ref Grid g)
 {
     md = _md;
     speed = 10;
 }
Пример #8
0
 public MazePath(MazeData _md, ref Grid g)
 {
     md    = _md;
     speed = 10;
 }