Esempio n. 1
0
        /*void onSelectedItemChanged (object sender, SelectionChangeEventArgs e){
         *      SelectedItem = e.NewValue as ProjectItem;
         *      UserConfig.Set ("SelectedProjItems", SelectedItem?.AbsolutePath);
         * }*/

        public void OpenItem(ProjectItemNode pi)
        {
            if (!openedItems.Contains(pi))
            {
                openedItems.Add(pi);
                saveOpenedItemsInUserConfig();
            }
        }
Esempio n. 2
0
 public ProjectFileNode(ProjectItemNode pi)
     : base(pi.Project, pi.Item)
 {
     initCommands();
 }
Esempio n. 3
0
 public void CloseItem(ProjectItemNode pi)
 {
     openedItems.Remove(pi);
     saveOpenedItemsInUserConfig();
 }
Esempio n. 4
0
 public ImlProjectItem(ProjectItemNode pi) : base(pi)
 {
 }
Esempio n. 5
0
 public CSProjectItem(ProjectItemNode pi) : base(pi)
 {
 }
Esempio n. 6
0
        void populateTreeNodes()
        {
            ProjectNode root = new ProjectNode(this, ItemType.VirtualGroup, RootNamespace);
            ProjectNode refs = new ProjectNode(this, ItemType.ReferenceGroup, "References");

            root.AddChild(refs);

            /*Console.ForegroundColor = ConsoleColor.Green;
             * Console.WriteLine ($"Evaluated Globals properties for {DisplayName}");
             * foreach (ProjectProperty item in project.AllEvaluatedProperties.OrderBy(p=>p.Name)) {
             *      Console.ForegroundColor = ConsoleColor.White;
             *      Console.Write ($"\t{item.Name,-40} = ");
             *      Console.ForegroundColor = ConsoleColor.Gray;
             *      Console.WriteLine ($"{item.EvaluatedValue}");
             * }*/


            foreach (ProjectItem pn in project.AllEvaluatedItems)
            {
                switch (pn.ItemType)
                {
                case "ProjectReferenceTargets":
                    Commands.Add(new Crow.Command(new Action(() => Compile(pn.EvaluatedInclude)))
                    {
                        Caption = pn.EvaluatedInclude,
                    });
                    break;

                case "Reference":
                case "PackageReference":
                case "ProjectReference":
                    refs.AddChild(new ProjectItemNode(this, pn));
                    break;

                case "Compile":
                case "None":
                case "EmbeddedResource":
                    ProjectNode curNode = root;
                    try {
                        string file     = pn.EvaluatedInclude.Replace('\\', '/');
                        string treePath = file;
                        if (pn.HasMetadata("Link"))
                        {
                            treePath = project.ExpandString(pn.GetMetadataValue("Link"));
                        }
                        string [] folds = treePath.Split('/');
                        for (int i = 0; i < folds.Length - 1; i++)
                        {
                            ProjectNode nextNode = curNode.Childs.OfType <ProjectNode>().FirstOrDefault(n => n.DisplayName == folds [i] && n.Type == ItemType.VirtualGroup);
                            if (nextNode == null)
                            {
                                nextNode = new ProjectNode(this, ItemType.VirtualGroup, folds [i]);
                                curNode.AddChild(nextNode);
                            }
                            curNode = nextNode;
                        }
                        ProjectItemNode pi = new ProjectItemNode(this, pn);

                        switch (Path.GetExtension(file))
                        {
                        case ".cs":
                            pi = new CSProjectItem(pi);
                            break;

                        case ".crow":
                        case ".template":
                        case ".goml":
                        case ".itemp":
                        case ".imtl":
                            pi = new ImlProjectItem(pi);
                            break;

                        case ".style":
                            pi = new StyleProjectItem(pi);
                            break;

                        default:
                            pi = new ProjectFileNode(pi);
                            break;
                        }
                        curNode.AddChild(pi);
                    } catch (Exception ex) {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine(ex);
                        Console.ResetColor();
                    }

                    break;
                }
            }
            root.SortChilds();
            foreach (var item in root.Childs)
            {
                Childs.Add(item);
                item.Parent = this;
            }


            IsLoaded = true;
        }