コード例 #1
0
ファイル: RibbonFactory.cs プロジェクト: CecleCW/ProductMan
        public void FillRibbon( XmlDocument xmlDoc, Controls.Ribbon.RibbonControl ribbon,
            out Dictionary<string, Controls.Ribbon.Section> mapTagToSection, out Dictionary<string, Controls.Ribbon.Item> mapTagToItem)
        {
            if( xmlDoc == null )
            {
                throw new ArgumentNullException( "xmlDoc" );
            }

            mapTagToSection = new Dictionary<string, Controls.Ribbon.Section>();
            mapTagToItem = new Dictionary<string, Controls.Ribbon.Item>();

            XmlNode ribbonNode = xmlDoc.SelectSingleNode( "/Ribbon" );

            if( ribbonNode == null )
            {
                throw new XmlException( "Failed to find root Ribbon node." );
            }

            foreach( XmlNode sectionNode in ribbonNode.ChildNodes )
            {
                ribbon.AddSection( CreateSection( sectionNode, mapTagToSection, mapTagToItem ) );
            }
        }