Exemple #1
0
        /// <summary>
        /// 从外部导入,需要复制参数文件。直接保存到工程文件和操作流文件。
        /// </summary>
        /// <param name="inportGofPath"></param>
        /// <returns></returns>
        public StatedMessage ImportGofFile(string inportGofPath)
        {
            var           workflow = this.Workflow;
            OperationFlow operFlow = OperationFlow.ReadFromFile(inportGofPath);

            if (workflow.Contains(operFlow))
            {
                var msg = StatedMessage.Faild;
                msg.Message = "已经具有该工作流,不用导入";
                return(msg);
            }

            //不在工程目录内,
            if (!IsInProjectDirectory(inportGofPath))
            {
                //保存操作流到当前工程工作流
                operFlow.SaveToDirectory(this.ScriptDirectory);


                //检查参数文件,全部复制到 ParamDirectory 中
                CopyParamFileToCurrentProject(inportGofPath, operFlow);
            }
            //在目录内,直接添加
            //添加到当前工作流
            if (AddOperationFlow(operFlow))
            {
                return(StatedMessage.Ok);
            }

            return(StatedMessage.Ok);
        }
Exemple #2
0
        private void AddNew()
        {
            string filePath = null;

            if (Geo.Utils.FormUtil.ShowInputForm("请输入操作流文件名称", "NewOperationName", out filePath))
            {
                if (!filePath.ToLower().Contains(".gof"))
                {
                    filePath = filePath + ".gof";
                }

                var ScriptDirectory = Setting.GnsserConfig.CurrentProject.ScriptDirectory;

                var path = Path.Combine(ScriptDirectory, filePath);
                if (File.Exists(path))
                {
                    if (Geo.Utils.FormUtil.ShowYesNoMessageBox("文件已经存在,是否覆盖?" + path) != DialogResult.Yes)
                    {
                        return;
                    }
                }
                if (Entity.Contains(path))
                {
                    MessageBox.Show("当前工程已经包含该工作流文件!" + path);
                    return;
                }

                OperationFlow flow = new OperationFlow()
                {
                    FileName = filePath
                };
                flow.SaveToDirectory(ScriptDirectory);

                this.Entity.Add(flow);
                EntityToUi();
                IsChangeSaved = false;

                SaveChanges();
            }
        }