protected void attachSubTree(Gtk.TreeModel model, Gtk.TreeIter parent, params object[] elements) { Gtk.TreeStore store = model as Gtk.TreeStore; // remove the values if they were added before. Gtk.TreePath path = store.GetPath(parent); path.Down(); Gtk.TreeIter iter; while (store.GetIter(out iter, path)) { store.Remove(ref iter); } // Add the elements to the tree view. DirectoryInfo[] di = elements[0] as DirectoryInfo[]; FileInfo[] fi = elements[1] as FileInfo[]; for (uint i = 0; i < di.Length; ++i) { store.AppendValues(parent, di[i].ToString()); } for (uint i = 0; i < fi.Length; ++i) { store.AppendValues(parent, fi[i].ToString()); } }
/// <summary> /// Attaches a submodel to the tree view's model. /// </summary> /// <param name='model'> /// The root model to be attached to. /// </param> /// <param name='parent'>[ref] /// The pointer where the elements to be attached to. /// </param> /// <param name='elements'> /// Elements. /// </param> protected void AttachSubTree(Gtk.TreeModel model, Gtk.TreeIter parent, object[] elements) { Debug.Assert(store != null, "TreeModel shouldn't be flat"); // remove the values if they were added before. Gtk.TreePath path = store.GetPath(parent); path.Down(); Gtk.TreeIter iter; while (store.GetIter(out iter, path)) { store.Remove(ref iter); } // Add the elements to the tree view. for (uint i = 0; i < elements.Length; ++i) { store.AppendValues(parent, elements[i]); } }