示例#1
0
 public static void refreshItemHeader(XmlItem dstItem)
 {
     if (dstItem != null)
     {
         switch (dstItem.m_type)
         {
             case "CtrlUI":
                 ((BoloUI.Basic)dstItem).changeSelectItem();
                 MainWindow.s_pW.refreshAllCtrlUIHeader();
                 dstItem.initHeader();
                 break;
             case "Skin":
                 ((BoloUI.ResBasic)dstItem).changeSelectItem();
                 MainWindow.s_pW.refreshAllSkinHeader();
                 dstItem.initHeader();
                 break;
             default:
                 break;
         }
     }
 }
示例#2
0
        private Run addRunAndLinkItem(Paragraph para, string text, XmlItem xeItem, Color color, ref Run oldRun, ref Run diffRun)
        {
            Run newRun = new Run(text);
            XmlItem tmpItem;

            newRun.Foreground = new SolidColorBrush(color);
            para.Inlines.Add(newRun);

            if (xeItem != null && !m_mapRunItem.TryGetValue(newRun, out tmpItem))
            {
                m_mapRunItem.Add(newRun, xeItem);
                newRun.MouseDown += mx_newRun_MouseDown;
            }

            if (oldRun != null)
            {
                if (oldRun.Text == text)
                {
                    if (oldRun.NextInline != null && oldRun.NextInline is Run)
                    {
                        oldRun = (Run)oldRun.NextInline;
                    }
                    else
                    {
                        oldRun = null;
                        diffRun = newRun;
                    }
                }
                else
                {
                    oldRun = null;
                    diffRun = newRun;
                }
            }

            return newRun;
        }
示例#3
0
        public static void addItemToCurItemByString(string xmlStr, XmlItem curItem = null)
        {
            if (curItem == null)
            {
                curItem = XmlItem.getCurItem();
                if (curItem == null)
                {
                    return;
                }
            }

            XmlDocument newDoc = new XmlDocument();
            XmlElement newXe = curItem.m_xe.OwnerDocument.CreateElement("tmp");

            if (xmlStr != "")
            {
                newXe.InnerXml = xmlStr;
                if (newXe.FirstChild.NodeType == XmlNodeType.Element)
                {
                    XmlItem treeChild;

                    if(curItem is Basic)
                    {
                        treeChild = new BoloUI.Basic((XmlElement)newXe.FirstChild, curItem.m_xmlCtrl);
                    }
                    else if(curItem is ResBasic)
                    {
                        SkinDef_T skinDef;

                        if(SkinDef_T.tryGetSkinDef(newXe.FirstChild.Name, out skinDef))
                        {
                            treeChild = new BoloUI.ResBasic((XmlElement)newXe.FirstChild, curItem.m_xmlCtrl, skinDef);
                        }
                        else
                        {
                            return;
                        }
                    }
                    else
                    {
                        return;
                    }

                    if (treeChild != null)
                    {
                        if (treeChild.m_xe.Name == "event")
                        {
                            curItem.m_xmlCtrl.m_openedFile.m_lstOpt.addOperation(new XmlOperation.HistoryNode(
                                XmlOperation.XmlOptType.NODE_INSERT, treeChild.m_xe, curItem.m_xe, 0));
                        }
                        else
                        {
                            curItem.m_xmlCtrl.m_openedFile.m_lstOpt.addOperation(new XmlOperation.HistoryNode(
                                XmlOperation.XmlOptType.NODE_INSERT, treeChild.m_xe, curItem.m_xe, curItem.m_xe.ChildNodes.Count));
                        }
                    }
                }
            }
        }