Exemplo n.º 1
0
 public void ShowNodesView(ShowNodesEventParameter p)
 {
 }
Exemplo n.º 2
0
        private NonPersistentCollectionSource CreateCollectionSource(ShowNodesEventParameter para)
        {
            var session = Session;

            var forms = para.Application.Model.BOModel.Where(
                x => x.TypeInfo.IsPersistent && typeof(I单据).IsAssignableFrom(x.TypeInfo.Type))
                .Select(x => new FormInfo(session)
                {
                    FullName = x.TypeInfo.FullName,
                    Caption = x.Caption,
                    BaseTypeCaption = x.BaseClass.Caption,
                    BaseTypeName = x.BaseClass.TypeInfo.FullName
                }).ToArray();

            var xpc = new XPCollection<FormInfo>(session,
                forms.Where(x => !para.SelectedForms.OfType<FlowNode>().Select(t => t.Form).Contains(x.FullName)));

            var cs = new NonPersistentCollectionSource(para.ObjectSpace, typeof(FormInfo), xpc);

            return cs;
        }
Exemplo n.º 3
0
        public void ShowNodesView(ShowNodesEventParameter para)
        {
            var listViewId = para.Application.FindListViewId(typeof(FormInfo));

            NonPersistentCollectionSource cs = CreateCollectionSource(para);
            var p = para;
            p.ViewParameter.CreatedView = para.Application.CreateListView(listViewId, cs, false);

            p.ViewParameter.CreatedView.Caption = "选择单据";

            p.ViewParameter.NewWindowTarget = NewWindowTarget.Separate;
            p.ViewParameter.TargetWindow = TargetWindow.NewModalWindow;
            var dc = new DialogController();

            dc.SaveOnAccept = false;

            dc.AcceptAction.SelectionDependencyType = para.SingleSelect
                ? SelectionDependencyType.RequireSingleObject
                : SelectionDependencyType.RequireMultipleObjects;

            dc.Accepting += (s, e1) =>
            {
                var x = 20;
                var y = 20;
                if (e1.AcceptActionArgs.SelectedObjects.Count == 1)
                {
                    x = (int)para.MouseClickPoint.X;
                    y = (int)para.MouseClickPoint.Y;
                }

                var i = 0;
                foreach (var item in e1.AcceptActionArgs.SelectedObjects)
                {
                    var selected = (item as FormInfo);
                    if (selected != null)
                    {
                        //创建一个结点
                        var node = (this as IFlow).CreateNode(x, y, 64, 64, selected.FullName, selected.Caption);
                        object single = null;
                        if (para.Shape == null)
                        {
                            single = para.CreateShape(node);
                            //new DiagramShapeEx(SDLDiagramShapes.Procedure, node.X, node.Y, node.Width,
                            //    node.Height);
                            //single.Image = node.GetImage();
                            //_diagram.Items.Add(single);
                            //_diagram.SelectItem(single);
                        }
                        else
                        {
                            single = para.Shape;
                        }
                        para.UpdateShape(node, single);

                        //single.Content = node.Caption;

                        //single.Tag = node;
                    }
                    x += 200;
                    i++;
                    if (i % 5 == 0)
                    {
                        x = 20;
                        y += 200;
                    }
                }
            };
            para.ViewParameter.Controllers.Add(dc);
        }
Exemplo n.º 4
0
        void IFlow.ShowNodesView(ShowNodesEventParameter p)
        {
            CIIPXpoState obj;
            if (p.Shape == null)
            {

                obj = (CIIPXpoState)(this as IFlow).CreateNode((int)p.MouseClickPoint.X, (int)p.MouseClickPoint.Y, 64, 64, "", "");
            }
            else
            {
                obj = p.SelectedNode as CIIPXpoState;
            }

            if (obj == null)
                throw new Exception("û��״̬����");

            var view = p.Application.CreateDetailView(p.ObjectSpace, obj, false);
            p.ViewParameter.CreatedView = view;
            p.ViewParameter.TargetWindow = TargetWindow.NewModalWindow;

            var dc = new DialogController();
            dc.Accepting += (s, p1) =>
            {
                var sp = p.Shape;
                if (p.Shape == null)
                {
                    sp = p.CreateShape(obj);
                }

                p.UpdateShape(obj, sp);
                Flow.States.Add(obj);
                obj.Save();
                if (Flow.StartState == null)
                {
                    Flow.StartState = obj;
                }
            };

            dc.Cancelling += (s, p1) =>
            {
                obj.Delete();
                p.DeletSelectedNode();
                //_diagram.DeleteSelectedItems();
            };
            dc.SaveOnAccept = false;
            p.ViewParameter.Controllers.Add(dc);
        }
Exemplo n.º 5
0
        public void ShowNodesView(ShowNodesEventParameter p)
        {
            if (!IsDesignMode)
            {
                var mi = (p.SelectedNode as NavigationMenuItem);
                if (mi != null)
                    p.DoShowNavigationItem(mi.NavigationItemPath.Path);
                return;
            }
            NavigationMenuItem obj;
            if (p.Shape == null)
            {
                obj =
                    (NavigationMenuItem)
                        (this as IFlow).CreateNode((int) p.MouseClickPoint.X, (int) p.MouseClickPoint.Y, 64, 64, "", "");
                //û�ж���ѡ�񣬵��������б��ѡ��ڵ㡣����ڵ������Ӽ��ģ����Ӽ���ʾ����������Ӽ���û���ӽ��ģ�ֱ����ʾ
                //����������view�趨�ġ�
            }
            else
            {
                obj = p.SelectedNode as NavigationMenuItem;
                //���б༭������
            }

            if (obj == null)
                throw new Exception("û��״̬����");

            var view = p.Application.CreateDetailView(p.ObjectSpace, obj, false);
            p.ViewParameter.CreatedView = view;
            p.ViewParameter.TargetWindow = TargetWindow.NewModalWindow;

            var dc = new DialogController();
            dc.Accepting += (s, p1) =>
            {
                var sp = p.Shape;
                if (p.Shape == null)
                {
                    sp = p.CreateShape(obj);
                }
                this.Nodes.Add(obj);
                p.UpdateShape(obj, sp);

                obj.Save();
            };

            dc.Cancelling += (s, p1) =>
            {
                if (p.Shape == null)
                {
                    obj.Delete();
                    p.DeletSelectedNode();
                }
                //_diagram.DeleteSelectedItems();
            };
            dc.SaveOnAccept = false;
            p.ViewParameter.Controllers.Add(dc);
        }
Exemplo n.º 6
0
        private ShowNodesEventParameter CreateShowNodesEventParameter(PointFloat pnt,bool singleSelect,DiagramShape currentShape)
        {
            var para = new ShowNodesEventParameter();
            para.MouseClickPoint = pnt;
            para.Application = Application;
            para.CreateShape = (x) =>
            {
                var rst = new DiagramShapeEx(SDLDiagramShapes.Procedure, x.X, x.Y, x.Width,
                    x.Height);
                rst.Image = x.GetImage();
                _diagram.Items.Add(rst);
                _diagram.SelectItem(rst);
                return rst;
            };
            para.ObjectSpace = _os;
            para.SelectedForms = _diagram.Items.OfType<DiagramShape>().Select(x => (x.Tag as IFlowNode)).ToArray();
            para.Shape = currentShape;
            para.SingleSelect = singleSelect;
            para.UpdateShape = (node, shape) =>
            {
                var s = shape as DiagramShape;
                s.Content = node.Caption;
                s.Tag = node;
            };

            para.DoShowNavigationItem = (x) =>
            {
                var snc = Application.MainWindow.GetController<SubSystemNavigationController>();
                var sname = x.Split('/');
                if (sname.Length > 3)
                    snc.NavigationToSystem(sname[3]);
                var ctrl = Application.MainWindow.GetController<ShowNavigationItemController>().ShowNavigationItemAction;
                var toItem = FindChoiceActionItemByModelPath(ctrl.Items, x);
                ctrl.SelectedItem = toItem;
                ctrl.DoExecute(toItem);

                //ctrl.FindItemByIdPath()
            };

            if (currentShape != null)
                para.SelectedNode = currentShape.Tag as IFlowNode;

            para.DeletSelectedNode = () => { _diagram.DeleteSelectedItems(); };
            para.ViewParameter = new ShowViewParameters();
            Flow.ShowNodesView(para);
            return para;
        }