Ejemplo n.º 1
0
    private void CreateNewProject(bool loading = false)
    {
        if (ProjectRoot != null)
        {
            ProjectRoot.GetParent().RemoveChild(ProjectRoot);
        }

        if (projectDirWatcher != null)
        {
            projectDirWatcher.EnableRaisingEvents = false;
            projectDirWatcher = null;
        }

        if (!loading)
        {
            ModProject = new Project();
        }

        ProjectRoot = ProjectTree.CreateItem();
        ProjectRoot.SetText(0, "My Project 1.0.0");
        ProjectRoot.DisableFolding = true;

        depsRoot = ProjectTree.CreateItem(ProjectRoot);
        depsRoot.SetText(0, "Dependencies");
        depsRoot.AddButton(0, AddIcon, ADD_BUTTON_INDEX, tooltip: "Add a dependency");

        updateKeysRoot = ProjectTree.CreateItem(ProjectRoot);
        updateKeysRoot.SetText(0, "Update Keys");
        updateKeysRoot.AddButton(0, AddIcon, ADD_BUTTON_INDEX, tooltip: "Add an update key");

        resourcesRoot = ProjectTree.CreateItem(ProjectRoot);
        resourcesRoot.SetText(0, "Resources");
        resourcesRoot.AddButton(0, AddIcon, ADD_BUTTON_INDEX, tooltip: "Import a resource");

        fileMenu.GetPopup().SetItemDisabled(1, false);
        fileMenu.GetPopup().SetItemDisabled(3, false);
        fileMenu.GetPopup().SetItemDisabled(6, false);
        fileMenu.GetPopup().SetItemDisabled(7, false);

        if (!loading)
        {
            SaveProject();
            InitFileSystemWatcher();
        }
    }