private void MenuItem_LogicGraph_Click(object sender, RoutedEventArgs e)
        {
            Category category;

            if (!mCategoryDic.TryGetValue(LogicStateMachineCategoryName, out category))
            {
                return;
            }

            var validName = GetValidName("LinkNode", category);
            var item      = new CategoryItem(null, category);

            item.Name        = validName;
            item.InitTypeStr = "LFSM_Graph";
            var data = new LFSMGraphCategoryItemInitData();

            data.Name     = validName;
            data.ToolTips = item.ToolTips;
            data.Reset();
            item.Initialize(HostControl, data);
            category.Items.Add(item);
            Action create = async() =>
            {
                var nodeContainer = await HostControl.GetNodesContainer(item, true);

                var csParam = new LogicFSMGraphNodeControlConstructionParams();
                csParam.CSType               = HostControl.CSType;
                csParam.LAGNodeName          = item.Name;
                csParam.LinkedCategoryItemID = item.Id;
                csParam.IsSelfGraphNode      = true;
                var ins = nodeContainer.NodesControl.AddNodeControl(typeof(LogicFSMGraphNodeControl), csParam, 0, 200);
                ins.HostNodesContainer = nodeContainer.NodesControl;
            };

            create.Invoke();
        }
        private void InitializeMenuItems()
        {
            Macross.CategoryItem.RegistInitAction("LFSM_Graph", new Action <Macross.CategoryItem, Macross.IMacrossOperationContainer, Macross.CategoryItem.InitializeData>((item, ctrl, data) =>
            {
                if (item.PropertyShowItem == null)
                {
                    item.PropertyShowItem = new LFSMGraphCategoryItemPropertys();
                    var varItemPro        = item.PropertyShowItem as LFSMGraphCategoryItemPropertys;
                    var varData           = data as LFSMGraphCategoryItemInitData;
                    if (varData == null)
                    {
                        varItemPro.Name     = item.Name;
                        varItemPro.ToolTips = item.ToolTips;
                    }
                    else
                    {
                        varItemPro.Name     = varData.Name;
                        varItemPro.ToolTips = varData.ToolTips;
                    }
                    varItemPro.LinkControl  = ctrl as McLogicFSMLinkControl;
                    varItemPro.CategoryItem = item;
                    BindingOperations.SetBinding(item, CategoryItem.NameProperty, new Binding("Name")
                    {
                        Source = varItemPro, Mode = BindingMode.TwoWay
                    });
                    BindingOperations.SetBinding(item, CategoryItem.ToolTipsProperty, new Binding("ToolTips")
                    {
                        Source = varItemPro, Mode = BindingMode.TwoWay
                    });
                }
                var initData = data as LFSMGraphCategoryItemInitData;

                //BindingOperations.SetBinding(item, Macross.CategoryItem.NameProperty, new Binding("Name") { Source = initData.UIElement.Initializer });
                item.Icon           = TryFindResource("Icon_Graph") as ImageSource;
                item.OnDoubleClick += (categoryItem) =>
                {
                    var fsmCtrl = ctrl as McLogicFSMLinkControl;
                    var noUse   = fsmCtrl.ShowFSMNodesContainer(categoryItem);
                };

                var menuItem = new MenuItem()
                {
                    Name   = "LFSM_GraphItem",
                    Header = "添加LinkNode",
                    Style  = TryFindResource(new ComponentResourceKey(typeof(ResourceLibrary.CustomResources), "MenuItem_Default")) as Style,
                };

                menuItem.Click += (object sender, RoutedEventArgs e) =>
                {
                    var animGrapItem         = new CategoryItem(item, item.ParentCategory);
                    animGrapItem.Name        = GetValidName("LinkNode", item.ParentCategory);
                    animGrapItem.InitTypeStr = "LFSM_Graph";
                    var tempData             = new LFSMGraphCategoryItemInitData();
                    tempData.Name            = animGrapItem.Name;
                    tempData.ToolTips        = animGrapItem.ToolTips;
                    tempData.Reset();
                    animGrapItem.Initialize(ctrl, tempData);
                    item.Children.Add(animGrapItem);
                    Action create = async() =>
                    {
                        var nodeContainer            = await ctrl.GetNodesContainer(animGrapItem, true);
                        var csParam                  = new LogicFSMGraphNodeControlConstructionParams();
                        csParam.CSType               = ctrl.CSType;
                        csParam.LAGNodeName          = animGrapItem.Name;
                        csParam.LinkedCategoryItemID = animGrapItem.Id;
                        csParam.IsSelfGraphNode      = true;
                        var ins = nodeContainer.NodesControl.AddNodeControl(typeof(LogicFSMGraphNodeControl), csParam, 0, 200);
                        ins.HostNodesContainer = nodeContainer.NodesControl;
                    };
                    create.Invoke();
                };
                item.CategoryItemContextMenu.Items.Add(menuItem);
                {
                    menuItem = new MenuItem()
                    {
                        Name   = "LA_AnimGraphItem_Delete",
                        Header = "删除",
                        Style  = TryFindResource(new ComponentResourceKey(typeof(ResourceLibrary.CustomResources), "MenuItem_Default")) as Style,
                    };
                    ResourceLibrary.Controls.Menu.MenuAssist.SetIcon(menuItem, new BitmapImage(new Uri("/ResourceLibrary;component/Icons/Icons/icon_Edit_Delete_40x.png", UriKind.Relative)));
                    menuItem.Click += (object sender, RoutedEventArgs e) =>
                    {
                        if (EditorCommon.MessageBox.Show($"即将删除{this.Name},删除后无法恢复,是否继续?", EditorCommon.MessageBox.enMessageBoxButton.YesNo) == EditorCommon.MessageBox.enMessageBoxResult.Yes)
                        {
                            item.ParentCategory.Items.Remove(item);
                            ctrl.RemoveNodesContainer(item);
                            var fileName = ctrl.GetGraphFileName(item.Name);
                            EngineNS.CEngine.Instance.FileManager.DeleteFile(fileName);
                            if (item.Parent != null)
                            {
                                item.Parent.Children.Remove(item);
                            }
                        }
                    };
                    item.CategoryItemContextMenu.Items.Add(menuItem);
                }
            }));
        }