public static Project CreateProject(string filePath, ZTreeView treeView) { Project project = new Project(filePath); project.LoadXml(); project.app = Load(project.xmlDoc, treeView); return project; }
private void openProject(string filePath) { outputBox.Text = ""; statusLabel.Text = "Loading project..."; Console.WriteLine("Loading project: "+filePath); #if !DEBUG try { #endif closeProject(true); // Just a good practice - change the cursor to a wait cursor during processing this.Cursor = Cursors.WaitCursor; // Freeze the whole form - no interaction during project loading //this.Enabled = false; //Try to load the Xml document project = Project.CreateProject(filePath, xmlTree, codegen); if (project != null && project.app != null) { SetApplication(true); project.XMLChanged += project_XMLChanged; RefreshSceneTreeview(); //glControl1_Load(this, null); glControl1_Resize(this, null); app.Pause(); SelectedComponent = app; statusLabel.Text = "Project loaded."; ZSGameEditor.Properties.Settings.Default.LastProjectPath = filePath; ZSGameEditor.Properties.Settings.Default.Save(); this.Cursor = Cursors.Default; } #if !DEBUG } catch (Exception ex) { statusLabel.Text = "Exception occurred: " + ex.Message; Console.WriteLine(ex.ToString()); closeProject(true); } finally { // Also unfreeze the form //this.Enabled = true; this.Cursor = Cursors.Default; //Change the cursor back } #endif }
private void closeProject(bool fullClear) { Application.Idle -= Application_Idle; SelectedComponent = null; if (fullClear) this.Text = DefaultFormTitle; sceneTreeView.Nodes.Clear(); //sceneTreeView.Invalidate(); xmlTree.Nodes.Clear(); xmlTree.Invalidate(); if (fullClear) { project = null; xmlTree.SetProject(null); } else project.ClearCode(); app = null; ZComponent.App = null; codeBox.Text = ""; codeBox.Refresh(); SetCodeLabels(null); // TODO: All resources should be released at this point / verify finalizers! }
public static Project CreateProject(string filePath, ZTreeView treeView, CodeGenerator codeGen) { Project project = new Project(filePath); project.LoadXml(); project.BuildApplication(codeGen); if (treeView != null) project.FillTreeView(treeView); return project; }
internal void SetProject(Project project) { this.project = project; }