Example #1
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public NExamplesContent()
        {
            // Create the navigation panel
            m_ExamplesHomePage = new NExamplesHomePage();
            m_ExamplesHomePage.LoadFromStream(NResources.Instance.GetResourceStream("RSTR_Examples_xml"));
            m_ExamplesHomePage.TileSelected += OnTileSelected;

            // Host it
            Content = m_ExamplesHomePage;

            // Create the example panel
            m_ExampleHost = new NExampleHost();
            m_ExampleHost.HomeButton.Click += OnHomeButtonClick;
        }
Example #2
0
        /// <summary>
        /// Gets the full path to the given example by prepending the names of its parent XML elements.
        /// </summary>
        /// <param name="exampleElement"></param>
        /// <returns></returns>
        private static string GetExamplePath(NXmlElement exampleElement)
        {
            string path = null;

            NXmlElement element = exampleElement;

            while (element.Name != "document")
            {
                if (NExampleHost.IsSingleExampleTile(element) == false)
                {
                    // The current XML element is not a tile with a single example
                    string name = element.GetAttributeValue("name");
                    if (String.IsNullOrEmpty(name) == false)
                    {
                        // The current element has a "name" attribute value, so prepend it to the path
                        path = String.IsNullOrEmpty(path) ? name : name + " > " + path;
                    }
                }

                element = (NXmlElement)element.Parent;
            }

            return(path);
        }