public static Gtk.TreeStore DataBind(this Gtk.TreeView tree, SyncItem data)
        {
            Gtk.TreeStore syncItems = new Gtk.TreeStore(typeof(SyncItem));

            var iter = syncItems.AppendValues(data);
            SetChildItems(syncItems, iter, data.ChildItems.Values);

            return syncItems;
        }
Ejemplo n.º 2
0
        public SyncItem AddItem(string path, KalliopeSync.Core.Models.IndexItem indexItem)
        {
            string [] pathStructure = path.Replace('\\', '/').TrimStart(new [] { '/' }).Split('/');
            string    key           = pathStructure[0];

            if (string.IsNullOrEmpty(key))
            {
                return(null);
            }
            if (this.ChildItems.ContainsKey(key))
            {
                return(this.ChildItems[key].AddItem(path.Replace(@"/" + key, ""), indexItem));
            }
            else
            {
                var newItem = new SyncItem {
                    Id = DateTime.Now.Ticks, FileKey = indexItem.Id, Name = indexItem.Name
                };
                newItem.Name = key;
                this.ChildItems.Add(key, newItem);
                return(newItem.AddItem(path.Replace(@"/" + key, ""), indexItem));
                //return newItem;
            }
        }
Ejemplo n.º 3
0
 public SyncItem AddItem(string path, KalliopeSync.Core.Models.IndexItem indexItem)
 {
     string [] pathStructure = path.Replace('\\','/').TrimStart(new [] {'/'}).Split('/');
     string key = pathStructure[0];
     if (string.IsNullOrEmpty(key))
     {
         return null;
     }
     if (this.ChildItems.ContainsKey(key))
     {
         return this.ChildItems[key].AddItem(path.Replace(@"/" + key, ""), indexItem);
     }
     else
     {
         var newItem = new SyncItem { Id = DateTime.Now.Ticks, FileKey = indexItem.Id, Name = indexItem.Name };
         newItem.Name = key;
         this.ChildItems.Add(key, newItem);
         return newItem.AddItem(path.Replace(@"/" + key, ""), indexItem);
                         //return newItem;
     }
 }