Beispiel #1
0
        private void ReadProject( string fileName )
        {
            var config = new ProjectConfiguration();
            // user chose a file
            CurrentProjectFile = fileName;

            // open the ProjectConfiguration
            var projectConfiguration = DiskStorage.LoadFromDisk<ProjectConfiguration>( fileName );

            if( projectConfiguration != null )
            {
                Project = new Project( projectConfiguration );

                UpdateUserInterface();
            }
        }
Beispiel #2
0
        private void ux_NewProjectMenu_Click( object sender, EventArgs e )
        {
            if( Project != null )
            {
                var result = MessageBox.Show( "Do you want to save changes to the current project?", "Save Changes?", MessageBoxButtons.YesNoCancel );
                if( result == DialogResult.Yes )
                {
                    DiskStorage.SaveToDisk( CurrentProjectFile, Project );
                    Project.Levels.ForEach( l => l.Save() );
                }

                if( result == DialogResult.Cancel )
                {
                    return;
                }
            }

            // ask the user to pick a new project file
            var projectNameResult = ux_SaveProjectDialog.ShowDialog();
            if( projectNameResult == DialogResult.OK )
            {
                CurrentProjectFile = ux_SaveProjectDialog.FileName;
            }

            Project = new Project();
        }
Beispiel #3
0
        private void LoadProjectFile(string fileName)
        {
            // user chose a file
            CurrentProjectFile = fileName;

            // open the ProjectConfiguration
            var projectConfiguration = DiskStorage.LoadFromDisk<ProjectConfiguration>(fileName) ?? new ProjectConfiguration();

            Project = new Project(projectConfiguration);
        }
Beispiel #4
0
        private void ProjectOnOnChange(object sender, ProjectChangeEventArgs eventArgs)
        {
            Project = (Project)sender;
            if (eventArgs.PropertyName == "ContentDirectories")
            {
                // total hack, create a level editor control
                // so that a valid GraphicsDevice object is created
                new LevelEditorControl { Height = 100, Width = 100 }.CreateControl();

                Project.ContentDirectories.ForEach(ContentCacheManager.AddContentDirectory);

                // TODO: disk op... show progress bar?
                ContentCacheManager.LoadContent(new ContentManager(ServiceLocator.Apply()));
            }

            UpdateUserInterface();
        }
Beispiel #5
0
        private void CreateProjectFile()
        {
            var projectConfiguration = new ProjectConfiguration();

            Project = new Project(projectConfiguration);

            CurrentProjectFile = null;
        }