Пример #1
0
        private static FlowNode CreateOrLoadFromJson(FlowNodeType type, string json = null)
        {
            FlowNode node = null;

            bool fromJson = !string.IsNullOrEmpty(json);

            switch (type)
            {
            case FlowNodeType.Start:
            {
                if (fromJson)
                {
                    node = JsonConvert.DeserializeObject <StartNode>(json) as StartNode;
                }
                else
                {
                    node = new StartNode();
                }
            }
            break;

            case FlowNodeType.SetPosition:
            {
                if (fromJson)
                {
                    node = JsonConvert.DeserializeObject <SetPositionNode>(json) as SetPositionNode;
                }
                else
                {
                    node = new SetPositionNode();
                }
            }
            break;

            case FlowNodeType.End:
            {
                if (fromJson)
                {
                    node = JsonConvert.DeserializeObject <EndNode>(json) as EndNode;
                }
                else
                {
                    node = new EndNode();
                }
            }
            break;
            }

            if (!fromJson)
            {
                node.type     = type;
                node.color    = new float[] { 1f, 1f, 1f, 1f };
                node.linkList = new List <int>();
                node.preList  = new List <int>();
                node.delay    = 0f;
                node.wait     = true;
            }

            return(node);
        }
Пример #2
0
        void HandlePopMenu()
        {
            if (_curFlowGraph == null)
            {
                return;
            }

            GenericMenu menu = new GenericMenu();

            for (FlowNodeType type = FlowNodeType.Start; type < FlowNodeType.Count; type++)
            {
                if (type == FlowNodeType.End)
                {
                    menu.AddSeparator("");
                }

                menu.AddItem(new GUIContent(type.ToString()), false, HandleClickMenuItem, new object[] { type, Event.current.mousePosition });

                if (type == FlowNodeType.Start)
                {
                    menu.AddSeparator("");
                }
            }

            menu.ShowAsContext();
        }
Пример #3
0
        // Get Embedeed Object instance
        internal object GetAdjacentElement(LogicalDirection dir)
        {
            FlowPosition flow = GetClingPosition(dir);
            FlowNodeType type = flow._flowNode.Type;

            Debug.Assert(type == FlowNodeType.Object || type == FlowNodeType.Noop || type == FlowNodeType.Start || type == FlowNodeType.End);

            if (type == FlowNodeType.Noop)
            {
                return(String.Empty);
            }
            else
            {
                Object obj   = ((FixedElement)flow._flowNode.Cookie).GetObject();
                Image  image = obj as Image;
                if (type == FlowNodeType.Object && image != null)
                {
                    //Set width and height properties by looking at corresponding SOMImage
                    FixedSOMElement[] elements = flow._flowNode.FixedSOMElements;
                    if (elements != null && elements.Length > 0)
                    {
                        FixedSOMImage somImage = elements[0] as FixedSOMImage;
                        if (somImage != null)
                        {
                            image.Width  = somImage.BoundingRect.Width;
                            image.Height = somImage.BoundingRect.Height;
                        }
                    }
                }
                return(obj);
            }
        }
        // Token: 0x06002FAE RID: 12206 RVA: 0x000D6BE0 File Offset: 0x000D4DE0
        private TextPointerContext _FlowNodeTypeToTextSymbol(FlowNodeType t)
        {
            switch (t)
            {
            case FlowNodeType.Start:
                return(TextPointerContext.ElementStart);

            case FlowNodeType.Run:
                return(TextPointerContext.Text);

            case (FlowNodeType)3:
                break;

            case FlowNodeType.End:
                return(TextPointerContext.ElementEnd);

            default:
                if (t == FlowNodeType.Object || t == FlowNodeType.Noop)
                {
                    return(TextPointerContext.EmbeddedElement);
                }
                break;
            }
            return(TextPointerContext.None);
        }
        // Token: 0x06002F95 RID: 12181 RVA: 0x000D652C File Offset: 0x000D472C
        internal object GetAdjacentElement(LogicalDirection dir)
        {
            FlowPosition clingPosition = this.GetClingPosition(dir);
            FlowNodeType type          = clingPosition._flowNode.Type;

            if (type == FlowNodeType.Noop)
            {
                return(string.Empty);
            }
            object @object = ((FixedElement)clingPosition._flowNode.Cookie).GetObject();
            Image  image   = @object as Image;

            if (type == FlowNodeType.Object && image != null)
            {
                FixedSOMElement[] fixedSOMElements = clingPosition._flowNode.FixedSOMElements;
                if (fixedSOMElements != null && fixedSOMElements.Length != 0)
                {
                    FixedSOMImage fixedSOMImage = fixedSOMElements[0] as FixedSOMImage;
                    if (fixedSOMImage != null)
                    {
                        image.Width  = fixedSOMImage.BoundingRect.Width;
                        image.Height = fixedSOMImage.BoundingRect.Height;
                    }
                }
            }
            return(@object);
        }
Пример #6
0
        void HandleClickMenuItem(object args)
        {
            object[]     argArray      = args as object[];
            FlowNodeType type          = (FlowNodeType)argArray[0];
            Vector2      mousePosition = (Vector2)argArray[1];

            FlowNode.CreateFromGraph(_curFlowGraph, type, _curFlowGraph.NodeNextID, new Vector2(mousePosition.x, mousePosition.y));
        }
Пример #7
0
        public static FlowNode CreateFromGraph(FlowGraph graph, FlowNodeType type, int id, Vector2 position)
        {
            FlowNode node = Create(type, id, position);

            node.flowGraph = graph;
            node.SetRectInGraph(graph, node.x, node.y);
            graph.AddNode(node);
            return(node);
        }
Пример #8
0
        void addAcitivty(FlowNodeType type)
        {
            flowNode = new FlowNode(_container, type);
            flowNode.SetValue(Canvas.ZIndexProperty, _container.NextMaxIndex);
            flowNode.NodeName    = "新建节点" + _container.NextNewFlowNodeIndex.ToString();
            flowNode.CenterPoint = this.CenterPoint;

            _container._Service.DoNewNodeAsync(_container.FlowID, 10, 10, flowNode.NodeName, true);
            _container._Service.DoNewNodeCompleted += _Service_DoNewNodeCompleted;
        }
Пример #9
0
        void setUIValueByFlowNodeData(FlowNodeComponent FlowNodeData)
        {
            sdPicture.NodeName = FlowNodeData.NodeName;
            FlowNodeType type = (FlowNodeType)Enum.Parse(typeof(FlowNodeType), FlowNodeData.FlowNodeType, true);
            MergePictureRepeatDirection repeatDirection = (MergePictureRepeatDirection)Enum.Parse(typeof(MergePictureRepeatDirection), FlowNodeData.RepeatDirection, true);

            HisRunModel     = type;
            RepeatDirection = repeatDirection;
            SubFlow         = FlowNodeData.SubFlow;
        }
Пример #10
0
        private static FlowNode Create(FlowNodeType type, int id, Vector2 position)
        {
            var node = CreateOrLoadFromJson(type);

            node.id = id;
            node.x  = position.x;
            node.y  = position.y;

            return(node);
        }
Пример #11
0
        public NodeConfig(FlowNodeFilter cat, string desc, FlowNodeFlags nodeFlags, FlowNodeType nodeType, InputPortConfig[] inputPorts, OutputPortConfig[] outputPorts)
            : this()
        {
            flags       = nodeFlags;
            filter      = cat;
            description = desc;
            type        = nodeType;

            inputs  = inputPorts.Cast <object>().ToArray();
            outputs = outputPorts.Cast <object>().ToArray();
        }
Пример #12
0
        public NodeConfig(FlowNodeFilter cat, string desc, FlowNodeFlags nodeFlags, FlowNodeType nodeType, InputPortConfig[] inputPorts, OutputPortConfig[] outputPorts)
            : this()
        {
            flags = nodeFlags;
            filter = cat;
            description = desc;
            type = nodeType;

            inputs = inputPorts.Cast<object>().ToArray();
            outputs = outputPorts.Cast<object>().ToArray();
        }
Пример #13
0
        private void setMenuItemStyleByType(FlowNodeType type)
        {
            var menuType = (MuContentMenu.Items[8] as MenuItem).Content as Menu;

            if (null == menuType)
            {
                return;
            }
            foreach (var item in menuType.Items)
            {
                var subMenu = item as MenuItem;
                if (null != subMenu)
                {
                    subMenu.FontWeight         = FontWeights.Normal;
                    subMenu.CheckBoxVisibility = System.Windows.Visibility.Collapsed;
                    subMenu.IsChecked          = false;
                }
            }

            MenuItem mItem = null;

            switch (type)
            {
            case FlowNodeType.Ordinary:
                mItem = (menuType.Items[0] as MenuItem);
                break;

            case FlowNodeType.FL:
                mItem = (menuType.Items[1] as MenuItem);
                break;

            case FlowNodeType.HL:
                mItem = (menuType.Items[2] as MenuItem);
                break;

            case FlowNodeType.FHL:
                mItem = (menuType.Items[3] as MenuItem);
                break;

            case FlowNodeType.SubThread:
                mItem = (menuType.Items[4] as MenuItem);
                break;
            }

            mItem.FontWeight         = FontWeights.ExtraBold;
            mItem.CheckBoxVisibility = System.Windows.Visibility.Visible;
            mItem.IsChecked          = true;
        }
Пример #14
0
        public FlowNode(IContainer container, FlowNodeType at)
            : this()
        {
            _container = container;
            editType   = PageEditType.Add;

            this.HisRunModel = at;

            System.Windows.Browser.HtmlPage.Document.AttachEvent("oncontextmenu", OnContextMenu);
            this.Name = FK_Flow;

            _doubleClickTimer          = new System.Windows.Threading.DispatcherTimer();
            _doubleClickTimer.Interval = new TimeSpan(0, 0, 0, 0, SystemConst.DoubleClickTime);
            _doubleClickTimer.Tick    += new EventHandler(DoubleClick_Timer);
            sbDisplay.Begin();
        }
Пример #15
0
        //--------------------------------------------------------------------
        //
        // Connstructors
        //
        //---------------------------------------------------------------------

        #region Constructors
        internal FlowNode(int scopeId, FlowNodeType type, object cookie)
        {
            //
            // If cookie is FixedElement, you have to set it later, otherwise,
            // please set it here.
            // In that case, cookie will be set as a FixedElement later.
            // It cann't be set here because of the circular reference.
            //

            //
            // We don't allow to create a glyph node with zero run length.
            // it will lots of problem in textOM due to some assumption there.
            //
            Debug.Assert( (type != FlowNodeType.Run)  ||  ((int)cookie != 0));

            _scopeId = scopeId;
            _type       = type;
            _cookie     = cookie;
        }
Пример #16
0
        //--------------------------------------------------------------------
        //
        // Connstructors
        //
        //---------------------------------------------------------------------

        #region Constructors
        internal FlowNode(int scopeId, FlowNodeType type, object cookie)
        {
            //
            // If cookie is FixedElement, you have to set it later, otherwise,
            // please set it here.
            // In that case, cookie will be set as a FixedElement later.
            // It cann't be set here because of the circular reference.
            //

            //
            // We don't allow to create a glyph node with zero run length.
            // it will lots of problem in textOM due to some assumption there.
            //
            Debug.Assert((type != FlowNodeType.Run) || ((int)cookie != 0));

            _scopeId = scopeId;
            _type    = type;
            _cookie  = cookie;
        }
Пример #17
0
        // Convert Flow Node Type to TextPointerContext
        private TextPointerContext _FlowNodeTypeToTextSymbol(FlowNodeType t)
        {
            switch (t)
            {
            case FlowNodeType.Start:
                return(TextPointerContext.ElementStart);

            case FlowNodeType.End:
                return(TextPointerContext.ElementEnd);

            case FlowNodeType.Run:
                return(TextPointerContext.Text);

            case FlowNodeType.Object:
            case FlowNodeType.Noop:
                return(TextPointerContext.EmbeddedElement);

            default:
                return(TextPointerContext.None);
            }
        }
Пример #18
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="name">an identificator (more for debugging than anything real)</param>
 public FlowNode(string name)
 {
     this.Name = name;
     this.Type = FlowNodeType.Virtual;
 }
Пример #19
0
        // Convert Flow Node Type to TextPointerContext
        private TextPointerContext _FlowNodeTypeToTextSymbol(FlowNodeType t)
        { 
            switch (t)
            { 
                case FlowNodeType.Start: 
                    return TextPointerContext.ElementStart;
 
                case FlowNodeType.End:
                    return TextPointerContext.ElementEnd;

                case FlowNodeType.Run: 
                    return TextPointerContext.Text;
 
                case FlowNodeType.Object: 
                case FlowNodeType.Noop:
                    return TextPointerContext.EmbeddedElement; 

                default:
                    return TextPointerContext.None;
            } 
        }
Пример #20
0
        private void AddFlowNodeSubMenu_Click(object sender, RoutedEventArgs e)
        {
            FlowNodeType type = (FlowNodeType)Enum.Parse(typeof(FlowNodeType), ((HyperlinkButton)sender).Name, true);

            addAcitivty(type);
        }
 // Token: 0x06002F7E RID: 12158 RVA: 0x000D61B7 File Offset: 0x000D43B7
 internal FlowNode(int scopeId, FlowNodeType type, object cookie)
 {
     this._scopeId = scopeId;
     this._type    = type;
     this._cookie  = cookie;
 }