private void InitUserControlTree() { var tmpNode1 = new BaseUserControlTreeNode { NodeType = "#0", Text = @"表单管理", ImageIndex = 0, SelectedImageIndex = 0 }; tvUserControl.Nodes.Add(tmpNode1); var tmpNode01 = new UserControlNode { NodeType = WorkConst.UserControl_Child + "#", Text = @"子表单管理", ImageIndex = 1, SelectedImageIndex = 1 }; tmpNode1.Nodes.Add(tmpNode01); var tmpNode02 = new MainUserControlNode { NodeType = WorkConst.UserControl_Main + "#", Text = @"主表单管理", ImageIndex = 2, SelectedImageIndex = 2 }; tmpNode1.Nodes.Add(tmpNode02); tvUserControl.ExpandAll(); }
private void btnSave_Click(object sender, EventArgs e) { if (CheckData()) { var ucType = "1"; if (rbType1.Checked) { ucType = "1"; } if (rbType2.Checked) { ucType = "2"; } if (rbType3.Checked) { ucType = "3"; } var c = new UserControlNode { NodeId = BusinessLogic.NewGuid(), Text = txtFullName.Text, UserCtrlPath = txtPath.Text, Description = txtDescription.Text, ControlId = txtControlId.Text, FormName = txtFormName.Text, AssemblyName = txtAssemblyName.Text, Type = ucType }; c.InsertUserControlNode(); this.Close(); } }
/// <summary> /// 加载所以子表单列表 /// </summary> /// <param name="startNodes"></param> public static void LoadAllUserControlsNode(TreeNodeCollection startNodes) { if (startNodes == null) { throw new Exception("LoadAllUserControlsNode的参数startNotes不能为空!"); } var table = RDIFrameworkService.Instance.WorkFlowUserControlService.GetAllChildUserControls(SystemInfo.UserInfo); startNodes.Clear(); foreach (DataRow row in table.Rows) { var tmpNode = new UserControlNode { NodeId = BusinessLogic.ConvertToString(row[UserControlsTable.FieldId]) ?? "", ImageIndex = 1, SelectedImageIndex = 3, ToolTipText = "子表单", Text = BusinessLogic.ConvertToString(row[UserControlsTable.FieldFullName]) ?? "", UserCtrlPath = BusinessLogic.ConvertToString(row[UserControlsTable.FieldPath]) ?? "", Description = BusinessLogic.ConvertToString(row[UserControlsTable.FieldDescription]) ?? "", NodeType = WorkConst.WORKFLOW_FLOW, ControlId = BusinessLogic.ConvertToString(row[UserControlsTable.FieldControlId]) ?? "", FormName = BusinessLogic.ConvertToString(row[UserControlsTable.FieldFormName]) ?? "", AssemblyName = BusinessLogic.ConvertToString(row[UserControlsTable.FieldAssemblyName]) ?? "", Type = BusinessLogic.ConvertToString(row[UserControlsTable.FieldType]) ?? "" }; startNodes.Add(tmpNode); } }
private void delucToolStripMenuItem_Click(object sender, EventArgs e) { if (MessageBoxHelper.Show("是否删除子表单[" + NowNode.Text + "]?删除后不能回复。") == DialogResult.Yes) { UserControlNode.DeleteUserControl(NowNode.NodeId); NowNode.Remove(); } }
/// <summary> /// 初始化树和listview表头信息 /// </summary> /// <param name="typeClient"></param> /// <param name="iKey"></param> private void InitListView(string typeClient, string iKey) { lvClient.Clear(); lvClient.ContextMenuStrip = null; lvClient.View = View.Details; switch (typeClient) { case "#0": //显示子表单和主表单 { lvClient.Columns.Add("名称", 100, HorizontalAlignment.Left); lvClient.Columns.Add("描述", 200, HorizontalAlignment.Left); LvShowType(); tvUserControl.ContextMenuStrip = null; break; } case WorkConst.UserControl_Child + "#": //子表单 { UserControlNode.LoadAllUserControlsNode(tvUserControl.SelectedNode.Nodes); lvClient.Columns.Add("子表单", 150, HorizontalAlignment.Left); lvClient.Columns.Add("子表单Id", 0, HorizontalAlignment.Left); lvClient.Columns.Add("位置", 300, HorizontalAlignment.Left); lvClient.Columns.Add("表单名称", 300, HorizontalAlignment.Left); lvClient.Columns.Add("所在程序集", 270, HorizontalAlignment.Left); lvClient.Columns.Add("描述", 200, HorizontalAlignment.Left); LvShowUserControl(); tvUserControl.ContextMenuStrip = cmUserControl; break; } case WorkConst.UserControl_Child: { tvUserControl.ContextMenuStrip = cmUserControl; break; } case WorkConst.UserControl_Main + "#": //主表单管理 { MainUserControlNode.LoadAllMainUserControls(tvUserControl.SelectedNode.Nodes); lvClient.Columns.Add("主表单", 200, HorizontalAlignment.Left); lvClient.Columns.Add("主表单Id", 0, HorizontalAlignment.Left); lvClient.Columns.Add("描述", 200, HorizontalAlignment.Left); LvShowMainUserControl(); tvUserControl.ContextMenuStrip = cmMainUserControl; break; } case WorkConst.UserControl_Main: { tvUserControl.ContextMenuStrip = cmMainUserControl; break; } } }
private void lvDelUctoolStripMenuItem3_Click(object sender, EventArgs e) { if (this.lvClient.SelectedItems.Count <= 0) { return; } var key = lvClient.SelectedItems[0].SubItems[1].Text; if (MessageBoxHelper.Show("是否删除子表单[" + lvClient.SelectedItems[0].Text + "]?删除后不能回复。") == DialogResult.Yes) { UserControlNode.DeleteUserControl(key); lvClient.Items.Remove(lvClient.SelectedItems[0]); } }