/// <summary>
        /// 从ApplicationSettings中获取所有已安装应用的相关信息,从对应的app.xml获取详细信息.
        /// </summary>
        /// <param name="appList">用于存储已安装应用相关信息的app list</param>
        /// <returns>成功读取app信息并添加到appList中时返回YES,否则返回NO</returns>
        public bool readAppsFromConfig(XApplicationList appList)
        {
            bool ret = false;

            string defaultAppid = getDefaultAppId();
            appList.MarkAsDefaultApp(defaultAppid);

            List<PersistenceAppItem> apps = new List<PersistenceAppItem>();
            if (IsolatedStorageSettings.ApplicationSettings.Contains(USER_APPS))
            {
                apps = IsolatedStorageSettings.ApplicationSettings[USER_APPS] as List<PersistenceAppItem>;
            }

            foreach (PersistenceAppItem persistenceapp in apps)
            {
                string appInstallDir = XSystemConfiguration.GetInstance().AppInstallationDir;
                //~\xFace\apps\appId\app.xml
                string appConfigPath = appInstallDir + persistenceapp.AppId + "\\" + "app.xml";
                ret = File.Exists(XUtils.BuildabsPathOnIsolatedStorage(appConfigPath));
                if (!ret)
                {
                    break;
                }
                XAppInfo appInfo = new XAppInfo().init(appConfigPath);
                if (null == appInfo)
                {
                    ret = false;
                    break;
                }
                else
                {
                    appInfo.IsAssets = persistenceapp.IsAssets;
                    XApplication app = XApplicationCreator.Create(appInfo);
                    appList.Add(app);
                }
            }

            return ret;
        }
Example #2
0
 public XAppInstaller()
 {
     this.appList = new XApplicationList();
     this.appPersistence = new XApplicationPersistence();
     this.appPersistence.readAppsFromConfig(appList);
 }