public static void ResetNodeConrol(bool NeedResetLoadValue, CodeGenerateSystem.Controls.NodesContainerControl mLinkedNodesContainer, StructNodeControlConstructionParams csparam)
        {
            if (NeedResetLoadValue == false)
            {
                return;
            }

            Macross.NodesControlAssist NodesControlAssist             = mLinkedNodesContainer.HostControl as Macross.NodesControlAssist;
            MacrossPanelBase           MacrossOpPanel                 = NodesControlAssist.HostControl.MacrossOpPanel;
            IMacrossOperationContainer NodesControlAssist_HostControl = NodesControlAssist.HostControl;
            var categoryDic = csparam.CategoryDic;

            csparam.CategoryDic = new Dictionary <string, Category>();
            foreach (var categorydic in categoryDic)
            {
                csparam.CategoryDic[categorydic.Key] = new Category(MacrossOpPanel);
                for (int i = 0; i < categorydic.Value.Items.Count; i++)
                {
                    csparam.CategoryDic[categorydic.Key].Items.Add(categorydic.Value.Items[i]);
                    categorydic.Value.Items[i].SetParentCategory(csparam.CategoryDic[categorydic.Key]);

                    var data = new Macross.CategoryItem.InitializeData();
                    data.Reset();
                    categorydic.Value.Items[i].Initialize(NodesControlAssist_HostControl, data);
                }
            }
        }
        private void CreateParticleMethodCategory(string methodname, float x, float y)
        {
            Macross.NodesControlAssist NodesControlAssist = mLinkedNodesContainer.HostControl as Macross.NodesControlAssist;

            //加入列表信息
            Macross.Category category;
            var csparam = CSParam as ParticleShapeConeControlConstructionParams;

            if (!csparam.CategoryDic.TryGetValue(Macross.MacrossPanelBase.GraphCategoryName, out category))
            {
                return;
            }

            var HostControl = this.HostNodesContainer.HostControl;

            var item = new Macross.CategoryItem(null, category);

            item.CategoryItemType = Macross.CategoryItem.enCategoryItemType.OverrideFunction;
            var data = new Macross.CategoryItem.InitializeData();

            data.Reset();

            var MacrossOpPanel = NodesControlAssist.HostControl.MacrossOpPanel;

            item.Initialize(MacrossOpPanel.HostControl, data);
            //HostControl.CreateNodesContainer(item);

            //MainGridItem.Children.Add(item);
            item.Name = methodname;
            category.Items.Add(item);

            //加入结点信息
            Type type = typeof(EngineNS.Bricks.Particle.ParticleEmitShapeNode);

            System.Reflection.MethodInfo      methodInfo = type.GetMethod(methodname);
            System.Reflection.ParameterInfo[] paramstype = methodInfo.GetParameters();

            //拷貝方法的attribute.
            var    attrts      = methodInfo.GetCustomAttributes(true);
            string displayname = "";

            for (int i = 0; i < attrts.Length; i++)
            {
                var displayattr = attrts[i] as System.ComponentModel.DisplayNameAttribute;
                if (displayattr != null)
                {
                    displayname = displayattr.DisplayName;
                    break;
                }
            }

            //var CustomFunctionData = new Macross.ResourceInfos.MacrossResourceInfo.CustomFunctionData();
            var methodinfo = CodeDomNode.Program.GetMethodInfoAssistFromMethodInfo(methodInfo, type, CodeDomNode.MethodInfoAssist.enHostType.Base, "");
            var nodeType   = typeof(CodeDomNode.MethodOverride);
            var csParam    = new CodeDomNode.MethodOverride.MethodOverrideConstructParam()
            {
                CSType             = mLinkedNodesContainer.CSType,
                HostNodesContainer = mLinkedNodesContainer,
                ConstructParam     = "",
                MethodInfo         = methodinfo,
                DisplayName        = displayname,
            };

            //var center = nodesContainer.NodesControl.GetViewCenter();
            var node = mLinkedNodesContainer.AddOrigionNode(nodeType, csParam, x, y);

            node.IsDeleteable = true;

            //重写双击事件 不需要进入二级编辑
            //item.OnDoubleClick -= item.OnDoubleClick;
            Type      ItemType = item.GetType();
            FieldInfo _Field   = item.GetType().GetField("OnDoubleClick", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public | BindingFlags.Static);

            if (_Field != null)
            {
                object _FieldValue = _Field.GetValue(item);
                if (_FieldValue != null && _FieldValue is Delegate)
                {
                    Delegate   _ObjectDelegate = (Delegate)_FieldValue;
                    Delegate[] invokeList      = _ObjectDelegate.GetInvocationList();

                    foreach (Delegate del in invokeList)
                    {
                        ItemType.GetEvent("OnDoubleClick").RemoveEventHandler(item, del);
                    }
                }
            }
            item.OnDoubleClick += (categoryItem) =>
            {
                mLinkedNodesContainer.FocusNode(node);
            };

            //NodesControlAssist.Save();
        }
        //初始化每个结点类中的元素
        public async System.Threading.Tasks.Task InitGraph()
        {
            if (this.HostNodesContainer == null || mLinkedNodesContainer != null)
            {
                return;
            }

            if (NeedInitGrapth == false)
            {
                return;
            }

            NeedInitGrapth = false;

            var assist = this.HostNodesContainer.HostControl;

            if (string.IsNullOrEmpty(HostNodesContainer.TitleString))
            {
                HostNodesContainer.TitleString = "MainGraph";
            }

            var TitleString = HostNodesContainer.TitleString;

            var title = TitleString + "/" + NodeName + ":" + this.Id.ToString();

            var data = new SubNodesContainerData()
            {
                ID    = Id,
                Title = title,
            };

            mLinkedNodesContainer = await assist.GetSubNodesContainer(data);

            //TODO..
            Macross.NodesControlAssist NodesControlAssist = mLinkedNodesContainer.HostControl as Macross.NodesControlAssist;
            var MacrossOpPanel = NodesControlAssist.HostControl.MacrossOpPanel;

            var names = new string[] { MacrossPanelBase.GraphCategoryName, MacrossPanelBase.FunctionCategoryName, MacrossPanelBase.VariableCategoryName, MacrossPanelBase.AttributeCategoryName };

            var csparam = CSParam as StructNodeControlConstructionParams;

            csparam.CategoryDic = new Dictionary <string, Category>();
            foreach (var name in names)
            {
                var category1 = new Category(MacrossOpPanel);
                category1.CategoryName = name;
                csparam.CategoryDic.Add(name, category1);
                //categoryPanel.Children.Add(category);
            }
            foreach (var category1 in csparam.CategoryDic)
            {
                category1.Value.OnSelectedItemChanged = (categoryName) =>
                {
                    foreach (var cName in names)
                    {
                        if (cName == categoryName)
                        {
                            continue;
                        }

                        Category ctg;
                        if (csparam.CategoryDic.TryGetValue(cName, out ctg))
                        {
                            ctg.UnSelectAllItems();
                        }
                    }
                };
            }

            if (data.IsCreated)
            {
                await InitializeLinkedNodesContainer();
            }
            mLinkedNodesContainer.HostNode = this;

            //ParticleDataSaveLoad.ResetNodeConrol(NeedResetLoadValue, mLinkedNodesContainer, csparam);
            EngineNS.Thread.Async.TaskLoader.Release(ref WaitContext, this);
        }