Пример #1
0
        private void прочитатьСФайлаToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter           = "xml files (*.xml)|*.xml";
            openFileDialog1.RestoreDirectory = true;

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                way_from_start_to_end = null;
                list_step_by_step     = null;
                deserializer          = new XmlSerializer(typeof(Labyrinth));
                using (textReader = new StreamReader(openFileDialog1.FileName))
                {
                    labyrinth = (Labyrinth)deserializer.Deserialize(textReader);
                }

                if (labyrinth.Start_dot.X != 0)
                {
                    is_start = true;
                }
                if (labyrinth.End_dot.X != 0)
                {
                    is_end = true;
                }

                pictureBox1.Refresh();
            }
        }
Пример #2
0
        private void очиститьВсёToolStripMenuItem_Click(object sender, EventArgs e)
        {
            labyrinth                = new Labyrinth();
            graph                    = new Graph();
            is_start                 = false;
            is_end                   = false;
            moving_picture           = false;
            number_moving_wall       = -1;
            first_second_dot_in_wall = -1;
            way_from_start_to_end    = null;
            list_step_by_step        = null;

            height        = pictureBox1.Height - 1;
            width         = pictureBox1.Width - 1;
            x_center      = pictureBox1.Width / 2;
            y_center      = pictureBox1.Height / 2;
            coef_center_x = x_center / pictureBox1.Width;
            coef_center_y = y_center / pictureBox1.Height;
            coef_center_x = 0.5;
            coef_center_y = 0.5;
            coef_lab      = 1.0;

            pictureBox1.Refresh();
        }
        private void прочитатьСФайлаToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "xml files (*.xml)|*.xml";
            openFileDialog1.RestoreDirectory = true;

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                way_from_start_to_end = null;
                list_step_by_step = null;
                deserializer = new XmlSerializer(typeof(Labyrinth));
                using (textReader = new StreamReader(openFileDialog1.FileName))
                {
                    labyrinth = (Labyrinth)deserializer.Deserialize(textReader);
                }

                if (labyrinth.Start_dot.X != 0)
                {
                    is_start = true;
                }
                if (labyrinth.End_dot.X != 0)
                {
                    is_end = true;
                }

                pictureBox1.Refresh();
            }
        }
        private void очиститьВсёToolStripMenuItem_Click(object sender, EventArgs e)
        {
            labyrinth = new Labyrinth();
            graph = new Graph();
            is_start = false;
            is_end = false;
            moving_picture = false;
            number_moving_wall = -1;
            first_second_dot_in_wall = -1;
            way_from_start_to_end = null;
            list_step_by_step = null;

            height = pictureBox1.Height - 1;
            width = pictureBox1.Width - 1;
            x_center = pictureBox1.Width / 2;
            y_center = pictureBox1.Height / 2;
            coef_center_x = x_center / pictureBox1.Width;
            coef_center_y = y_center / pictureBox1.Height;
            coef_center_x = 0.5;
            coef_center_y = 0.5;
            coef_lab = 1.0;

            pictureBox1.Refresh();
        }