Esempio n. 1
0
        /// <summary>
        /// 创建绘图
        /// </summary>
        /// <param name="flowChartManager">绘图管理器</param>
        /// <param name="logicData">逻辑数据</param>
        /// <returns>是否操作成功</returns>
        protected virtual bool LogicCreateChart(FlowChartManager flowChartManager, object logicData)
        {
            DataBaseManager dataBaseManager = DataBaseManager.GetDataBaseManager();
            DocumentManager documentManager = DocumentManager.GetDocumentManager();
            TreeView tree = logicData as TreeView;
            TreeNode currentNode = tree.SelectedNode;

            InputForm iForm = new InputForm("请输入新建绘图的名称", "新建绘图");

            if (iForm.ShowDialog() == DialogResult.OK)
            {
                TreeNode newNode = currentNode.Nodes.Add(iForm.InputText);
                newNode.ImageIndex = 1;
                newNode.SelectedImageIndex = 1;
                tree.SelectedNode = newNode;
                documentManager.CurrentTreeMode = EditMode.Normal;

                // 对数据库进行操作
                string path = documentManager.GetNodePath(newNode);
                string id = dataBaseManager.CreateNewDiagram(path, false, documentManager.CurrentChartMode);
                newNode.Tag = id;
            }

            return true;
        }
Esempio n. 2
0
        /// <summary>
        /// 保存绘图
        /// </summary>
        /// <param name="flowChartManager">绘图管理器</param>
        /// <param name="logicData">逻辑数据</param>
        /// <returns>是否操作成功</returns>
        protected override bool LogicSave(FlowChartManager flowChartManager, object logicData)
        {
            if (flowChartManager.CurrentPath.StartsWith("子绘图"))
            {
                string description = flowChartManager.CustomData["description"] as string;

                if (string.IsNullOrEmpty(description))
                {
                    description = flowChartManager.Name;
                }

                InputForm inputForm = new InputForm("请输入子绘图的描述", description);

                if (inputForm.ShowDialog() == DialogResult.OK)
                {
                    description = inputForm.InputText;
                    flowChartManager.CustomData["description"] = description;
                }
            }

            return true;
        }