예제 #1
0
        private void btnSaveToDatabase_Click(object sender, EventArgs e)
        {
            MapRepository maprepo = new MapRepository(new MSSQL_Server());
            List <Point>  normallCellPointList = new List <Point>();
            List <Point>  wallCelLPointList    = new List <Point>();

            foreach (PictureBox pb in pbGameField.Controls)
            {
                if (pb.BackColor == Color.Blue)
                {
                    normallCellPointList.Add(pb.Location);
                }
            }
            foreach (PictureBox pb in pbGameField.Controls)
            {
                if (pb.BackColor == Color.Black)
                {
                    wallCelLPointList.Add(pb.Location);
                }
            }
            maprepo.SaveMapToDatabase(txtMapName.Text, normallCellPointList, wallCelLPointList);
            MessageBox.Show("Map Opgeslagen");
        }