Пример #1
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);
        }
Пример #2
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);
        }