Ejemplo n.º 1
0
        /// <summary>
        /// Deserializes the <see cref="Project"/> object.
        /// </summary>
        public bool LoadProject(string path)
        {
            Project = Project.LoadFromXml(Path.Combine(path, "Project.xml"));

            Project.FilePath = Path.GetDirectoryName(path);
            Project.CheckDirectories();

            return true;
        }
 public ProjectChangedEventArgs(Project project)
 {
     _project = project;
 }
 public ProjectLoadedEventArgs(Project project)
 {
     _project = project;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Handles the ProjectLoaded event of the <see cref="ProjectManager"/> class.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="ProjectLoadedEventArgs"/> instance containing the event data.</param>
 private void ProjectLoaded(object sender, ProjectLoadedEventArgs e)
 {
     _project = e.Project;
     LoadMaps(e.Project.MapPath);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Handles the ProjectLoaded event of the <see cref="ProjectManager"/> class.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="ProjectLoadedEventArgs"/> instance containing the event data.</param>
 private void ProjectLoaded(object sender, ProjectLoadedEventArgs e)
 {
     _project = e.Project;
     LoadTilesets(e.Project.TilesetPath);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Handles the <see cref="DialogProject"/> form, checks all the directories and builds the <see cref="Project"/> object.
        /// </summary>
        public void NewProject()
        {
            using (var dialog = new DialogProject())
            {
                var result = dialog.ShowDialog();
                if (result != DialogResult.OK) return;

                if (Project != null)
                {
                    var dialogResult = MessageBox.Show(@"Creating a new project will close the current one. Continue?", @"New Project", MessageBoxButtons.YesNo);
                    if (dialogResult != DialogResult.Yes) return;
                    CloseProject();
                }

                var name = dialog.ProjectName;
                var author = dialog.Author;
                var description = dialog.Description;
                var path = dialog.FilePath;

                Project = new Project(name, author, description, path);

                if (ProjectLoaded != null)
                    ProjectLoaded.Invoke(this, new ProjectLoadedEventArgs(Project));

                Settings = new ProjectSettings();

                if (SettingsLoaded != null)
                    SettingsLoaded.Invoke(this, new SettingsLoadedEventArgs(Settings));

                SaveProject();

                Console.WriteLine(@"Project {0} created.", name);
            }
        }
 public ProjectClosedEventArgs(Project project)
 {
     _project = project;
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Handles the ProjectLoaded event of the <see cref="ProjectManager"/> class.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="ProjectLoadedEventArgs"/> instance containing the event data.</param>
 private void ProjectLoaded(object sender, ProjectLoadedEventArgs e)
 {
     _project = e.Project;
     LoadTerrainTiles(_project.TerrainPath);
 }