Exemplo n.º 1
0
        private void Open()
        {
            if (_editor == null)
            {
                return;
            }
            if (!CheckChange())
            {
                return;
            }

            dOpen.FileName         = Path.GetFileName(_editor.OpenFilePath);
            dOpen.InitialDirectory = Path.GetDirectoryName(_editor.OpenFilePath);
            if (dOpen.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            _editor.OpenFilePath = dOpen.FileName;
            try
            {
                if (_editor.LoadFile(dOpen.FileName))
                {
                    Reload();
                    UpdateFileTitle();
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Error encountered when loading {0}.\n\nException: {1}\nMessage: {2}".F(dOpen.FileName, e.GetType(), e.Message), "Dune 2000 Editor", MessageBoxButtons.OK);
            }
        }