Beispiel #1
0
 private void _allDescendents(Entry ent, Entries ents)
 {
     ents.Add(ent);
     foreach (Entry child in ent.Entries) {
         _allDescendents(child, ents);
     }
 }
Beispiel #2
0
 public Entry Add(string key, string val)
 {
     /* Used to add a new category entry to an existing entry: ent.Entries.Add("myKey", "myVal"); */
     Entry ent = new Entry(key, this._catList);
     ent.Value = val;
     ent.IsLeaf = true;
     ent.ParentId = _parEnt.Id;
     this._catList.Entries.Add(ent);
     ent.BusinessCollection = this._catList.Entries;
     List.Add(ent); return ent;
 }
Beispiel #3
0
 public bool Contains(Entry obj)
 {
     foreach(Entry ent in List) {
         if (ent.Equals(obj)){
             return true;
         }
     }
     return false;
 }
Beispiel #4
0
 public Entry Add(Entry ent)
 {
     /* Used by CatList.Entries. See Entries.Add(string key)*/
     ent.BusinessCollection = this;
     List.Add(ent); return ent;
 }
Beispiel #5
0
 public Entry Add(string key)
 {
     /* Used to add a new leaf entry to an existing entry: ent.Entries.Add("MyNewEntry"); */
     Entry ent = new Entry(key, this._catList);
     ent.ParentId = _parEnt.Id;
     ent.IsLeaf = false;
     this._catList.Entries.Add(ent);
     ent.BusinessCollection = this._catList.Entries;
     List.Add(ent); return ent;
 }
Beispiel #6
0
 public Entries(Entry ent, CatList cl)
 {
     _parEnt = ent;
     _catList = cl;
 }
Beispiel #7
0
        public Entry Entry(string key)
        {
            Entry ent;
            Entry root = new Entry();
            key = key.ToUpper();
            string[] path = key.Split("/".ToCharArray());
            foreach(Entry rootEnt in this.RootEntries) {
                if (rootEnt.Key.ToUpper() == path[1]){
                    root = rootEnt; break;
                }
            }
            if (root != null){
                ent = root;
                for(int i = 2; i<path.Length; i++){
                    foreach (Entry child in ent.Entries) {
                        if (child.Key.ToUpper() == path[i]){
                            ent = child; break;
                        }
                    }
                }

                /* I don't know why I did this but it didn't work when I wanted to get a category entry with this method
                if (ent.IsLeaf)
                    return ent;
                else
                    return null;*/
                return ent;
            }
            return null;
        }
Beispiel #8
0
 public Entry AddRoot(string key)
 {
     Entry ent = new Entry(key, this);
     ent.IsLeaf = false;
     ent.Value = "";
     ent.BusinessCollection = this.Entries;
     this.Entries.Add(ent);
     return ent;
 }
Beispiel #9
0
		private void AddEntToKVP(Entry ent) {
			ListViewItem item = new ListViewItem(new string[]{ent.Key, ent.Value});
			item.Tag = ent;
			lvKVP.Items.Add(item);
		}
Beispiel #10
0
		private void LoadEntry(Entry ent, TreeNode lastTn){
			TreeNode tn = new TreeNode();
			if ( !ent.IsLeaf){
				tn = new TreeNode(ent.Key);
				tn.Tag = ent;
				if (ent.IsRoot){
					tvwHier.Nodes.Add(tn);
				}else{
					lastTn.Nodes.Add(tn);
				}
				foreach(Entry childEnt in ent.Entries){
					this.LoadEntry(childEnt, tn);
				}
				tn = tn.Parent;
			}
		}