本文整理汇总了C#中Gtk.TreeView.ExpandToPath方法的典型用法代码示例。如果您正苦于以下问题:C# TreeView.ExpandToPath方法的具体用法?C# TreeView.ExpandToPath怎么用?C# TreeView.ExpandToPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.TreeView
的用法示例。
在下文中一共展示了TreeView.ExpandToPath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowAdd2Page
private void ShowAdd2Page()
{
Header = CmisSync.Properties_Resources.ResourceManager.GetString("Which", CultureInfo.CurrentCulture);
VBox layout_vertical = new VBox (false, 12);
Button cancel_button = new Button (cancelText);
cancel_button.Clicked += delegate {
Controller.PageCancelled ();
};
Button continue_button = new Button (continueText)
{
Sensitive = false
};
continue_button.Clicked += delegate {
Controller.Add2PageCompleted(
Controller.saved_repository, Controller.saved_remote_path);
};
Button back_button = new Button (backText)
{
Sensitive = true
};
back_button.Clicked += delegate {
Controller.BackToPage1();
};
TreeStore repoStore = new Gtk.TreeStore(typeof (string), typeof (SelectionTreeItem));
TreeIter iter;
foreach (KeyValuePair<String, String> repository in Controller.repositories)
{
iter = repoStore.AppendNode();
repoStore.SetValues(iter, repository.Value , new SelectionTreeItem(repository.Key, "/"));
}
Gtk.TreeView treeView = new Gtk.TreeView(repoStore);
treeView.HeadersVisible = false;
treeView.Selection.Mode = SelectionMode.Single;
treeView.AppendColumn("Name", new CellRendererText(), "text", 0);
treeView.CursorChanged += delegate(object o, EventArgs args) {
TreeSelection selection = (o as TreeView).Selection;
TreeModel model;
if (selection.GetSelected(out model, out iter)) {
SelectionTreeItem sti = model.GetValue(iter, 1) as SelectionTreeItem;
// Identify the selected remote path.
Controller.saved_remote_path = sti.fullPath;
// Identify the selected repository.
TreeIter cnode = iter;
TreeIter pnode = iter;
while (model.IterParent(out pnode, cnode)) {
cnode = pnode;
}
Controller.saved_repository = (model.GetValue(cnode, 1) as SelectionTreeItem).repository;
// Load sub-folders if it has not been done already.
// We use each item's Tag to store metadata: whether this item's subfolders have been loaded or not.
if (sti.childrenLoaded == false)
{
this.GdkWindow.Cursor = wait_cursor;
// Get list of subfolders asynchronously
GetSubfoldersDelegate dlgt = new GetSubfoldersDelegate(CmisUtils.GetSubfolders);
IAsyncResult ar = dlgt.BeginInvoke(Controller.saved_repository,
Controller.saved_remote_path, Controller.saved_address,
Controller.saved_user, Controller.saved_password, null, null);
while (!ar.AsyncWaitHandle.WaitOne(100)) {
while (Application.EventsPending()) {
Application.RunIteration();
}
}
string[] subfolders = dlgt.EndInvoke(ar);
TreePath tp = null;
// Create a sub-item for each subfolder
foreach (string subfolder in subfolders) {
TreeIter newchild = repoStore.AppendNode(iter);
repoStore.SetValues(newchild, System.IO.Path.GetFileName(subfolder),
new SelectionTreeItem(null, subfolder));
if (null == tp) {
tp = repoStore.GetPath(newchild);
}
}
sti.childrenLoaded = true;
if (null != tp) {
treeView.ExpandToPath(tp);
}
this.GdkWindow.Cursor = default_cursor;
}
continue_button.Sensitive = true;
}
};
ScrolledWindow sw = new ScrolledWindow() {
ShadowType = Gtk.ShadowType.In
};
sw.Add(treeView);
//.........这里部分代码省略.........