Exemplo n.º 1
0
        string BuildJSON(TreeModelData data)
        {
            string childrenJson = string.Empty;
            foreach (var item in data.GetChildren())
            {
                if (childrenJson != string.Empty)
                    childrenJson += ", ";
                childrenJson += BuildJSON(item);
            }

            string children = string.Empty;
            if (!string.IsNullOrEmpty(childrenJson))
            {
                children = string.Format(@",\""children\"": [{0}]", childrenJson);
            }

            string json = string.Format(@"{{" +
                @"\""data\"": {{\""title\"": \""{0}\"", \""icon\"": \""{1}\""}}" +
                @"{2}" +
                @"}}",
                data.Name, data is FileTreeModelData ? "/" : "folder", children);

            return json;

        }
Exemplo n.º 2
0
 void BuildSubTree(QStandardItemModel model, TreeModelData data)
 {
     QStandardItem current = new QStandardItem(data.Name);
     model.appendRow(current);
     foreach (var item in data.GetChildren())
     {
         BuildSubTree(current, item);
     }
 }
Exemplo n.º 3
0
 void BuildSubTree(QStandardItem parent, TreeModelData data)
 {
     QStandardItem current = new QStandardItem(data.Name);
     parent.setChild(parent.rowCount(), current);
     foreach (var item in data.GetChildren())
     {
         BuildSubTree(current, item);
     }
 }
Exemplo n.º 4
0
 static void BuildSubTree(Gtk.TreeStore fileListStore, TreeModelData data)
 {
     Gtk.TreeIter subIter = fileListStore.AppendValues(data.Name);
     foreach (var item in data.GetChildren())
     {
         BuildSubTree(fileListStore, subIter, item);
     }
 }