/// <summary> /// 新建事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnNew_Click(object sender, EventArgs e) { WeightSortEditForm form = new WeightSortEditForm(this, "new"); if (form.ShowDialog() == DialogResult.OK) { RefreshTreeViewData(); } }
/// <summary> /// 编辑事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnEdit_Click(object sender, EventArgs e) { weightSort = selNode.Tag as WeightSortData; if (weightSort == null) { return; } string[] files = System.IO.Directory.GetFiles(strPath + "weightCategory" + "\\" + selNode.Name, "*.WEM"); string strtype = (files.Length > 0) ? "readOnlyEdit" : "edit"; WeightSortEditForm form = new WeightSortEditForm(this, weightSort, strtype); form.ShowDialog(); }
/// <summary> /// 基于新建 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnJYNew_Click(object sender, EventArgs e) { if (selNode == null || selNode.Level == 0) { XCommon.XLog.Write("请选择重量分类"); return; } weightSort = selNode.Tag as WeightSortData; if (weightSort == null) { return; } WeightSortEditForm form = new WeightSortEditForm(this, weightSort, "JYNew"); if (form.ShowDialog() == DialogResult.OK) { RefreshTreeViewData(); } }
/// <summary> /// 双击节点事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void treeViewWeightSort_MouseDoubleClick(object sender, MouseEventArgs e) { weightSort = selNode.Tag as WeightSortData; if (weightSort == null) { return; } string strFolderPath = strPath + "weightCategory" + "\\" + selNode.Name; if (Directory.Exists(strFolderPath)) { string[] files = System.IO.Directory.GetFiles(strFolderPath, "*.WEM"); string strtype = (files.Length > 0) ? "readOnlyEdit" : "edit"; WeightSortEditForm form = new WeightSortEditForm(this, weightSort, strtype); form.ShowDialog(); } else { XLog.Write("文件\"" + strFolderPath + "\"不存在"); } }