Windows phone 8 Windows Phone 8中的导航页面

Windows phone 8 Windows Phone 8中的导航页面,windows-phone-8,Windows Phone 8,我想知道是否可以通过编程方式在Windows Phone 8中找到导航页面的名称?它是WMAppManifest.xml文件的一部分,所以我希望这是可能的。好的,我知道了 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace zanoxSDK { public class WMAppMani

我想知道是否可以通过编程方式在Windows Phone 8中找到导航页面的名称?它是WMAppManifest.xml文件的一部分,所以我希望这是可能的。

好的,我知道了

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace zanoxSDK
{
    public class WMAppManifestReader
    {
        private static WMAppManifestReader instance = null;
        private string navigationPage = string.Empty;

        private WMAppManifestReader()
        {
            this.ReadAppManifest();
        }

        public static WMAppManifestReader GetInstance()
        {
            if (instance == null)
            {
                instance = new WMAppManifestReader();
            }

            return instance;
        }

        private void ReadAppManifest()
        {
            string wmData = string.Empty;
            System.Xml.Linq.XElement appxml = System.Xml.Linq.XElement.Load("WMAppManifest.xml");
            var appElement = (from manifestData in appxml.Descendants("DefaultTask") select manifestData).SingleOrDefault();

            if (appElement != null)
            {
                navigationPage = appElement.Attribute("NavigationPage").Value;
            }

            appElement = (from manifestData in appxml.Descendants("PrimaryToken") select manifestData).SingleOrDefault();
        }

        public string NavigationPage
        {
            get { return this.navigationPage; }
        }
    }
}