Esempio n. 1
0
        public static Project CreateProject(string filePath, ZTreeView treeView)
        {
            Project project = new Project(filePath);
            project.LoadXml();
            project.app = Load(project.xmlDoc, treeView);             

            return project;
        }
Esempio n. 2
0
        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
        }
Esempio n. 3
0
 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!
 }
Esempio n. 4
0
        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;
        }
Esempio n. 5
0
 internal void SetProject(Project project)
 {
     this.project = project;
 }