예제 #1
0
파일: HistoryList.cs 프로젝트: jaffrykee/ui
        //处理操作节点组中单个节点的回退。
        //isGroupEnd	null:代表通常模式
        //                false:代表操作组模式未到达最后一步
        //                true:代表操作组模式到达最后一步
        private void redoStepNode(HistoryNode curStepNode, bool isAddOpt, bool? isGroupEnd)
        {
            XmlDocument docXml = null;

            if (curStepNode.m_dstXe != null)
            {
                docXml = curStepNode.m_dstXe.OwnerDocument;
            }
            switch (curStepNode.m_optType)
            {
                case XmlOptType.NODE_INSERT:
                    {
                        HistoryNode.insertXmlNode(
                            m_pW,
                            m_xmlCtrl,
                            curStepNode.m_dstXe,
                            curStepNode.m_srcXe,
                            curStepNode.m_newIndex);
                    }
                    break;
                case XmlOptType.NODE_DELETE:
                    {
                        HistoryNode.deleteXmlNode(
                            m_pW,
                            m_xmlCtrl,
                            curStepNode.m_dstXe);
                    }
                    break;
                case XmlOptType.NODE_MOVE:
                    {
                        HistoryNode.deleteXmlNode(
                            m_pW,
                            m_xmlCtrl,
                            curStepNode.m_dstXe);
                        HistoryNode.insertXmlNode(
                            m_pW,
                            m_xmlCtrl,
                            curStepNode.m_dstXe,
                            curStepNode.m_newSrcXe,
                            curStepNode.m_newIndex);
                    }
                    break;
                case XmlOptType.NODE_UPDATE:
                    {
                        HistoryNode.updateXmlNode(
                            m_pW,
                            curStepNode.m_dstXe,
                            curStepNode.m_attrName,
                            curStepNode.m_newValue);
                    }
                    break;
                case XmlOptType.TEXT:
                    {
                        HistoryNode.updateXmlText(m_xmlCtrl, curStepNode.m_newDoc);
                        if (!isAddOpt)
                        {
                            m_xmlCtrl.refreshXmlText();
                        }
                        return;
                    }
                    break;
                default:
                    return;
            }
            if (curStepNode.m_path != null && curStepNode.m_path != "")
            {
                if (docXml != null)
                {
                    docXml.Save(curStepNode.m_path);
                }
            }

            XmlItem dstItem;

            if (m_xmlCtrl.m_isOnlySkin)
            {
                XmlElement xeView;

                if (m_xmlCtrl.m_skinViewCtrlUI != null && m_xmlCtrl.m_skinViewCtrlUI.m_xe != null)
                {
                    BoloUI.ResBasic.resetXeView(m_xmlCtrl.m_skinViewCtrlUI, out xeView);
                }
                else
                {
                    xeView = MainWindow.s_pW.m_xeTest;
                }
                if (isGroupEnd != false)
                {
                    m_pW.updateXmlToGL(m_xmlCtrl, xeView, false);
                }

                if (m_xmlCtrl.m_mapXeItem.TryGetValue(curStepNode.m_dstXe, out dstItem))
                {
                    dstItem.initHeader();
                }
            }
            else
            {
                if (m_xmlCtrl.m_mapXeItem.TryGetValue(curStepNode.m_dstXe, out dstItem))
                {
                    dstItem.initHeader();
                }

                if (isGroupEnd == null)
                {
                    if (curStepNode.m_optType == XmlOptType.NODE_UPDATE && dstItem != null && dstItem.m_type == "CtrlUI")
                    {
                        Basic ctrlItem = (Basic)dstItem;

                        updateAttrToGL(m_xmlCtrl, ctrlItem, curStepNode.m_attrName, curStepNode.m_newValue);
                    }
                    else
                    {
                        m_pW.updateXmlToGL(m_xmlCtrl);
                    }
                }
                else if (isGroupEnd == true)
                {
                    foreach (HistoryNode stepNode in m_curNode.Value)
                    {
                        if (stepNode.m_optType == XmlOptType.NODE_UPDATE && dstItem != null && dstItem.m_type == "CtrlUI")
                        {
                            Basic ctrlItem = (Basic)dstItem;

                            updateAttrToGL(m_xmlCtrl, ctrlItem, stepNode.m_attrName, stepNode.m_newValue);
                        }
                        else
                        {
                            m_pW.updateXmlToGL(m_xmlCtrl);
                        }
                    }
                }
            }

            if (!isAddOpt)
            {
                if (dstItem != null)
                {
                    dstItem.changeSelectItem();
                    switch (dstItem.m_type)
                    {
                        case "CtrlUI":
                            m_pW.refreshAllCtrlUIHeader();
                            break;
                        case "Skin":
                            m_pW.refreshAllSkinHeader();
                            break;
                        default:
                            break;
                    }
                }
            }
            else
            {
                if (dstItem != null)
                {
                    dstItem.changeSelectItem();
                    switch (curStepNode.m_optType)
                    {
                        //用于添加控件中带有皮肤名或修改控件的皮肤名后,自动添加皮肤组。
                        case XmlOptType.NODE_UPDATE:
                            {
                                if (curStepNode.m_attrName == "skin")
                                {
                                    checkSkinLink(dstItem.m_xmlCtrl, dstItem.m_xe, false);
                                }
                            }
                            break;
                        case XmlOptType.NODE_INSERT:
                            {
                                checkSkinLink(dstItem.m_xmlCtrl, dstItem.m_xe);
                            }
                            break;
                        default:
                            break;
                    }
                }
            }

            if (curStepNode.m_path != null && curStepNode.m_path != "")
            {

            }
            else
            {
                if (MainWindow.s_pW.mx_showUITab.Visibility == System.Windows.Visibility.Visible &&
                    MainWindow.s_pW.mx_showUITab.IsChecked == true)
                {

                }
                else
                {
                    if (isGroupEnd != false)
                    {
                        m_xmlCtrl.refreshXmlText();
                    }
                }
            }
        }
예제 #2
0
파일: HistoryList.cs 프로젝트: jaffrykee/ui
        private void undoStepNode(HistoryNode curStepNode, bool? isGroupEnd)
        {
            XmlDocument docXml = null;

            if (curStepNode.m_dstXe != null)
            {
                docXml = curStepNode.m_dstXe.OwnerDocument;
            }
            switch (curStepNode.m_optType)
            {
                case XmlOptType.NODE_INSERT:
                    {
                        HistoryNode.deleteXmlNode(
                            m_pW,
                            m_xmlCtrl,
                            curStepNode.m_dstXe);
                    }
                    break;
                case XmlOptType.NODE_DELETE:
                    {
                        HistoryNode.insertXmlNode(
                            m_pW,
                            m_xmlCtrl,
                            curStepNode.m_dstXe,
                            curStepNode.m_srcXe,
                            curStepNode.m_oldIndex);
                    }
                    break;
                case XmlOptType.NODE_MOVE:
                    {
                        HistoryNode.deleteXmlNode(
                            m_pW,
                            m_xmlCtrl,
                            curStepNode.m_dstXe);
                        HistoryNode.insertXmlNode(
                            m_pW,
                            m_xmlCtrl,
                            curStepNode.m_dstXe,
                            curStepNode.m_srcXe,
                            curStepNode.m_oldIndex);
                    }
                    break;
                case XmlOptType.NODE_UPDATE:
                    {
                        HistoryNode.updateXmlNode(
                            m_pW,
                            curStepNode.m_dstXe,
                            curStepNode.m_attrName,
                            curStepNode.m_oldValue);
                    }
                    break;
                case XmlOptType.TEXT:
                    {
                        HistoryNode.updateXmlText(m_xmlCtrl, curStepNode.m_oldDoc);
                        m_xmlCtrl.refreshXmlText();
                        return;
                    }
                    break;
                default:
                    return;
            }
            if (curStepNode.m_path != null && curStepNode.m_path != "")
            {
                if (docXml != null)
                {
                    docXml.Save(curStepNode.m_path);
                }
            }
            XmlItem dstItem = null;

            m_xmlCtrl.m_mapXeItem.TryGetValue(curStepNode.m_dstXe, out dstItem);

            if (isGroupEnd == null)
            {
                if (curStepNode.m_optType == XmlOptType.NODE_UPDATE && dstItem != null && dstItem.m_type == "CtrlUI")
                {
                    Basic ctrlItem = (Basic)dstItem;

                    updateAttrToGL(m_xmlCtrl, ctrlItem, curStepNode.m_attrName, curStepNode.m_oldValue);
                }
                else
                {
                    m_pW.updateXmlToGL(m_xmlCtrl);
                }
            }
            else if (isGroupEnd == true)
            {
                foreach (HistoryNode stepNode in m_curNode.Value)
                {
                    if (stepNode.m_optType == XmlOptType.NODE_UPDATE && dstItem != null && dstItem.m_type == "CtrlUI")
                    {
                        Basic ctrlItem = (Basic)dstItem;

                        updateAttrToGL(m_xmlCtrl, ctrlItem, stepNode.m_attrName, stepNode.m_oldValue);
                    }
                    else
                    {
                        m_pW.updateXmlToGL(m_xmlCtrl);
                    }
                }
            }

            if (dstItem != null)
            {
                switch (dstItem.m_type)
                {
                    case "CtrlUI":
                        ((BoloUI.Basic)dstItem).changeSelectItem();
                        m_pW.refreshAllCtrlUIHeader();
                        dstItem.initHeader();
                        break;
                    case "Skin":
                        ((BoloUI.ResBasic)dstItem).changeSelectItem();
                        m_pW.refreshAllSkinHeader();
                        dstItem.initHeader();
                        break;
                    default:
                        break;
                }
            }

            if (curStepNode.m_path != null && curStepNode.m_path != "")
            {

            }
            else
            {
                if (isGroupEnd != false)
                {
                    m_xmlCtrl.refreshXmlText();
                }
            }
        }
예제 #3
0
파일: HistoryList.cs 프로젝트: jaffrykee/ui
        public void addOperation(HistoryNode optNode)
        {
            List<HistoryNode> lstNode = new List<HistoryNode>();

            lstNode.Add(optNode);
            addOperation(lstNode);
        }