/// <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 + "\"不存在"); } }
private void comboBoxWeightSort_SelectedIndexChanged(object sender, EventArgs e) { int nwsort = comboBoxWeightSort.SelectedIndex; if (nwsort == -1) { return; } List <WeightSortData> wsDataList = WeightSortManageForm.GetListWeightSortData(); WeightSortEditForm.BindTreeList(treeViewWeightSortNode, wsDataList[nwsort]); List <TreeNode> FinalNodes = new List <TreeNode>(); foreach (TreeNode node in treeViewWeightSortNode.Nodes) { GetFinalNodeList(node, ref FinalNodes); } if (strType == "jynew") { waData.FormulaList.RemoveRange(mapCandidateFormula.Count, waData.FormulaList.Count - mapCandidateFormula.Count); foreach (KeyValuePair <WeightFormula, string> wfpair in mapCandidateFormula) { wfpair.Key.nAttach = 0; foreach (TreeNode node in FinalNodes) { if (node.Name == wfpair.Value) { wfpair.Key.nAttach = 1; node.Tag = wfpair.Key; break; } } } listBoxCandidateFormula.Items.Clear(); foreach (KeyValuePair <WeightFormula, string> wfpair in mapCandidateFormula) { if (wfpair.Key.nAttach == 0) { listBoxCandidateFormula.Items.Add(wfpair.Value); } } } else if (waData.FormulaList.Count > 0) { foreach (WeightFormula wf in waData.FormulaList) { wf.nAttach = 0; foreach (TreeNode node in FinalNodes) { if (node.Name == wf.NodePath) { wf.nAttach = 1; node.Tag = wf; break; } } } } foreach (TreeNode node in FinalNodes) { if (node.Tag == null) { WeightFormula wf = new WeightFormula(); wf.NodePath = node.Name; wf.nAttach = 1; node.Tag = wf; waData.FormulaList.Add(wf); } } treeViewWeightSortNode.ExpandAll(); SetEditMode(1); textBoxFormula.Text = ""; textBoxFormula.Modified = false; buttonEdit.Enabled = false; buttonSelect.Enabled = false; listViewPara.Items.Clear(); }
/// <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 + "\"不存在"); } }
/// <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 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 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(); }