예제 #1
0
// <Snippet2>
// <Snippet3>
// <Snippet4>
// <Snippet5>
// <Snippet6>
    public static void DisplayOperationFlowDescription(
        OperationFlow myOperationFlow)
    {
        switch (myOperationFlow)
        {
        case OperationFlow.None:
            Console.WriteLine("Indicates that the endpoint or service " +
                              "receives no transmissions (None).");
            break;

        case OperationFlow.OneWay:
            Console.WriteLine("Indicates that the endpoint or service " +
                              "receives a message (OneWay).");
            break;

        case OperationFlow.Notification:
            Console.WriteLine("Indicates that the endpoint or service " +
                              "sends a message (Notification).");
            break;

        case OperationFlow.SolicitResponse:
            Console.WriteLine("Indicates that the endpoint or service " +
                              "sends a message, then receives a " +
                              "correlated message (SolicitResponse).");
            break;

        case OperationFlow.RequestResponse:
            Console.WriteLine("Indicates that the endpoint or service " +
                              "receives a message, then sends a " +
                              "correlated message (RequestResponse).");
            break;
        }
    }
예제 #2
0
        /// <summary>
        /// GOF文件直接初始化
        /// </summary>
        /// <param name="flow"></param>
        public GofTask(OperationFlow flow)
        {
            this.Name           = flow.FileName;
            this.OperationInfos = flow.Data;

            this.Params = new Dictionary <string, string>();
            foreach (var item in OperationInfos)
            {
                var paramName = Path.GetFileName(item.ParamFilePath);
                Params[paramName] = File.ReadAllText(item.ParamFilePath);
            }
        }
예제 #3
0
        /// <summary>
        /// 添加到当前工作流,同时保存到文件
        /// </summary>
        /// <param name="operFlow"></param>
        /// <returns></returns>
        public bool AddOperationFlow(OperationFlow operFlow)
        {
            var workflow = this.Workflow;

            if (!workflow.Contains(operFlow))
            {
                workflow.Add(operFlow);
                this.Workflow = workflow;

                this.SaveToFile(this.ProjectFilePath);
                return(true);
            }
            return(false);
        }
예제 #4
0
        /// <summary>
        /// 修改操作流的名称,并重命名操作流文件。
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="name"></param>
        /// <param name="overwrite"></param>
        public void RenameOperationFlow(OperationFlow obj, string name, bool overwrite = true)
        {
            var oldPath = this.GetAbsPath(obj.FileName);
            var newPath = this.GetAbsPath(name);

            obj.FileName = name;
            if (File.Exists(oldPath))
            {
                if (overwrite && File.Exists(newPath))
                {
                    File.Delete(newPath);
                }
                File.Move(oldPath, newPath);
            }
        }
예제 #5
0
        private void 导入OToolStripButton_Click(object sender, EventArgs e)
        {
            var absPath = Geo.Utils.FormUtil.ShowFormGetFilePath("操作文件|*.gof");

            if (absPath == null)
            {
                return;
            }
            OperationFlow operFlow = OperationFlow.ReadFromFile(absPath);
            var           task     = new GofTask(operFlow);

            this.mgr.Add(task);
            this.mgr.Save();
            //  tasks.Add(task);
            this.bindingSource_task.Add(task);
        }
예제 #6
0
        /// <summary>
        /// 检查参数文件,全部复制到 ParamDirectory 中
        /// </summary>
        /// <param name="oldOperFlowPath"></param>
        /// <param name="operFlow"></param>
        private void CopyParamFileToCurrentProject(string oldOperFlowPath, OperationFlow operFlow)
        {
            var newGofFolder = Path.GetDirectoryName(Geo.Utils.PathUtil.GetAbsPath(operFlow.FileName, this.ProjectDirectory));

            var oldGofFolder = Path.GetDirectoryName(oldOperFlowPath);

            foreach (var item in operFlow)
            {
                var oldParamAbsPath = Geo.Utils.PathUtil.GetAbsPath(item.ParamFilePath, oldGofFolder);
                if (File.Exists(oldParamAbsPath))
                {
                    var newParamPath = Geo.Utils.PathUtil.GetAbsPath(item.ParamFilePath, newGofFolder);

                    File.Copy(oldParamAbsPath, newParamPath, true);
                }
            }
        }
예제 #7
0
 public void OnCurrentGofChanged(OperationFlow current)
 {
     if (CurrentGofChanged != null)
     {
         //try
         //{
         CurrentGofChanged(current);
         //}
         //catch (Exception ex)
         //{
         //    if (Geo.Utils.FormUtil.ShowYesNoMessageBox("解析工作流文件遇到问题,是否移除?" + ex.Message) == DialogResult.Yes)
         //    {
         //        this.bindingSource_dataview.Remove(bindingSource_dataview.Current);
         //        this.Entity.Remove(current);
         //    }
         //}
     }
 }
예제 #8
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();
            }
        }
예제 #9
0
 protected override bool IsOperationFlowSupported(OperationFlow flow)
 {
     throw new NotImplementedException();
 }
예제 #10
0
 protected override bool IsOperationFlowSupported(OperationFlow flow)
 {
     return(flow == OperationFlow.RequestResponse);
 }
예제 #11
0
 protected abstract bool IsOperationFlowSupported(OperationFlow flow);
		protected override bool IsOperationFlowSupported (OperationFlow flow)
		{
			throw new NotImplementedException ();
		}
 /// <include file='doc\ProtocolImporter.uex' path='docs/doc[@for="ProtocolImporter.IsOperationFlowSupported"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 protected abstract bool IsOperationFlowSupported(OperationFlow flow);
 protected override bool IsOperationFlowSupported(OperationFlow flow) {
     return flow == OperationFlow.RequestResponse;
 }
 protected override bool IsOperationFlowSupported(OperationFlow flow)
 {
     if (flow != OperationFlow.OneWay)
     {
         return (flow == OperationFlow.RequestResponse);
     }
     return true;
 }