Пример #1
0
        private void OnNewProjectWindowClosed(object sender, FormClosedEventArgs e)
        {
            if (newProjectWindow.project != null)
            {
                if (renameWindow != null)
                {
                    renameWindow.Close();
                }

                project_ = newProjectWindow.project;
                if (project_.Loaded)
                {
                    LoadProjectData();
                    EnableEditor(true);
                    statusText.Text = "Created new project: " + project_.projectPath + "/" + project_.projectName + ".mmproj";
                }
                else
                {
                    statusText.Text = "Could not load project.";
                }
            }
            else
            {
                statusText.Text = "Project creation aborted.";
            }
            newProjectWindow = null;
        }
Пример #2
0
        private void NewProject()
        {
            if (newProjectWindow != null)
            {
                return;
            }

            newProjectWindow             = new NewProjectWindow();
            newProjectWindow.FormClosed += OnNewProjectWindowClosed;
            newProjectWindow.Show();

            /*
             * OpenFileDialog ofd = new OpenFileDialog
             * {
             *  Filter = "GBA ROMs|*.gba|All Files|*.*",
             *  Title = "Select Base TMC ROM"
             * };
             *
             * if (ofd.ShowDialog() != DialogResult.OK)
             * {
             *  return;
             * }
             *
             * try
             * {
             *  ROM_ = new ROM(ofd.FileName);
             * }
             * catch (Exception e)
             * {
             *  Console.WriteLine(e);
             *  throw;
             * }
             *
             * if (ROM.Instance.version.Equals(RegionVersion.None))
             * {
             *  MessageBox.Show("Invalid TMC ROM. Please Open a valid ROM.", "Incorrect ROM", MessageBoxButtons.OK);
             *  statusText.Text = "Unable to determine ROM.";
             *  return;
             * }
             *
             * CommonOpenFileDialog fbd = new CommonOpenFileDialog()
             * {
             *
             *  IsFolderPicker = true,
             *  Title = "Select a project root folder"
             * };
             *
             * if (fbd.ShowDialog() != CommonFileDialogResult.Ok)
             * {
             *  return;
             * }
             *
             * if (project_ == null)
             * {
             *  project_ = new Project();
             * }
             *
             * project_.sourcePath = ROM.Instance.path;
             * var st = "Loaded: " + ROM.Instance.path;
             *
             * if (project_.projectPath != null)
             * {
             *
             *  project_.LoadProject();//load first as rooms or areas could be added at some point
             *  mapGridBox.Image = new Bitmap(1, 1); //reset some things on loading a rom
             *  bottomTileGridBox.Image = new Bitmap(1, 1);
             *  topTileGridBox.Image = new Bitmap(1, 1);
             *  currentRoom = null;
             *  currentArea = -1;
             *  selectedTileData = -1;
             *  selectedLayer = 2;
             *  pendingRomChanges = new List<Change>();
             *  LoadMaps();
             * }
             * else
             * {
             *  st += ", also select a project folder.";
             * }
             *
             * statusText.Text = st;*/
        }