public MyListItem addFileToList(MyTreeNode versionNode) { // In case of Fusion files we'll be downloading f3z var postFix = versionNode.isFusionFile() ? ".f3z" : "." + versionNode.fileType; // Get relative folder path that we need to recreate on the // local storage side var relPath = ""; MyTreeNode node = versionNode; do { node = (MyTreeNode)node.Parent; relPath = "\\" + removeIllegalFilenameCharacters(node.Text) + relPath; } while (nodeToDownload != node); relPath = relPath.Replace(new string(kUpdateChar, 1), ""); // Add file extrension if needed if (postFix != "." && !relPath.EndsWith(postFix) && !relPath.EndsWith(postFix.ToUpper())) { relPath += postFix; } // Create list item var item = new MyListItem(versionNode, tbxBackupFolder.Text + relPath); ListViewItem lvItem = ltvFiles.Items.Add(item); lvItem.SubItems.Add(item.fileState.ToString()); return(item); }
private void addToRootNode(ref MyTreeNode rootNode, string accType, string accName, int accID) { MyTreeNode newAcc = new MyTreeNode(accName, accID); newAcc.NodeFont = rootNode.NodeFont; newAcc.ForeColor = rootNode.ForeColor; // Go throu each node in the given root node and add the new account to the corrolating Account Type // If it doesn't exsist add a new accounttype node. foreach (MyTreeNode typeNode in rootNode.Nodes) { if (typeNode.Text == accType) { // We have found the appropriate node add the Account node, there is nothing else to do. typeNode.Nodes.Add(newAcc); return; } } // If we get here there was no type node matching the new account. MyTreeNode newTypeNode = new MyTreeNode(accType, SpclAccount.NULL); newTypeNode.NodeFont = rootNode.NodeFont; newTypeNode.ForeColor = rootNode.ForeColor; newTypeNode.Nodes.Add(newAcc); rootNode.Nodes.Add(newTypeNode); }
private async void listProjects(MyTreeNode hubNode) { var projectsApi = new ProjectsApi(); projectsApi.Configuration.AccessToken = logInInfo.accessToken; string[] idParams = hubNode.id.Split('/'); string hubId = idParams[idParams.Length - 1]; setNodeState(hubNode, true); var projects = await projectsApi.GetHubProjectsAsync(hubId); foreach (KeyValuePair <string, dynamic> projectInfo in new DynamicDictionaryItems(projects.data)) { MyTreeNode projectNode = new MyTreeNode( projectInfo.Value.links.self.href, projectInfo.Value.attributes.name, projectInfo.Value.attributes.extension.type, "", NodeType.Project ); addToTreeView(hubNode, projectNode); } setNodeState(hubNode, false); }
private async void listTopFolders(MyTreeNode projectNode) { var projectsApi = new ProjectsApi(); projectsApi.Configuration.AccessToken = logInInfo.accessToken; string[] idParams = projectNode.id.Split('/'); string hubId = idParams[idParams.Length - 3]; string projectId = idParams[idParams.Length - 1]; setNodeState(projectNode, true); var folders = await projectsApi.GetProjectTopFoldersAsync(hubId, projectId); foreach (KeyValuePair <string, dynamic> folderInfo in new DynamicDictionaryItems(folders.data)) { MyTreeNode folderNode = new MyTreeNode( folderInfo.Value.links.self.href, folderInfo.Value.attributes.displayName, folderInfo.Value.attributes.extension.type, "", NodeType.Folder ); addToTreeView(projectNode, folderNode); } setNodeState(projectNode, false); }
//////////////////////////////////////////////////////////////////////////////////////////// // Functions Public //////////////////////////////////////////////////////////////////////////////////////////// public EditEnvelopesForm() { InitializeComponent(); // Initialize dataset this.eEDataSet.myInit(); this.eEDataSet.myFillEnvelopTable(); this.eEDataSet.myFillGroupTable(); this.ClosedEnvelopesNode = new MyTreeNode("Closed Envelopes", -10); buildEnvelopeTree(); // set the max length on the name text box. this.nameTextBox.MaxLength = this.eEDataSet.Envelope.nameColumn.MaxLength; // Select the first node if it is there if (this.envelopeTreeView.Nodes.Count > 0) { this.envelopeTreeView.SelectedNode = this.envelopeTreeView.Nodes[0]; } else { // else select nothing this.envelopeBindingSource.AddNew(); this.envelopeGroupBindingSource.Filter = "id = -10"; } }
private void AppendChild(TreeNode tnParent, string varid) { DataRow[] drs = pDTMain.Select("[PARENT]=" + varid); foreach (DataRow dr in drs) { String sTransCode = dr["TRANSTYPECODE"].ToString(); DataRow[] drsL = pDTMainL.Select("[TRANSTYPECODE] like\'" + sTransCode + "%\'"); if (drs.Length <= 0) { return; } if (drsL.Length > 0) { MyTreeNode tn = new MyTreeNode(); tn.Text = dr["TRANSTYPENAME"].ToString(); tn.OperContex = dr["OperContex"].ToString(); tn.OperMode = dr["OperMode"].ToString(); tn.PermId = dr["TID"].ToString(); tn.ParentId = dr["Parent"].ToString(); AppendChild(tn, dr["TRANSTYPEID"].ToString()); tnParent.Nodes.Add(tn); } } }
public List <MyTreeNode> MyTreeNodeConverter(object mData) { List <MyTreeNode> resultList = new List <MyTreeNode>(); var mTreeNodeList = (mData as HashSet <Node>).ToList(); foreach (var node in mTreeNodeList) { MyTreeNode tmp = new MyTreeNode(); tmp.NodeLocation = node.NodeLocation; tmp.CostFuncValue = 0; resultList.Add(tmp); } for (int i = 0; i < mTreeNodeList.Count; i++) { if (mTreeNodeList[i].ParentNode != null) { resultList[i].ParentNode = resultList[mTreeNodeList.IndexOf(mTreeNodeList[i].ParentNode)]; } else { resultList[i].ParentNode = null; } } return(resultList); }
private void envelopeTreeView_AfterSelect(object sender, TreeViewEventArgs e) { MyTreeNode node = e.Node as MyTreeNode; int envelopeID = node.ID; // End, save this.envelopeBindingSource.EndEdit(); this.eEDataSet.myUpdateEnvelopeDB(); // Enable or disable the combo box EEDataSet.EnvelopeRow eRow = this.eEDataSet.Envelope.FindByid(envelopeID); if (eRow == null || envelopeID == SpclEnvelope.NULL) { this.parentEnvelopeComboBox.Enabled = false; this.nameTextBox.Enabled = false; this.closedCheckBox.Enabled = false; } else if (eRow.closed) { this.parentEnvelopeComboBox.Enabled = false; this.nameTextBox.Enabled = true; this.closedCheckBox.Enabled = true; } else { this.parentEnvelopeComboBox.Enabled = true; this.nameTextBox.Enabled = true; this.closedCheckBox.Enabled = true; } // Set Selected Envelope to the selected envelope this.envelopeBindingSource.Filter = "id = " + envelopeID.ToString(); }
private void LoadParentTree(DataTable dtTree) { string sParent = "0"; //TreeView tv;//树控件 tv.Nodes.Clear(); // 获得第一级数据 DataRow[] drRoot = dtTree.Select("[PARENT]=" + sParent); foreach (DataRow dr in drRoot) { String sTransCode = "[TRANSTYPECODE] like \'" + dr["TRANSTYPECODE"].ToString() + "%\'"; DataRow[] drsL = pDTMainL.Select(sTransCode); if (drsL.Length > 0) { MyTreeNode tn = new MyTreeNode(); tn.Text = dr["TRANSTYPENAME"].ToString(); tn.OperContex = dr["OperContex"].ToString(); tn.OperMode = dr["OperMode"].ToString(); tn.PermId = dr["TID"].ToString(); AppendChild(tn, dr["TRANSTYPEID"].ToString()); tv.Nodes.Add(tn); } ; } }
public MyListItem(MyTreeNode node, string localPath) { this.node = node; this.localPath = localPath; this.Text = localPath; this.fileState = DownloadState.Default; this.UseItemStyleForSubItems = false; }
void NodesLoad() { MyTreeNode node = new MyTreeNode(); DirectoryInfo info = new DirectoryInfo(FolderPath); GetNodes(info, ref node); Nodes = new ObservableCollection <MyTreeNode>(node.ChildNodes); }
public void mibbrowser_OnMibNode(object sender, nsoftware.IPWorksSNMP.MibbrowserMibNodeEventArgs e) { string[] subids = e.NodeOid.Split(".".ToCharArray()); string oid = ""; TreeNodeCollection treeNodeCollection = tvwMibNodes.Nodes; foreach (string subid in subids) { MyTreeNode matchingTreeNode = null; foreach (MyTreeNode treeNode in treeNodeCollection) { if (treeNode.subid == subid) { matchingTreeNode = treeNode; break; } } oid += "." + subid; if (matchingTreeNode == null) { MibTreeInformation tree = new MibTreeInformation(); tree.Name = e.NodeLabel; tree.OID = e.NodeOid; tree.Mib = e.NodeModuleName; tree.Syntax = e.NodeSyntaxString; tree.Description = e.NodeDescription; tree.Access = e.NodeAccess.ToString(); tree.Status = e.NodeTypeString; tree.Indexes = e.NodeIndex; tree.MibID = id; tree.DefVal = ""; tree.DeviceID = DeviceID; tree.ParentName = e.NodeParentName; TreeMibList.Add(tree); TreeStructure childparent = new TreeStructure(); var parrent = TreeMibList.Where(m => m.Name == e.NodeParentName).FirstOrDefault(); if (parrent == null) { TreeMibList[TreeMibList.Count - 1].ParrentID = 0; } else { TreeMibList[TreeMibList.Count - 1].ParrentID = parrent.MibID; } id++; matchingTreeNode = new MyTreeNode(oid, e.NodeLabel, subid, e.NodeTypeString); treeNodeCollection.Add(matchingTreeNode); } treeNodeCollection = matchingTreeNode.ChildNodes; } }
private void accountTreeView_AfterSelect(object sender, TreeViewEventArgs e) { MyTreeNode node = e.Node as MyTreeNode; currentID = node.ID; // End, save this.accountBindingSource.EndEdit(); this.eADataSet.myUpdateAccountDB(); // Enable or disable the combo box EADataSet.AccountRow aRow = this.eADataSet.Account.FindByid(currentID); if (aRow == null || currentID == SpclAccount.NULL) { this.nameTextBox.Enabled = false; this.accountTypeIDComboBox.Enabled = false; this.catagoryIDComboBox.Enabled = false; this.closedCheckBox.Enabled = false; this.accountNormalComboBox.Enabled = false; this.envelopesCheckBox.Enabled = false; } else if (aRow.closed) { this.nameTextBox.Enabled = false; this.accountTypeIDComboBox.Enabled = false; this.catagoryIDComboBox.Enabled = false; this.closedCheckBox.Enabled = true; this.accountNormalComboBox.Enabled = false; this.envelopesCheckBox.Enabled = false; } else if (aRow.catagory == SpclAccountCat.EXPENSE || aRow.catagory == SpclAccountCat.INCOME) { this.nameTextBox.Enabled = true; this.accountTypeIDComboBox.Enabled = true; this.catagoryIDComboBox.Enabled = true; this.closedCheckBox.Enabled = true; this.accountNormalComboBox.Enabled = false; this.envelopesCheckBox.Enabled = false; this.envelopesCheckBox.Checked = false; } else { this.nameTextBox.Enabled = true; this.accountTypeIDComboBox.Enabled = true; this.catagoryIDComboBox.Enabled = true; this.closedCheckBox.Enabled = true; this.accountNormalComboBox.Enabled = true; this.envelopesCheckBox.Enabled = true; } // Set Selected Account to the selected Account this.accountBindingSource.Filter = "id = " + currentID.ToString(); }
private TreeNode selectNode = null; //标记treeView控件中当前被选中的节点 public MainForm() { InitializeComponent(); controlOperation = new AxRenderControlOperation(this.axRenderControl1); controlOperation.InitializationAxRenderControl(); MyTreeNode treeNodes = controlOperation.BindDataToCatalogTree(); SetTreeNodeWithContextMenuStrip(treeNodes.Nodes); this.treeView1.Nodes.Add(treeNodes.Nodes[0]); }
private void TreeViewTables_BeforeExpand(object sender, TreeViewCancelEventArgs e) { if (!GetMainHome().GetUserControl <Editor>().GetQueryExecutor().IsAlive()) { switch ((e.Node as MyTreeNode).Type) { case NodeType.Table: { List <string> fields = DbDataHelper.getTableFields(GetSqlConnection(), e.Node.Text); List <string> fieldsInfo = DbDataHelper.getTableInfo(GetSqlConnection(), e.Node.Text); List <MyTreeNode> nodes = new List <MyTreeNode>(); foreach (string f in fields) { nodes.Add(new MyTreeNode() { Text = f, ImageIndex = 1, SelectedImageIndex = 1 }); } foreach (string f in fieldsInfo) { nodes.Add(new MyTreeNode() { Text = f, ImageIndex = 2, SelectedImageIndex = 2 }); } var triggerParentNode = new MyTreeNode() { Text = "Triggers", ImageIndex = 3, SelectedImageIndex = 3, Type = NodeType.ParentTrigger }; triggerParentNode.Nodes.Add(getDummy()); nodes.Add(triggerParentNode); this.setTableFields(nodes, e.Node as MyTreeNode); } break; case NodeType.ParentTrigger: { List <string> triggers = DbDataHelper.getTableTriggers(GetSqlConnection(), e.Node.Parent.Text); List <MyTreeNode> nodes = new List <MyTreeNode>(); foreach (string t in triggers) { nodes.Add(new MyTreeNode() { Text = t, Type = NodeType.Trigger, ImageIndex = 3, SelectedImageIndex = 3 }); } this.setTableFields(nodes, e.Node as MyTreeNode); } break; } } }
void GetNodes(DirectoryInfo info, ref MyTreeNode node) { var files = info.GetFiles(); foreach (var file in files) { //必须进行与运算,因为默认文件是“Hidden”+归档(二进制11)。而Hidden是10.因此与运算才可以判断 if ((file.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden) { MyTreeNode dicTree = new MyTreeNode(); if (Helper.CheckWhetherExcelFile(file.FullName)) { dicTree.Type = TreeType.ExcelFlie; } else if (Helper.CheckWhetherPDFFile(file.FullName)) { dicTree.Type = TreeType.Pdf; } else { dicTree.Type = TreeType.Unknown; } dicTree.FullExcelFileName = file.FullName; dicTree.ExcelFileName = file.Name; string dir = Path.GetDirectoryName(file.FullName); string filename = Path.GetFileName(dicTree.FullExcelFileName); if (dicTree.Type == TreeType.ExcelFlie) { filename = Path.ChangeExtension(filename, ".PDF").Replace(".PDF", this.ExcelToPDF.ToString() + ".PDF"); } dicTree.FullPDFFileName = dir + "\\" + filename; node.ChildNodes.Add(dicTree); } } var dics = info.GetDirectories(); foreach (var dic in dics) { //必须进行与运算,因为默认文件是“Hidden”+归档(二进制11)。而Hidden是10.因此与运算才可以判断 if ((dic.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden) { MyTreeNode dicTree = new MyTreeNode(); dicTree.Type = TreeType.Folder; dicTree.FullExcelFileName = dic.FullName; dicTree.ExcelFileName = dic.Name; GetNodes(dic, ref dicTree); node.ChildNodes.Add(dicTree); } } }
private void LoadParentTree(DataTable dtTree) { tv.Nodes.Clear(); // 获得第一级数据 DataRow[] drRoot = dtTree.Select(); foreach (DataRow dr in drRoot) { MyTreeNode tn = new MyTreeNode(); tn.Text = dr["DRNAME"].ToString(); tn.PermId = dr["DRID"].ToString(); tv.Nodes.Add(tn); } }
private void setRootTablesIntoTreeView(List <string> tables) { this.treeViewTables.BeginUpdate(); treeViewTables.Nodes.Clear(); foreach (string t in tables) { MyTreeNode node = new MyTreeNode() { Text = t, ImageIndex = 0, Type = NodeType.Table }; node.Nodes.Add(getDummy()); treeViewTables.Nodes.Add(node); } this.treeViewTables.EndUpdate(); }
}// PutValuesinPage void PutInCodeGroup(CodeGroup cg, TreeNode tn) { MyTreeNode newtn = new MyTreeNode(cg.Name, cg); newtn.ImageIndex = newtn.SelectedImageIndex = (cg is UnionCodeGroup)?UNIONCODEGROUP:NONUNIONCODEGROUP; tn.Nodes.Add(newtn); // Now run through this codegroup's children IEnumerator enumCodeGroups = cg.Children.GetEnumerator(); while (enumCodeGroups.MoveNext()) { CodeGroup group = (CodeGroup)enumCodeGroups.Current; PutInCodeGroup(group, newtn); } } // PutInCodeGroup
MyTreeNode buildTree(dynamic node) { MyTreeNode n = new MyTreeNode((string)node.name); n.data = node; n.Expand(); if (node.children != null) { foreach (var c in node.children) { n.Nodes.Add(buildTree(c)); } } return(n); }
// Previous BackgroundWorker code would go here private void ExecuteRecursiveOperation(MyTreeNode node) { if (bwRecursive.CancellationPending) { return; } foreach (MyTreeNode childNode in node.ChildNodes) { continueEvent.WaitOne(); // <--- This is the new code if (bwRecursive.CancellationPending) { break; } ExecuteRecursiveOperation(childNode); } }
private static bool GetUniqueName(MyTreeNode node, string name) { bool unique = true; foreach (MyTreeNode child in node.Nodes) { if (child.ImplName != name) { unique &= GetUniqueName(child, name); } else { return(false); } } return(unique); }
private void setTableFields(List <MyTreeNode> nodes, MyTreeNode parentNode) { this.treeViewTables.BeginUpdate(); parentNode.Nodes.Clear(); if (nodes != null && nodes.Count > 0) { foreach (var n in nodes) { parentNode.Nodes.Add(n); } } else { parentNode.Nodes.Add(getDummy()); } this.treeViewTables.EndUpdate(); }
/// <summary> /// Build the modules tree using the active nodes collection. /// </summary> /// <param name="myTreeNodes">Active node colecction.</param> private void LoadTreeView(List <MyTreeNode> myTreeNodes) { foreach (MyTreeNode node in rootNodes) { TreeNode parent = trw.Nodes.Add(node.Text); MyTreeNode childNodeEditors = new MyTreeNode() { Text = "Editors" }; parent.Nodes.Add(childNodeEditors); MyTreeNode childNodeServices = new MyTreeNode() { Text = "Services" }; parent.Nodes.Add(childNodeServices); foreach (MyTreeNode childNode in myTreeNodes) { if (childNode != null && childNode.Module.ToLower() == node.Text.ToLower()) { if (node.Text == "ElectronicDataInterchange" || node.Text == "Platform") { parent.Nodes.Remove(childNodeEditors); } if (childNode.Namespace.ToLower().EndsWith("editors")) { childNodeEditors.Nodes.Add(childNode); } else if (childNode.Namespace.ToLower().EndsWith("services")) { childNodeServices.Nodes.Add(childNode); } } } // Remove modules without child nodes in services or editors. if (childNodeEditors.Nodes.Count == 0 && childNodeServices.Nodes.Count == 0) { parent.Nodes.Remove(parent); } } }
private void tv_tjdw_AfterSelect(object sender, TreeViewEventArgs e) { if (tv_tjdw.SelectedNode.Nodes.Count == 0) { tv_tjdw.SelectedNode.SelectedImageIndex = tv_tjdw.SelectedNode.ImageIndex; ////tv_tjlxb.SelectedNode.Parent.ImageIndex = 0; } MyTreeNode node = (MyTreeNode)tv_tjdw.SelectedNode; str_dwbh = node.Str1.Trim(); str_fzbh = node.Str2.Trim(); txt_dwmc.Text = node.Str3.Trim(); if (str_fzbh == "") { ClearControl(); return; }//没有子节点 DataTable dt_TJ_DWFZ_HD = tjglbiz.Get_TJ_DWFZ_HD(str_dwbh, str_fzbh); if (dt_TJ_DWFZ_HD.Rows.Count < 1) { return; } txt_fzbh.Text = dt_TJ_DWFZ_HD.Rows[0]["bh"].ToString().Trim(); txt_fzmc.Text = dt_TJ_DWFZ_HD.Rows[0]["fzmc"].ToString().Trim(); cmb_xb.SelectedValue = dt_TJ_DWFZ_HD.Rows[0]["xb"].ToString().Trim(); txt_zw.Text = dt_TJ_DWFZ_HD.Rows[0]["zw"].ToString().Trim(); txt_zc.Text = dt_TJ_DWFZ_HD.Rows[0]["zc"].ToString().Trim(); this.Text = "体检单位分组" + "【" + txt_fzmc.Text.Trim() + "】"; lv_tjxm.Items.Clear(); dt_tj_dwfz_dt = tjglbiz.Get_TJ_DWFZ_DT(str_fzbh, str_dwbh); foreach (DataRow dr in dt_tj_dwfz_dt.Rows) { ListViewItem item = new ListViewItem(); item.Tag = dr["zhxm"].ToString().Trim(); item.Text = dr["mc"].ToString().Trim(); item.ImageIndex = 5; lv_tjxm.Items.Add(item); } }
private void btnBackup_Click(object sender, EventArgs e) { nodeToDownload = (MyTreeNode)treeView.SelectedNode; if (nodeToDownload == null || nodeToDownload.nodeType != NodeType.Folder) { MessageBox.Show("Select an A360 folder to back up"); return; } if (tbxBackupFolder.Text == "") { MessageBox.Show("Select a local folder for the backup"); return; } // btnBackup.Enabled = false; listFolderContents(nodeToDownload, true, true); }
SelectTemplate(object item, DependencyObject container) { FrameworkElement element = container as FrameworkElement; if (element != null && item != null && item is MyTreeNode) { MyTreeNode treeNode = item as MyTreeNode; DataTemplate temp = null; if (treeNode.Failed) { temp = App.Current.Resources["failed"] as HierarchicalDataTemplate; } else { temp = App.Current.Resources["succeded"] as HierarchicalDataTemplate; } return(temp); } return(null); }
private void addToTreeView(TreeNode parentNode, MyTreeNode childNode) { if (treeView.InvokeRequired) { treeView.Invoke(new DelegateAddToTreeView(this.addToTreeView), new Object[] { parentNode, childNode }); } else { TreeNodeCollection nodes; if (parentNode == null) { nodes = treeView.Nodes; } else { nodes = parentNode.Nodes; } nodes.Add(childNode); } }
private async void listHubs() { var hubsApi = new HubsApi(); hubsApi.Configuration.AccessToken = logInInfo.accessToken; var hubs = await hubsApi.GetHubsAsync(); foreach (KeyValuePair <string, dynamic> hubInfo in new DynamicDictionaryItems(hubs.data)) { MyTreeNode hubNode = new MyTreeNode( hubInfo.Value.links.self.href, hubInfo.Value.attributes.name, hubInfo.Value.attributes.extension.type, "", NodeType.Hub ); addToTreeView(null, hubNode); listProjects(hubNode); } }
void DataBind() { tv_tjdw.Nodes.Clear(); MyTreeNode treenode = new MyTreeNode(); treenode.Text = "体检单位"; treenode.Str1 = ""; treenode.Str2 = ""; treenode.Str3 = "体检单位"; DataTable dt_tjdw = tjglbiz.Get_TJ_DW(); if (object.Equals(null, dt_tjdw)) { return; } for (int i = 0; i < dt_tjdw.Rows.Count; i++) { MyTreeNode node = new MyTreeNode(); node.Text = dt_tjdw.Rows[i]["mc"].ToString().Trim(); node.Str1 = dt_tjdw.Rows[i]["bh"].ToString().Trim();//单位ID node.Str2 = ""; node.Str3 = dt_tjdw.Rows[i]["mc"].ToString().Trim(); DataTable dt_tj_dwfz_hd = tjglbiz.Get_TJ_DWFZ_HD(node.Str1.Trim()); foreach (DataRow dr in dt_tj_dwfz_hd.Rows) { MyTreeNode node1 = new MyTreeNode(); node1.Text = dr["fzmc"].ToString().Trim(); node1.Str1 = node.Str1.Trim(); //单位ID node1.Str2 = dr["bh"].ToString().Trim(); //分组ID node1.Str3 = node.Str3.Trim(); node.Nodes.Add(node1); } treenode.Nodes.Add(node); } tv_tjdw.Nodes.Add(treenode); new Common.Common().AddImage(treenode); }
private void NodeViewPopulate(NodeView nodeView, List<String> list ) { foreach(TreeViewColumn col in nodeView.Columns) nodeView.RemoveColumn(col); nodeView.NodeStore = new Gtk.NodeStore( typeof(MyTreeNode) ); ; nodeView.AppendColumn ("Имя формы", new Gtk.CellRendererText (), "text", 0); foreach (String str in list) { MyTreeNode node = new MyTreeNode(str); nodeView.NodeStore.AddNode(node); } //filter = new TreeModelFilter (nodeView.Model, null); //filter.VisibleFunc = new Gtk.TreeModelFilterVisibleFunc(FilterTree); //nodeview1.Model = filter; }
//--------------------------------------------------------------------------- private void NodeProcessing(TreeNodeCollection nodes,IComponent cmp){ if (cmp.Site == null){//for example, in NumericUpDown.Controls[0] return; } string nodeSt = cmp.Site.Name; if (ViewBaseClass){ nodeSt += " : " + cmp.GetType().FullName; } MyTreeNode node = new MyTreeNode(nodeSt); node.obj = cmp; node.Checked = false; bool findType = false; for (int i = 0; i< toolboxItemCollection.Count; i++){ if (toolboxItemCollection[i].TypeName == cmp.GetType().FullName){ node.ImageIndex = i+1; node.SelectedImageIndex = i+1; findType = true; break; } } if (!findType){ node.ImageIndex = 0; node.SelectedImageIndex = 0; LoggingService.Warn("ArtCSB: Type is not found."); } nodes.Add(node); System.Windows.Forms.Control cntrl = cmp as System.Windows.Forms.Control; if (cntrl != null){ for (int i = 0; i < cntrl.Controls.Count; i++){ NodeProcessing(node.Nodes, cntrl.Controls[i]); } } System.Web.UI.Control wtrl = cmp as System.Web.UI.Control; if (wtrl != null){ for (int i = 0; i < wtrl.Controls.Count; i++){ NodeProcessing(node.Nodes, wtrl.Controls[i]); } } }
//--------------------------------------------------------------------------- private bool FindNodeByObj(TreeNodeCollection Nodes,object obj, out MyTreeNode node){ node = null; for (int i = 0; i < Nodes.Count; i++){ if (obj == ((MyTreeNode)Nodes[i]).obj){ node = (MyTreeNode)Nodes[i]; return true; }else{ if (FindNodeByObj(Nodes[i].Nodes, obj, out node)){ return true; } } }//for return false; }
//--------------------------------------------------------------------------- private void MyTreeRefresh(){ try{ RefreshFileName = OtaUtils.GetCurrentEditorFileName(); if (!OtaUtils.GetCurrentDotNetModule().HasDesignableType){ TreeView_Controls.Nodes.Clear(); TreeView_Components.Nodes.Clear(); statusBarPanel_Module.Text = ""; statusBarPanel_Module.ToolTipText = ""; return; } ISelectionService selServ = OtaUtils.GetSelectionService(); if ( !AL.Contains(selServ) ){ selServ.SelectionChanged += new EventHandler(OnDesignerSelectionChanged); AL.Add(selServ); } statusBarPanel_Module.Text = OtaUtils.GetModuleServices().CurrentModule.FileName; statusBarPanel_Module.ToolTipText = OtaUtils.GetModuleServices().CurrentModule.FileName; TreeView_Controls.Nodes.Clear(); IComponent cmp = OtaUtils.GetCurrentDotNetModule().DesignerHost.RootComponent; NodeProcessing(TreeView_Controls.Nodes, cmp); TreeView_Components.Nodes.Clear(); for (int i = 0; i < OtaUtils.GetCurrentDotNetModule().DesignerHost.Container.Components.Count; i++) { cmp = OtaUtils.GetCurrentDotNetModule().DesignerHost.Container.Components[i]; if ( !( (cmp is System.Windows.Forms.Control) || (cmp is System.Web.UI.Control) ) ) { string nodeSt = cmp.Site.Name; if (ViewBaseClass){ nodeSt += " : " + cmp.GetType().FullName; } MyTreeNode node = new MyTreeNode(nodeSt); node.obj = cmp; node.Checked = false; bool findType = false; for (int j = 0; j< toolboxItemCollection.Count; j++){ if (toolboxItemCollection[j].TypeName == cmp.GetType().FullName) { node.ImageIndex = j+1; node.SelectedImageIndex = j+1; findType = true; break; } } if (!findType){ node.ImageIndex = 0; node.SelectedImageIndex = 0; } TreeView_Components.Nodes.Add(node); } }//for if ((bool)PropertyRegistry.Get("DesignerNavigator_ExpandTree", true)){ TreeView_Controls.ExpandAll(); TreeView_Components.ExpandAll(); } if (TreeView_Controls.Nodes.Count > 0){ TreeView_Controls.Nodes[0].EnsureVisible(); } }catch{} try{ if (OtaUtils.GetCurrentDotNetModule().DesignerHost.RootComponent is System.Web.UI.Control){ toolBarButton_DEL_CMP.Visible = false; toolBarButton_SEPARATOR4.Visible = false; }else{ toolBarButton_DEL_CMP.Visible = true; toolBarButton_SEPARATOR4.Visible = true; } }catch{} }