本文整理汇总了C#中TreeNode.Expand方法的典型用法代码示例。如果您正苦于以下问题:C# TreeNode.Expand方法的具体用法?C# TreeNode.Expand怎么用?C# TreeNode.Expand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeNode
的用法示例。
在下文中一共展示了TreeNode.Expand方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindBuMenTree
public void BindBuMenTree(TreeNodeCollection Nds, int IDStr)
{
DataSet MYDT=ZWL.DBUtility.DbHelperSQL.GetDataSet("select * from ERPBuMen where DirID=" + IDStr.ToString() + " order by ID asc");
for(int i=0;i<MYDT.Tables[0].Rows.Count;i++)
{
TreeNode OrganizationNode = new TreeNode();
string CharManStr = "";
if (MYDT.Tables[0].Rows[i]["ChargeMan"].ToString().Trim().Length <= 0)
{
CharManStr = "<font color=\"Red\">[未设置负责人]</font>";
}
else
{
CharManStr = MYDT.Tables[0].Rows[i]["ChargeMan"].ToString().Trim();
}
OrganizationNode.Text = MYDT.Tables[0].Rows[i]["BuMenName"].ToString() + " 部门主管:" + CharManStr;
OrganizationNode.ToolTip = "部门主管:" + MYDT.Tables[0].Rows[i]["ChargeMan"].ToString() + "\n电话:" + MYDT.Tables[0].Rows[i]["TelStr"].ToString() + "\n传真:" + MYDT.Tables[0].Rows[i]["ChuanZhen"].ToString() + "\n备注:" + MYDT.Tables[0].Rows[i]["BackInfo"].ToString();
OrganizationNode.Value = MYDT.Tables[0].Rows[i]["ID"].ToString();
int strId = int.Parse(MYDT.Tables[0].Rows[i]["ID"].ToString());
OrganizationNode.ImageUrl = "~/images/user_group.gif";
OrganizationNode.SelectAction = TreeNodeSelectAction.Expand;
OrganizationNode.Expand();
Nds.Add(OrganizationNode);
//递归循环
BindBuMenTree(Nds[Nds.Count - 1].ChildNodes, strId);
}
}
示例2: GetBuilds
private void GetBuilds()
{
DataSet PrSet = ItemDAL.GetBuildNames();
treeView1.Nodes.Clear();
foreach (DataRow dr in PrSet.Tables[0].Rows)
{
TreeNode tnParent = new TreeNode();
tnParent.Text = dr["Build"].ToString();
tnParent.Value = dr["Build"].ToString();
// tnParent.PopulateOnDemand = true;
// tnParent.ToolTip = "Click to get Child";
// tnParent.SelectAction = TreeNodeSelectAction.SelectExpand;
tnParent.Expand();
// tnParent.Selected = true;
treeView1.Nodes.Add(tnParent);
FillBuildStatuses(tnParent, tnParent.Text);
}
}
示例3: BindTree
private void BindTree(TreeNodeCollection Nds, int IDStr)
{
SqlConnection Conn = new SqlConnection(ConfigurationManager.AppSettings["SQLConnectionString"].ToString());
Conn.Open();
SqlCommand MyCmd = new SqlCommand("select * from ERPBuMen where DirID=" + IDStr.ToString() + " order by ID asc", Conn);
SqlDataReader MyReader = MyCmd.ExecuteReader();
while (MyReader.Read())
{
TreeNode OrganizationNode = new TreeNode();
OrganizationNode.Text = MyReader["BuMenName"].ToString();
OrganizationNode.Value = MyReader["ID"].ToString();
int strId = int.Parse(MyReader["ID"].ToString());
OrganizationNode.ImageUrl = "~/images/user_group.gif";
OrganizationNode.SelectAction = TreeNodeSelectAction.Expand ;
string ChildID = ZWL.DBUtility.DbHelperSQL.GetSHSLInt("select top 1 ID from ERPBuMen where DirID=" + MyReader["ID"].ToString() + " order by ID asc");
if (ChildID.Trim() != "0")
{
//需要父项目一起选中,如果父项目不需要的话,请不要注释掉下面的行
//HaveChild = HaveChild + "|" + MyReader["BuMenName"].ToString() + "|";
}
OrganizationNode.ToolTip = MyReader["BuMenName"].ToString();
OrganizationNode.Expand();
Nds.Add(OrganizationNode);
//递归循环
BindTree(Nds[Nds.Count - 1].ChildNodes, strId);
}
MyReader.Close();
Conn.Close();
}
示例4: BindTree
private void BindTree()
{
//获取品牌
string brandcondition = "";
if (Request.QueryString["IsOpponent"] != null)
{
if (Request.QueryString["IsOpponent"] == "10")
brandcondition = "IsOpponent IN (1,9)";
else
brandcondition = "IsOpponent=" + Request.QueryString["IsOpponent"];
}
else
{
if ((int)Session["OwnerType"] == 2) brandcondition = "IsOpponent='1'";
}
IList<PDT_Brand> _brands = PDT_BrandBLL.GetModelList(brandcondition);
foreach (PDT_Brand brand in _brands)
{
TreeNode tn_brand = new TreeNode(brand.Name, brand.ID.ToString());
tr_Product.Nodes.Add(tn_brand);
string ConditionStr = "PDT_Product.State = 1 AND PDT_Product.ApproveFlag = 1 AND PDT_Product.Brand = " + brand.ID.ToString();
if ((int)Session["OwnerType"] == 2)
{
ConditionStr += " AND PDT_Product.OwnerType = 2 AND PDT_Product.OwnerClient =" + Session["OwnerClient"].ToString();
}
else if ((int)Session["OwnerType"] == 1)
{
ConditionStr += " AND PDT_Product.OwnerType IN (1, 2) ";
}
if (Request.QueryString["ExtCondition"] != null)
{
ConditionStr += " AND (" + Request.QueryString["ExtCondition"].Replace("\"", "").Replace('~', '\'') + ")";
}
IList<PDT_Product> _products = PDT_ProductBLL.GetModelList(ConditionStr);
foreach (PDT_Product product in _products)
{
TreeNode tn = new TreeNode();
tn.Text = product.FactoryCode + " " + product.FullName;
tn.Value = product.ID.ToString();
tn_brand.ChildNodes.Add(tn);
if (tn.Value == ViewState["ID"].ToString())
{
tn_brand.Expand();
tn.Select();
tbx_SelectedProductID.Text = tn.Value;
tbx_SelectedProductName.Text = tn.Text;
}
}
}
}
示例5: loadTree
private void loadTree()
{
if (TreeView1.Nodes.Count > 0)
TreeView1.Nodes.Remove(TreeView1.Nodes[0]);
/*
TreeNode blk = new TreeNode("<span style='font-weight:bold; font-size:14px;'>Salesman Relation Control</span>", "-1");
TreeView1.Nodes.Add(blk);*/
TreeNode root = new TreeNode("<span>Globel Account Manager<span>", "0");
root.ImageUrl = "images/worldLink.png";
TreeView1.Nodes.Add(root);
reloadSubTree(root,false);
root.Expand();
TreeView1.DataBind();
}
示例6: initMenu
private void initMenu()
{
LoginUser user = sessionHelper.AdminUser;
//快取載入
UserMenuFuncContainer userContainer = UserMenuFuncContainer.GetInstance();
if (user == null)
{
Response.Redirect(LOGIN_PAGE_MANAGER, false);
return;
}
user = userContainer.GetUser(user.UserId);
TreeveiwService tvService = new TreeveiwService();
MenuFuncDao menuFuncDao = new MenuFuncDao();
IList<MenuFunc> menuFuncList = authService.GetTopMenuFunc(user, userContainer.AllMenu, userContainer.RoleDic);
foreach (MenuFunc menu in menuFuncList)
{
TreeNode treeNode = new TreeNode(menu.MenuFuncName, null, "", string.Format("javascript:__doPostBack('ctl00$tvMenu','t{0}')", menu.MenuFuncName), "");
treeNode.Collapse();
if (menu.SubFuncs.Count > 0)
{
foreach (MenuFunc subMenu in menu.SubFuncs)
{
TreeNode subTreeNode = new TreeNode(subMenu.MenuFuncName, subMenu.MainPath);
//判斷使否選定
if (!string.IsNullOrEmpty(sessionHelper.FunctionName))
{
if (CollectionUtil.ContainValue(menu.SubFuncs, "MenuFuncName", sessionHelper.FunctionName))
{
treeNode.Expand();
}
}
treeNode.ChildNodes.Add(subTreeNode);
}
}
tvMenu.Nodes.Add(treeNode);
}
//object c = userContainer.AllMenu;
tvMenu.DataBind();
}
示例7: MainForm_Load
void MainForm_Load (object sender, EventArgs e)
{
TreeNode treeNode1 = new TreeNode ("Node1");
TreeNode treeNode0 = new TreeNode ("Node0", new TreeNode [] { treeNode1 });
_treeView.Nodes.Add (treeNode0);
treeNode0.Expand ();
TreeNode treeNode3 = new TreeNode ("Node3");
TreeNode treeNode2 = new TreeNode ("Node2", new TreeNode [] { treeNode3 });
_treeView.Nodes.Add (treeNode2);
TreeNode treeNode5 = new TreeNode ("Node5");
TreeNode treeNode4 = new TreeNode ("Node4", new TreeNode [] { treeNode5 });
_treeView.Nodes.Add (treeNode4);
InstructionsForm instructionsForm = new InstructionsForm ();
instructionsForm.Show ();
}
示例8: BindTree
private void BindTree()
{
//获取品牌
string condition = "";
if (Request.QueryString["IsOpponent"] != null)
condition = "IsOpponent=" + Request.QueryString["IsOpponent"];
IList<PDT_Brand> _brands = PDT_BrandBLL.GetModelList(condition);
foreach (PDT_Brand brand in _brands)
{
TreeNode tn_brand = new TreeNode(brand.Name, brand.ID.ToString());
tr_Product.Nodes.Add(tn_brand);
IList<PDT_Classify> _classifys = new PDT_ClassifyBLL()._GetModelList("PDT_Classify.Brand=" + brand.ID.ToString());
foreach (PDT_Classify classify in _classifys)
{
TreeNode tn_classify = new TreeNode(classify.Name, classify.ID.ToString());
tn_brand.ChildNodes.Add(tn_classify);
IList<PDT_Product> _products = new PDT_ProductBLL()._GetModelList("PDT_Product.State = 1 AND PDT_Product.Classify=" + classify.ID.ToString());
foreach (PDT_Product product in _products)
{
TreeNode tn = new TreeNode();
tn.Text = product.Code + " " + product.FullName;
tn.Value = product.Code;
tn_classify.ChildNodes.Add(tn);
if (tn.Value == ViewState["ERPCode"].ToString())
{
tn_classify.Expand();
tn.Select();
tbx_SelectedProductCode.Text = tn.Value;
tbx_SelectedProductName.Text = tn.Text;
}
}
}
}
}
示例9: CreateSklNode
private TreeNode CreateSklNode(EkJobDS.LocalizationSkeletonRow data)
{
// Special case: skeleton may be used as a placeholder to no skeletons
EkSklTypes itemType = (EkSklTypes)data.ItemType;
if (itemType == EkSklTypes.Information)
{
if (data.IsErrorMessageNull() || 0 == data.ErrorMessage.Length)
{
return this.CreateMsgNode(data.Title, MessageStyleType.Information);
}
else
{
return this.CreateMsgNode(data.ErrorMessage, MessageStyleType.ErrorMessage);
}
}
TreeNode node = new TreeNode();
StringBuilder sb = new StringBuilder();
string strToolTipForItemID = string.Empty;
node.Value = "skl" + data.SkeletonID;
node.PopulateOnDemand = true;
node.SelectAction = TreeNodeSelectAction.Expand;
switch (itemType)
{
case EkSklTypes.Content:
node.ImageUrl = GetCommonApi().AppPath + "images/UI/Icons/contentHtml.png";
node.ImageToolTip = GetMessage("lbl content");
strToolTipForItemID = GetMessage("generic content id");
break;
case EkSklTypes.Form:
node.ImageUrl = GetCommonApi().AppPath + "images/UI/Icons/contentForm.png";
node.ImageToolTip = GetMessage("form text");
strToolTipForItemID = GetMessage("alt form id");
break;
case EkSklTypes.SmartFormData:
node.ImageUrl = GetCommonApi().AppPath + "images/UI/Icons/FileTypes/xml.png";
node.ImageToolTip = GetMessage("lbl smart form");
strToolTipForItemID = GetMessage("generic id");
break;
case EkSklTypes.SmartFormDesign:
node.ImageUrl = GetCommonApi().AppPath + "images/UI/Icons/contentSmartForm.png";
node.ImageToolTip = GetMessage("generic xml configuration");
strToolTipForItemID = GetMessage("generic id");
break;
case EkSklTypes.Menu:
node.ImageUrl = GetCommonApi().AppPath + "images/UI/Icons/menu.png";
node.ImageToolTip = GetMessage("generic menu title");
strToolTipForItemID = GetMessage("alt menu number");
break;
case EkSklTypes.MenuItem:
node.ImageUrl = GetCommonApi().AppPath + "images/UI/Icons/menu.png";
node.ImageToolTip = GetMessage("alt menu items");
strToolTipForItemID = GetMessage("alt menu items number");
break;
case EkSklTypes.Taxonomy:
node.ImageUrl = GetCommonApi().AppPath + "images/UI/Icons/taxonomy.png";
node.ImageToolTip = GetMessage("generic taxonomy lbl");
strToolTipForItemID = GetMessage("alt taxonomy number");
break;
case EkSklTypes.Image:
node.ImageUrl = GetCommonApi().AppPath + "images/UI/Icons/FileTypes/image.png";
node.ImageToolTip = GetMessage("generic image");
strToolTipForItemID = GetMessage("generic id");
break;
case EkSklTypes.Audio:
node.ImageUrl = GetCommonApi().AppPath + "images/UI/Icons/FileTypes/audio.png";
node.ImageToolTip = GetMessage("lbl audio");
strToolTipForItemID = GetMessage("generic id");
break;
case EkSklTypes.Video:
node.ImageUrl = GetCommonApi().AppPath + "images/UI/Icons/FileTypes/video.png";
node.ImageToolTip = GetMessage("lbl video");
strToolTipForItemID = GetMessage("generic id");
break;
case EkSklTypes.PDF:
node.ImageUrl = GetCommonApi().AppPath + "images/UI/Icons/FileTypes/acrobat.png";
node.ImageToolTip = GetMessage("content:asset:pdf");
strToolTipForItemID = GetMessage("generic id");
break;
case EkSklTypes.MsWord:
node.ImageUrl = GetCommonApi().AppPath + "images/UI/Icons/FileTypes/word.png";
node.ImageToolTip = GetMessage("content:mso:doc");
strToolTipForItemID = GetMessage("generic id");
break;
case EkSklTypes.MsExcel:
node.ImageUrl = GetCommonApi().AppPath + "images/UI/Icons/FileTypes/excel.png";
node.ImageToolTip = GetMessage("content:mso:xls");
strToolTipForItemID = GetMessage("generic id");
break;
case EkSklTypes.MsPowerPoint:
node.ImageUrl = GetCommonApi().AppPath + "images/UI/Icons/FileTypes/powerpoint.png";
node.ImageToolTip = GetMessage("content:mso:ppt");
strToolTipForItemID = GetMessage("generic id");
break;
case EkSklTypes.MsPublisher:
node.ImageUrl = GetCommonApi().AppPath + "images/UI/Icons/FileTypes/publisher.png";
node.ImageToolTip = GetMessage("content:mso:pub");
strToolTipForItemID = GetMessage("generic id");
break;
//.........这里部分代码省略.........
示例10: btnAddSoftware_Click
private void btnAddSoftware_Click(object sender, EventArgs e)
{
if (TreeView1.SelectedNode == null | object.ReferenceEquals(TreeView1.SelectedNode, TreeView1.Nodes[0]))
{
MessageBox.Show("Programme können nur Gruppen hinzugefügt werden. Bitte wählen Sie eine Gruppe aus.");
return;
}
OpenFileDialog FileDialog = new OpenFileDialog();
FileDialog.Multiselect = true;
FileDialog.Filter = "msi files (*.msi)|*.msi|exe files (*.exe*)|*.exe*|All files (*.*)|*.*";
FileDialog.FilterIndex = 1;
FileDialog.RestoreDirectory = true;
//geben sie einen namen für paket an falls kein paket markiert ist!
if (FileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
if (FileDialog.SafeFileNames.Length == 0)
{
return;
}
TreeNode NewListMainItem = new TreeNode("Neuer Eintrag");
TreeView3.Nodes[0].Nodes.Add(NewListMainItem);
frmNewName NewName = new frmNewName();
NewName.ShowDialog();
if (!string.IsNullOrEmpty(NewGroupName))
{
NewListMainItem.Text = NewGroupName;
NewGroupName = "";
TreeView3.Nodes[0].Expand();
}
else
{
MessageBox.Show("Kein Softwarepaketname angegeben. Vorgang wird abgebrochen.");
return;
}
foreach (string File in FileDialog.SafeFileNames)
{
TreeNode NewListItem = new TreeNode(File);
NewListMainItem.Nodes.Add(NewListItem);
}
string[] FileArray = new string[FileDialog.FileNames.Length];
int counter = 0;
string archit = "32bit";
string Path = Server_Client.Properties.Settings.Default.SavePath + "Groups\\" + TreeView1.SelectedNode.Text + "\\";
Guid PacketGuid = Guid.NewGuid();
foreach (string File in FileDialog.FileNames)
{
//Assembly ExeAssembly = Assembly.LoadFile(File);
//System.Reflection.AssemblyName AssemblyAr = new System.Reflection.AssemblyName(ExeAssembly.FullName);
//if (archit != "" && archit != AssemblyAr.ProcessorArchitecture.ToString())
//{
// MessageBox.Show("Die Datei: " + File + " hat das falsche Format(" + AssemblyAr.ProcessorArchitecture.ToString() + "). Bitte erstellen Sie für 32/64 bit Programme einzelne Softwarepakete.");
// continue;
//}
//archit = AssemblyAr.ProcessorArchitecture.ToString();
clsZipFile.CreatePackage(Path + PacketGuid + ".zip", File);
FileArray[counter] = File;
counter++;
}
if (!Directory.Exists(Path))
{
Directory.CreateDirectory(Path);
}
NewListMainItem.Expand();
//Assembly assembly = Assembly.LoadFile(Path + PacketGuid + ".zip");
//System.Reflection.AssemblyName AssemblyName = new System.Reflection.AssemblyName(assembly.FullName);
FileInfo fileinfo_ = new FileInfo(Path + PacketGuid + ".zip");
PackageInfoModel CurrentPackage = new PackageInfoModel();
CurrentPackage.showName = NewListMainItem.Text;
CurrentPackage.Name = PacketGuid.ToString();
CurrentPackage.arc = archit;
CurrentPackage.size =Convert.ToInt32( fileinfo_.Length ) ;
CurrentPackage.group = Convert.ToInt32( TreeView1.SelectedNode.Tag);
request.addPackageInfo(client, CurrentPackage);
GroupInfoModel GroupModel = new GroupInfoModel();
GroupModel.ID = Convert.ToInt32( TreeView1.SelectedNode.Tag);
GroupModel.Name = TreeView1.SelectedNode.Text;
request.sendFile(client, GroupModel, CurrentPackage, Path + PacketGuid + ".zip");
}
//Füge Kopie der Datei hinzu und unten entfernen und client gui trayicon
//In Datenbank für diese Gruppe anlegen falls nicht exitstiert
//Pfad auf ServerClient dazu speichern
//msi gui
}
示例11: CreateJobNode
private TreeNode CreateJobNode(EkJobDS.LocalizationJobRow data)
{
TreeNode node = new TreeNode();
StringBuilder sb = new StringBuilder();
EkJobStates state = (EkJobStates)data.State;
EkJobTypes jobType = (EkJobTypes)data.JobType;
bool isJobComplete = EkJobDS.LocalizationJobRow.IsJobDone(state);
bool jobHasErrors = EkJobStates.CompleteWithErrors == state || EkJobStates.Canceled == state;
bool isJobRunning = !isJobComplete && !data.IsCurrentStepNull() && !data.IsTotalStepsNull() && data.CurrentStep <= data.TotalSteps;
node.Value = "job" + data.JobID;
node.PopulateOnDemand = true;
node.SelectAction = TreeNodeSelectAction.Expand;
sb.Append("<div class=\"L10nJob\">");
sb.Append("<div class=\"L10nJobTitle\">");
if (state == EkJobStates.CompleteWithErrors)
{
sb.Append(this.FormatErrorMessage(GetMessage("lbl complete with alerts")));
}
switch (jobType)
{
case EkJobTypes.CompressFiles:
sb.Append(GetMessage("lbl downloadable zip files"));
node.ImageUrl = GetCommonApi().AppPath + "images/UI/icons/FileTypes/zip.png";
node.ImageToolTip = GetMessage("alt zipped file");
if (!this.methodCreateJobNode_isFirstCompressFilesJobExpanded)
{
this.methodCreateJobNode_isFirstCompressFilesJobExpanded = true;
node.Expand();
}
break;
case EkJobTypes.Export:
sb.Append(string.Format(GetMessage("lbl exported locale taxonomy") + " \"{0}\"", data.JobTitle));
node.ImageUrl = GetCommonApi().AppPath + "images/UI/Icons/translationExport.png";
node.ImageToolTip = GetMessage("lbl exported locale taxonomy");
if (!this.methodCreateJobNode_isFirstExportJobExpanded)
{
this.methodCreateJobNode_isFirstExportJobExpanded = true;
node.Expand();
}
break;
case EkJobTypes.ExportContent:
sb.Append(string.Format(GetMessage("lbl exported content") + " \"{0}\"", data.JobTitle));
node.ImageUrl = GetCommonApi().AppPath + "images/UI/Icons/translationExport.png";
node.ImageToolTip = GetMessage("lbl exported content");
if (!this.methodCreateJobNode_isFirstExportJobExpanded)
{
this.methodCreateJobNode_isFirstExportJobExpanded = true;
node.Expand();
}
break;
case EkJobTypes.ExportFolder:
sb.Append(string.Format(GetMessage("lbl exported folder") + " \"{0}\"", data.JobTitle));
node.ImageUrl = GetCommonApi().AppPath + "images/UI/Icons/translationExport.png";
node.ImageToolTip = GetMessage("lbl exported folder");
if (!this.methodCreateJobNode_isFirstExportJobExpanded)
{
this.methodCreateJobNode_isFirstExportJobExpanded = true;
node.Expand();
}
break;
case EkJobTypes.ExportMenu:
sb.Append(GetMessage("lbl exported menus"));
node.ImageUrl = GetCommonApi().AppPath + "images/UI/Icons/translationExport.png";
node.ImageToolTip = GetMessage("lbl exported menus");
if (!this.methodCreateJobNode_isFirstExportJobExpanded)
{
this.methodCreateJobNode_isFirstExportJobExpanded = true;
node.Expand();
}
break;
case EkJobTypes.ExportTaxonomy:
sb.Append(GetMessage("lbl exported taxonomy"));
node.ImageUrl = GetCommonApi().AppPath + "images/UI/Icons/translationExport.png";
node.ImageToolTip = GetMessage("lbl exported taxonomy");
if (!this.methodCreateJobNode_isFirstExportJobExpanded)
{
this.methodCreateJobNode_isFirstExportJobExpanded = true;
node.Expand();
}
break;
case EkJobTypes.ExtractText:
sb.Append(GetMessage("lbl extracted"));
if (!data.IsJobTitleNull() && data.JobTitle.Length > 0)
{
sb.Append(" " + data.JobTitle);
}
node.ImageUrl = GetCommonApi().AppPath + "images/UI/Icons/translationExport.png";
node.ImageToolTip = GetMessage("lbl extracted");
break;
//.........这里部分代码省略.........
示例12: treeElem_OnNodeCreated
protected TreeNode treeElem_OnNodeCreated(DataRow itemData, TreeNode defaultNode)
{
defaultNode.Selected = false;
if (itemData != null)
{
CategoryInfo category = new CategoryInfo(itemData);
string caption = category.CategoryDisplayName;
if (String.IsNullOrEmpty(caption))
{
caption = category.CategoryName;
}
caption = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(caption));
if (category.IsGlobal && !category.CategoryIsPersonal)
{
caption += " <sup>" + GetString("general.global") + "</sup>";
}
// Set caption
defaultNode.Text = defaultNode.Text.Replace("##NODECUSTOMNAME##", caption);
defaultNode.Text = defaultNode.Text.Replace("##NODECODENAME##", HTMLHelper.HTMLEncode(category.CategoryName));
defaultNode.Text = defaultNode.Text.Replace("##PARENTID##", category.CategoryParentID.ToString());
string onclick = "";
string checkBox = "";
bool catHasCheckedChildren = ValidationHelper.GetInteger(itemData["ChildChecked"], 0) > 0;
if (AllowMultipleSelection)
{
// Prepare checbox when in multiple selection mode
checkBox = string.Format("<span class=\"checkbox tree-checkbox\"><input id=\"chk{0}\" type=\"checkbox\" onclick=\"ProcessItem(this,'{1}',false,true);\" class=\"chckbox\" ", category.CategoryID, ValidationHelper.GetHashString(category.CategoryID.ToString()));
if (catHasCheckedChildren || (hidItem.Value.IndexOfCSafe(ValuesSeparator + category.CategoryID + ValuesSeparator, true) >= 0))
{
checkBox += "checked=\"checked\" ";
}
if (catHasCheckedChildren)
{
checkBox += "disabled=\"disabled\" ";
}
checkBox += "name=\"" + category.CategoryID + "_" + category.CategoryParentID + "\"";
checkBox += string.Format("/><label for=\"chk{0}\"> </label>", category.CategoryID);
}
else
{
if (returnColumnName == "CategoryID")
{
onclick = "ItemsElem().value = '" + ValuesSeparator + category.CategoryID + ValuesSeparator + "';";
}
else
{
onclick = "ItemsElem().value = '" + ValuesSeparator + ScriptHelper.GetString(category.CategoryName, false) + ValuesSeparator + "';";
}
}
defaultNode.Text = defaultNode.Text.Replace("##ONCLICK##", onclick);
defaultNode.Text = checkBox + defaultNode.Text + "</span>";
// Expand selected categories
if (catHasCheckedChildren && !URLHelper.IsPostback())
{
defaultNode.Expand();
}
return defaultNode;
}
return null;
}
示例13: btnAddExistingPacket_Click
private void btnAddExistingPacket_Click(object sender, EventArgs e)
{
if (TreeView1.SelectedNode == null | object.ReferenceEquals(TreeView1.SelectedNode, TreeView1.Nodes[0]))
{
MessageBox.Show("Programme können nur Gruppen hinzugefügt werden. Bitte wählen Sie eine Gruppe aus.");
return;
}
OpenFileDialog FileDialog = new OpenFileDialog();
FileDialog.Multiselect = true;
FileDialog.Filter = "zip (*.zip)|*.zip";
FileDialog.FilterIndex = 1;
FileDialog.InitialDirectory = Server_Client.Properties.Settings.Default.SavePath + "Groups\\";
FileDialog.RestoreDirectory = true;
//geben sie einen namen für paket an falls kein paket markiert ist!
if (FileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
if (FileDialog.SafeFileNames.Length == 0)
{
return;
}
for (int i = 0; i < FileDialog.FileNames.Length; i++)
{
Guid PacketGuid = Guid.NewGuid();
string Path = Server_Client.Properties.Settings.Default.SavePath + "Groups\\" + TreeView1.SelectedNode.Text + "\\" + PacketGuid + ".zip";
System.IO.File.Copy(FileDialog.FileNames[i], Path);
frmNewName NewName = new frmNewName();
NewName.ShowDialog();
//Hier Datenbankabfrage der Gruppen auf Gruppe mit ID (Diesen Namen nehmen)
TreeNode NewPacketNode = new TreeNode();
if (!string.IsNullOrEmpty(NewGroupName))
{
NewPacketNode.Text = NewGroupName;
NewGroupName = "";
TreeView3.Nodes[0].Nodes.Add(NewPacketNode);
TreeView3.Nodes[0].Expand();
}
else
{
MessageBox.Show("Kein Softwarepaketname angegeben. Vorgang wird abgebrochen.");
return;
}
clsZipFile.Unzip(FileDialog.FileNames[i].ToString(), Server_Client.Properties.Settings.Default.SavePath + "Groups\\" + TreeView1.SelectedNode.Text + "\\Temp\\");
string[] FileArr= System.IO.Directory.GetFiles(Server_Client.Properties.Settings.Default.SavePath + "Groups\\" + TreeView1.SelectedNode.Text + "\\Temp\\");
for (int d = 0; d < FileArr.Length; d++)
{
System.IO.DirectoryInfo oDir = new System.IO.DirectoryInfo(FileArr[0]);
NewPacketNode.Nodes.Add(oDir.Name);
System.IO.File.Delete(oDir.FullName);
}
System.IO.File.Copy(FileDialog.FileNames[i].ToString(), Server_Client.Properties.Settings.Default.SavePath + "Groups\\" + TreeView1.SelectedNode.Text + "\\" + NewPacketNode.Text);
string CurrentName = FileDialog.SafeFileName[i].ToString().Replace(".zip", "");
List<PackageInfoModel> AllPackages = request.getDatabasePackages(client);
PackageInfoModel CurrentPackage = new PackageInfoModel();
CurrentPackage.Name = PacketGuid.ToString();
CurrentPackage.group = Convert.ToInt32(TreeView1.SelectedNode.Tag);
foreach (PackageInfoModel Package in AllPackages)
{
if (Package.Name == CurrentName)
{
CurrentPackage.showName = Package.showName;
CurrentPackage.arc = Package.arc;
CurrentPackage.size = Package.size;
break;
}
}
request.addPackageInfo(client, CurrentPackage);
GroupInfoModel GroupModel = new GroupInfoModel();
GroupModel.ID = Convert.ToInt32(TreeView1.SelectedNode.Tag);
GroupModel.Name = TreeView1.SelectedNode.Text;
request.sendFile(client, GroupModel, CurrentPackage, Path + PacketGuid + ".zip");
NewPacketNode.Expand();
}
TreeView3.Nodes[0].Expand();
}
}
示例14: AddChildren
private void AddChildren(TreeNode node)
{
TreeListViewItem tlvitem = (TreeListViewItem) node.Tag;
foreach(TreeListViewItem item in tlvitem.Items)
{
TreeNode child = new TreeNode(item.Text);
child.Tag = item;
node.Nodes.Add(child);
AddChildren(child);
child.Expand();
}
}
示例15: LoadFromSQL
private void LoadFromSQL()
{
try
{
Runtime.IsConnectionsFileLoaded = false;
if (_SQLUsername != "")
{
sqlCon =
new SqlConnection(
(string)
("Data Source=" + _SQLHost + ";Initial Catalog=" + _SQLDatabaseName + ";User Id=" +
_SQLUsername + ";Password=" + _SQLPassword));
}
else
{
sqlCon =
new SqlConnection("Data Source=" + _SQLHost + ";Initial Catalog=" + _SQLDatabaseName +
";Integrated Security=True");
}
sqlCon.Open();
sqlQuery = new SqlCommand("SELECT * FROM tblRoot", sqlCon);
sqlRd = sqlQuery.ExecuteReader(CommandBehavior.CloseConnection);
sqlRd.Read();
if (sqlRd.HasRows == false)
{
Runtime.SaveConnections();
sqlQuery = new SqlCommand("SELECT * FROM tblRoot", sqlCon);
sqlRd = sqlQuery.ExecuteReader(CommandBehavior.CloseConnection);
sqlRd.Read();
}
this.confVersion = Convert.ToDouble(sqlRd["confVersion"], CultureInfo.InvariantCulture);
TreeNode rootNode;
rootNode = new TreeNode((string)(sqlRd["Name"]));
Root.Info rInfo = new Root.Info(Root.Info.RootType.Connection);
rInfo.Name = rootNode.Text;
rInfo.TreeNode = rootNode;
rootNode.Tag = rInfo;
rootNode.ImageIndex = System.Convert.ToInt32(Images.Enums.TreeImage.Root);
rootNode.SelectedImageIndex = System.Convert.ToInt32(Images.Enums.TreeImage.Root);
if (Security.Crypt.Decrypt((string)(sqlRd["Protected"]), pW) != "ThisIsNotProtected")
{
if (Authenticate((string)(sqlRd["Protected"]), false, rInfo) == false)
{
Settings.Default.LoadConsFromCustomLocation = false;
Settings.Default.CustomConsPath = "";
rootNode.Remove();
return;
}
}
//Me._RootTreeNode.Text = rootNode.Text
//Me._RootTreeNode.Tag = rootNode.Tag
//Me._RootTreeNode.ImageIndex = Images.Enums.TreeImage.Root
//Me._RootTreeNode.SelectedImageIndex = Images.Enums.TreeImage.Root
sqlRd.Close();
// SECTION 3. Populate the TreeView with the DOM nodes.
AddNodesFromSQL(rootNode);
//AddNodeFromXml(xDom.DocumentElement, Me._RootTreeNode)
rootNode.Expand();
//expand containers
foreach (Container.Info contI in this._ContainerList)
{
if (contI.IsExpanded == true)
{
contI.TreeNode.Expand();
}
}
//open connections from last mremote session
if (Settings.Default.OpenConsFromLastSession == true && Settings.Default.NoReconnect == false)
{
foreach (Connection.Info conI in this._ConnectionList)
{
if (conI.PleaseConnect == true)
{
Runtime.OpenConnection(conI);
}
}
}
//Tree.Node.TreeView.Nodes.Clear()
//Tree.Node.TreeView.Nodes.Add(rootNode)
AddNodeToTree(rootNode);
//.........这里部分代码省略.........