Пример #1
0
        /// <summary>
        /// 设置选中的Part,加载其属性
        /// </summary>
        /// <param name="element"></param>
        public void SetSelectPartAsCurrent(UIElement element)
        {
            var node = Part.FindAncestor <Node>(element);

            if (node != null)
            {
                var data = node.Data as ActivityNode;

                //将当前元素设为选择元素
                node.Diagram.SelectedPart = node;

                //属性设计器加载当前元素属性
                WebMethod.LoadProperty(WorkflowUtils.CLIENTSCRIPT_PARAM_ACTIVITY,
                                       node.Diagram.Tag.ToString(),
                                       WorkflowUtils.ExtractActivityInfoJson(data));

                return;
            }

            var link = Part.FindAncestor <Link>(element);

            if (link != null)
            {
                var data = link.Data as ActivityLink;
                link.Diagram.SelectedPart = link;
                WebMethod.LoadProperty(WorkflowUtils.CLIENTSCRIPT_PARAM_TRANSITION,
                                       link.Diagram.Tag.ToString(),
                                       WorkflowUtils.ExtractTransitionInfoJson(data));
            }
        }
Пример #2
0
        protected override bool DoAcceptText()
        {
            //先保留一个编辑元素的对象引用
            var part = this.AdornedPart.Data;
            //完成text编辑
            bool result = base.DoAcceptText();

            //将编辑后的元素更新到property grid控件
            var node = part as ActivityNode;

            if (node != null)
            {
                _webMethod.UpdateProcess(WorkflowUtils.CLIENTSCRIPT_PARAM_ACTIVITY,
                                         this.Diagram.Tag.ToString(), node.Key,
                                         WorkflowUtils.ExtractActivityInfoJson(node));
                return(result);
            }

            var link = part as ActivityLink;

            if (link != null)
            {
                _webMethod.UpdateProcess(WorkflowUtils.CLIENTSCRIPT_PARAM_TRANSITION,
                                         this.Diagram.Tag.ToString(), link.Key,
                                         WorkflowUtils.ExtractTransitionInfoJson(link));
            }

            return(result);
        }
Пример #3
0
        protected override void OnLinkAdded(Link link)
        {
            bool selfLink = false;

            if (link.FromNode == link.ToNode)
            {
                selfLink            = true;
                link.Route.FromSpot = Spot.MiddleLeft;
                link.Route.ToSpot   = Spot.MiddleTop;
            }

            base.OnLinkAdded(link);

            var data = link.Data as ActivityLink;

            if (data == null)
            {
                return;
            }

            if (IsOverviewDiagram(link))
            {
                return;
            }

            if (string.IsNullOrEmpty(data.Key))
            {
                data.Key       = CreateTransitionKey();
                data.WfEnabled = true;
            }

            var nodeData = link.ToNode.Data as ActivityNode;

            if (selfLink || nodeData.Category == ActivityType.Initial.ToString())
            {
                data.WfReturnLine = true;
            }

            _webMethod.LoadProperty(WorkflowUtils.CLIENTSCRIPT_PARAM_TRANSITION,
                                    link.Diagram.Tag.ToString(),
                                    WorkflowUtils.ExtractTransitionInfoJson(data));

            string strKey = string.Format("{0}@{1}", link.Diagram.Tag.ToString(), data.Key);

            WorkflowUtils.CurrentKey = strKey;
        }
Пример #4
0
        public override void DoDeactivate()
        {
            base.DoDeactivate();
            var link = this.Diagram.SelectedLink;

            ActivityLink linkData = (ActivityLink)link.Data;

            linkData.WfReturnLine = false;

            if (linkData.From == linkData.To || linkData.To == "N0")
            {
                linkData.WfReturnLine = true;
            }

            DiagramUtils.WebInterAct.LoadProperty(WorkflowUtils.CLIENTSCRIPT_PARAM_TRANSITION,
                                                  this.Diagram.Tag.ToString(),
                                                  WorkflowUtils.ExtractTransitionInfoJson(linkData));
        }
Пример #5
0
        private void Link_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            e.Handled = true;
            Northwoods.GoXam.PartManager.PartBinding currentBinding = (Northwoods.GoXam.PartManager.PartBinding)((sender as FrameworkElement).DataContext);
            ActivityLink linkData = currentBinding.Data as ActivityLink;

            if (linkData == null)
            {
                return;
            }

            string strKey = string.Format("{0}@{1}", this.mainDiagram.Tag.ToString(), linkData.Key);

            if (string.Compare(strKey, WorkflowUtils.CurrentKey) != 0)
            {
                this.WebMethod.LoadProperty(WorkflowUtils.CLIENTSCRIPT_PARAM_TRANSITION,
                                            this.mainDiagram.Tag.ToString(),
                                            WorkflowUtils.ExtractTransitionInfoJson(linkData));

                WorkflowUtils.CurrentKey = strKey;
            }
        }