public static void loadPrintTemplates(RadTreeView treeview, int printType, out DataTable templateType, ref DataTable printTemplate, bool allSite) { DataSet dsTemplateTypes = loadData(ref printTemplate); templateType = dsTemplateTypes.Tables["PrintTemplateType"]; RadTreeNode globalRoot = loadPrintTemplatesBySite(treeview, printType, dsTemplateTypes, ref printTemplate, string.Empty); if (globalRoot != null) { globalRoot.Expand(); } if (allSite) { string domain = ConfigurationManager.AppSettings["Domain"]; DataTable dt = GetSiteList(domain); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { loadPrintTemplatesBySite(treeview, printType, dsTemplateTypes, ref printTemplate, System.Convert.ToString(dr["Site"])); } } } else { loadPrintTemplatesBySite(treeview, printType, dsTemplateTypes, ref printTemplate, ConfigurationManager.AppSettings["Site"]); } }
protected virtual void PerformDragDrop(Point dropLocation, TreeNodeElement targetNodeElement, List <RadTreeNode> draggedNodes) { RadTreeNode targetNode = targetNodeElement.Data; DropPosition position = this.GetDropPosition(dropLocation, targetNodeElement); if (position == DropPosition.AsChildNode) { foreach (RadTreeNode node in draggedNodes) { if (!this.OnDragEnding(position, node, targetNode)) { continue; } node.Remove(); targetNode.Nodes.Add(node); this.owner.OnDragEnded(new RadTreeViewDragEventArgs(node, targetNode)); } targetNode.Expand(); } else { this.PerformDragDropCore(position, targetNode, draggedNodes); } }
public override object Execute(params object[] settings) { if (settings.Length <= 0 || !this.CanExecute(settings[0])) { return((object)null); } RadTreeNode setting = settings[0] as RadTreeNode; bool flag = false; try { flag = settings.Length <= 1 ? setting.Expanded : (!(settings[1] is IList) ? !(bool)settings[1] : !(bool)((IList)settings[1])[0]); } catch (Exception ex) { flag = setting.Expanded; } finally { if (flag) { setting.Collapse(); } else { setting.Expand(); } } return((object)setting.Expanded); }
private void OpenBoite_Click(object sender, EventArgs e) { if (radTreeView2.SelectedNode.Level == 0) { CurrentBoite = radTreeView2.SelectedNode; openBoite.Enabled = false; toInstance.Enabled = closeBoite.Enabled = boiteOpen = true; var Docs = getDocs(CurrentBoite.Value.ToString()); foreach (DataRow item in Docs.Rows) { RadTreeNode doc = new RadTreeNode(); var user_index = item["user_index"].ToString(); var doss = item["NomDossier"].ToString(); //var pdf = doss.Split('\\')[1]; var path = item["Chemin"].ToString(); var statusDoc = (int)item["id_status"]; var image = "folder_closed"; doc.Image = Resources.folder_closed; if (statusDoc == 6) { image = "folder_ok"; doc.Image = Resources.folder_ok; } else if (statusDoc == 18) { image = "folder_error"; doc.Image = Resources.folder_error; } else if (statusDoc == 19) { image = "blueFolder"; doc.Image = Resources.blueFolder; } doc.Name = doss; doc.Text = $"({user_index}) {doss}"; doc.Value = path; doc.Tag = new NodeData { type = item["type"].ToString(), NomDoc = doss, xmlPath = Path.GetDirectoryName(path) + ".xml", status = statusDoc, image = image }; doc.ToolTipText = doss; doc.ContextMenu = docContextMenu; CurrentBoite.Nodes.Add(doc); } CurrentBoite.Expand(); } }
private void item_Click(object sender, EventArgs e) { RadBreadCrumb.AssociatedMenuItem associatedMenuItem = sender as RadBreadCrumb.AssociatedMenuItem; for (RadTreeNode radTreeNode = associatedMenuItem.AssociatedNode; radTreeNode != null; radTreeNode = radTreeNode.Parent) { radTreeNode.Expand(); } this.defaultTreeView.SelectedNode = associatedMenuItem.AssociatedNode; this.defaultTreeView.BringIntoView(associatedMenuItem.AssociatedNode); }
protected virtual void PerformDragDrop( Point dropLocation, TreeNodeElement targetNodeElement, List <RadTreeNode> draggedNodes) { RadTreeNode data = targetNodeElement.Data; DropPosition dropPosition = this.GetDropPosition(dropLocation, targetNodeElement); if (dropPosition == DropPosition.AsChildNode) { bool isCopyingNodes = this.IsCopyingNodes; int index = 0; while (index < draggedNodes.Count) { if (!this.OnDragEnding(dropPosition, draggedNodes[index], data)) { draggedNodes.RemoveAt(index); } else { ++index; } } if (this.owner.bindingProvider.CanDrop || data.treeView != null && data.treeView.bindingProvider.CanDrop) { this.owner.bindingProvider.DropNodes(data, draggedNodes); foreach (RadTreeNode draggedNode in draggedNodes) { this.owner.OnDragEnded(new RadTreeViewDragEventArgs(draggedNode, data)); } } else { foreach (RadTreeNode draggedNode in draggedNodes) { RadTreeNode radTreeNode = draggedNode; if (isCopyingNodes) { radTreeNode = this.CreateTreeNode(radTreeNode); } else { radTreeNode.Remove(); } data.Nodes.Add(radTreeNode); this.owner.OnDragEnded(new RadTreeViewDragEventArgs(radTreeNode, data)); } } data.Expand(); } else { this.PerformDragDropCore(dropPosition, data, draggedNodes); } }
public void JdownloaderTree(RadTreeView RadTree, bool ClearTree = true) { _TelerikLib.RadTree tree = new _TelerikLib.RadTree(); if (ClearTree) { RadTree.ClearTree(); } //==== Nodes for Files Currently Downloading =============== List <string> downloads = CurrentJDownloads(); RadTreeNode downloading = new RadTreeNode(); downloading.Text = "Downloading (" + downloads.Count + ")"; downloading.Tag = "Downloading"; tree.AddNodeIfMissing(RadTree, downloading); foreach (string file in downloads) { RadTreeNode node = new RadTreeNode(); node.Text = file.FileName(); node.Tag = file; tree.AddNodeIfMissing(RadTree, node, false, downloading); } if (JDownloadedList != null) { //==== Nodes for Files Already Downloaded =============== RadTreeNode downloaded = new RadTreeNode(); downloaded.Text = "Downloaded (" + JDownloadedList.Count + ")"; downloaded.Tag = "Downloaded"; tree.AddNodeIfMissing(RadTree, downloaded); foreach (string file in JDownloadedList) { string actualFile = file.Replace(".part", ""); if (File.Exists(actualFile)) { RadTreeNode node = new RadTreeNode(); node.Text = actualFile.FileName(); node.Tag = actualFile; tree.AddNodeIfMissing(RadTree, node, false, downloaded); } } downloaded.Expand(); } //RadTree.ExpandAll(); downloading.Expand(); }
private void SetFontAndImageForOneNode(RadTreeNode node) { node.ImageIndex = node.Nodes.Count == 0 ? 0 : node.Level + 1; node.Font = FontOfNode; // node.Text = node.Text + " => " + node.Level; if (node.Level < 1) { node.Expand(); } foreach (var item in node.Nodes) { SetFontAndImageForOneNode(item); } }
private void item_Click(object sender, EventArgs e) { AssociatedMenuItem assocItem = sender as AssociatedMenuItem; RadTreeNode node = assocItem.AssociatedNode; while (node != null) { node.Expand(); node = node.Parent; } this.defaultTreeView.SelectedNode = assocItem.AssociatedNode; this.defaultTreeView.BringIntoView(assocItem.AssociatedNode); }
private void ExpandNode() { RadTreeNode node = this.treeView.SelectedNode; if (node != null) { if (node.Expanded) { node.Collapse(true); } else { node.Expand(); } } }
private void ExpandNode() { RadTreeNode selectedNode = this.treeView.SelectedNode; if (selectedNode == null) { return; } if (selectedNode.Expanded) { selectedNode.Collapse(true); } else { selectedNode.Expand(); } }
private void ExpandEnsureVisible() { if (this.TreeView.SelectedNode != null) { this.TreeView.BeginUpdate(); RadTreeNode parent = this.TreeView.SelectedNode.Parent; while (parent != null && !parent.Expanded) { parent.Expand(); parent = parent.Parent; } this.TreeView.EndUpdate(true, RadTreeViewElement.UpdateActions.Resume); this.TreeView.EnsureVisible(this.TreeView.SelectedNode); } }
public override object Execute(params object[] settings) { if (settings.Length > 0 && this.CanExecute(settings[0])) { RadTreeNode node = settings[0] as RadTreeNode; bool expanded = false; try { if (settings.Length > 1) { if (settings[1] is IList) { expanded = !(bool)((IList)settings[1])[0]; } else { expanded = !(bool)settings[1]; } } else { expanded = node.Expanded; } } catch (Exception) { expanded = node.Expanded; } finally { if (expanded) { node.Collapse(); } else { node.Expand(); } } return(node.Expanded); } return(null); }
private void ExpandNodes() { using (this.radTreeView1.DeferRefresh()) { RadTreeNode root = this.radTreeView1.Nodes[0]; root.Expand(); int index = 0; foreach (RadTreeNode node in root.Nodes) { if (index % 2 == 0) { node.Expand(); } index++; } if (root.Nodes.Count > 0) { root.Nodes[root.Nodes.Count - 1].ExpandAll(); } } }
private void InsertContacts(Message_GetContacts.Contact[] ContactList) { foreach (Message_GetContacts.Contact tmpContact in ContactList) { RadTreeNode LastNode = null; //APPEND AVAILABLE AND OFFLINE TO THE NODE'S GROUP DEPENDING ON IF ITS ONLINE / OFFLINE if (tmpContact.Online) { tmpContact.Group = "Available\\" + tmpContact.Group; } else { tmpContact.Group = "Offline\\" + tmpContact.Group; } //LOOP THROUGH ALL OF THE ITEMS IN THE CONTACTS GROUP TO FIND WHERE TO PLACE IT foreach (string parentNodeStr in tmpContact.Group.Split('\\')) { RadTreeNode tmpNode; //IF THIS IS THE FIRST TIME RUNNING THEN WE NEED TO SEARCH THE ROOT NODES ELSE ONLY SEARCH THE LAST NODE WE WERE INSIDE OF if (LastNode == null) { tmpNode = this.ContactsList.Nodes.Find(parentNodeStr, false).FirstOrDefault(); } else { tmpNode = LastNode.Nodes.Find(parentNodeStr, false).FirstOrDefault(); } //IF THE NODE WAS NOT FOUND IT MEANS THE FOLDER HAS NOT BEEN CREATED AND WE NEED TO CREATE IT if (tmpNode == null) { //CREATE THE NODE AND REMEMBER ITS NAME tmpNode = new RadTreeNode(parentNodeStr); tmpNode.Name = parentNodeStr; //IF THIS IS A ROOT NODE THEN ADD IT TO THE ROOT ELSE ADD IT TO THE LASTNODE WE FOUND if (LastNode == null) { this.ContactsList.Nodes.Add(tmpNode); } else { LastNode.Nodes.Add(tmpNode); } } //REMEMBER THE LAST NODE SO WE KNOW WHERE TO ADD IT TO LastNode = tmpNode; } //CREATE THE CONTACT NODE //THIS MIGHT SHOULD BE STORED IN THE DATABASE AS LAST KNOWN STATUS.... POSIBLY WHERE TO STORE ALL STATUS MESSAGES?? RadTreeNode ContactNode = new RadTreeNode(tmpContact.DName + " - " + tmpContact.LastStatus); ContactNode.Name = tmpContact.UserID; ContactNode.Tag = tmpContact.DName; ContactNode.ForeColor = (tmpContact.Online ? Color.Blue : Color.Red); //ADD IT TO THE LIST OF CONTACTS AND MAKE IT VISIBLE IF THE USER IS ONLINE LastNode.Nodes.Add(ContactNode); if (tmpContact.Online) { //TRAVERSE THE TREE AND EXPAND ALL OF THE NODES PARENTS SO IT IS VISIBLE TO THE USER for (RadTreeNode tmpNode = ContactNode; tmpNode != null; tmpNode = tmpNode.PrevNode) { tmpNode.Expand(); } } } //SORT THE TREE AFTER THE UPDATE treeContacts.Sort(); }