You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.2 KiB
C#

1 month ago
using DevExpress.XtraTreeList.Nodes;
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace WellWorkDataUI
{
public partial class FrmSaveFileToWorkArea : Form
{
public string targetNodePath;
public TreeListNode selectTreeNode;
public class CDirNodeInfo //要想绑定控件,必须使用属性
{
public string nodePath { get; set; }
public TreeListNode treeNode { get; set; }
public int id { get; set; }
}
public List<CDirNodeInfo> nodeInfoList = new List<CDirNodeInfo>();
public string fileName;
public FrmSaveFileToWorkArea()
{
InitializeComponent();
targetNodePath = "";
fileName = "";
// var nodesData = xmlDoc.Descendants("folder");
//foreach( var foldNod in nodesData)
//{
// CDirNodeInfo tnodeInfo = new CDirNodeInfo();
// tnodeInfo.nodePath =
//}
}
private void FrmSaveFileToWorkArea_Load(object sender, EventArgs e)
{
}
private void btnOk_Click(object sender, EventArgs e)
{
if (this.nodeCbx.SelectedItem is CDirNodeInfo tInfo)
{
targetNodePath = this.nodeCbx.Text;
selectTreeNode = tInfo.treeNode;
}
fileName = textBoxFileName.Text;
if (fileName == "")
{
MessageBox.Show("文件名称不能为空");
return;
}
}
private void FrmSaveFileToWorkArea_Shown(object sender, EventArgs e)
{
try
{
if (nodeInfoList.Count > 0)
{
this.nodeCbx.DataSource = nodeInfoList;
this.nodeCbx.DisplayMember = "nodePath";
this.nodeCbx.ValueMember = "treeNode";
if (nodeInfoList.Count > 0)
this.nodeCbx.SelectedIndex = 0;
}
textBoxFileName.Text = fileName;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}