Esempio n. 1
0
        private void loadButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            if (!"(loaded file)".Equals(loadedFileName.Text))
            {
                openFileDialog.FileName = loadedFileName.Text;
            }

            DialogResult dialogResult = openFileDialog.ShowDialog(this);

            if (dialogResult == DialogResult.OK)
            {
                obtacles.Clear();
                loadedFileName.Text = openFileDialog.FileName;
                if (dialogResult == DialogResult.OK)
                {
                    loadedFileName.Text = openFileDialog.FileName;
                    foreach (IObstacle obtacle in ObstacleManager.LoadObstaclesFromFile(openFileDialog.FileName))
                    {
                        Point key = new Point(obtacle.X, obtacle.Y);
                        obtacles.Add(key, obtacle);
                    }
                }
            }
        }