public void UpdateApp(XApplication app, String path, XAppInstallListener listener)
 {
     bool isAbsolute = path.StartsWith("/") || path.StartsWith("\\");
     String tmp = isAbsolute ? path : ResolvePathUsingWorkspace(app.GetWorkSpace(), path);
     String abspath = XUtils.BuildabsPathOnIsolatedStorage(tmp);
     appManagement.UpdateApp(abspath, listener);
 }
Exemple #2
0
 /// <summary>
 /// 在已安装应用列表中添加一个应用
 /// </summary>
 /// <param name="app">待添加应用</param>
 public void Add(XApplication app)
 {
     if (null != app)
     {
         appList.Add(app);
     }
 }
Exemple #3
0
        /// <summary>
        /// app对应的URL
        /// </summary>
        /// <param name="app"></param>
        /// <returns></returns>
        public override Uri GetURL(XApplication app)
        {
            string entry;
            if (app.AppInfo.IsAssets)
            {
                entry = XConstant.PRE_INSTALL_SOURCE_ROOT + app.AppInfo.AppId + "\\" + app.AppInfo.Entry;
            }
            else
            {
                entry = app.InstalledDirectory() + "\\" + app.AppInfo.Entry;
            }

            Uri startPage = new Uri(entry, UriKind.Relative);
            return startPage;
        }
Exemple #4
0
        public override Uri GetURL(XApplication app)
        {
            //不含 http:// 或https://协议的 默认拼接 HTTP://
            string url = app.AppInfo.Entry;
            url = url.ToLower();
            if (url.IndexOf("?") > 0)
            {
                url = url + "&" + PLATFORM_QUERYSTRING;
            }
            else
            {
                url = url + "?" + PLATFORM_QUERYSTRING;
            }

            if (!url.StartsWith(XConstant.HTTP_SCHEME) && !url.StartsWith(XConstant.HTTPS_SCHEME))
            {
                url = XConstant.HTTP_SCHEME + url;
            }
            return new Uri(url, UriKind.Absolute);
        }
 public bool CanExecuteAmsBy(XApplication app)
 {
     return appManagement.IsDefaultApp(app) ? true : false;
 }
Exemple #6
0
 /// <summary>
 /// 判断是否是native app的类型
 /// </summary>
 /// <param name="app">被判断的app</param>
 /// <returns>是native类型返回true,否则返回false</returns>
 bool IsNativeApp(XApplication app)
 {
     return false;
 }
Exemple #7
0
 /// <summary>
 /// 是否是默认应用
 /// </summary>
 /// <param name="app">应用</param>
 /// <returns>是默认的app返回true,否则返回false</returns>
 public bool IsDefaultApp(XApplication app)
 {
     String appId = app.AppInfo.AppId;
     String defaultAppId = GetDefaultAppId();
     return appId.Equals(defaultAppId);
 }
Exemple #8
0
 public void HandleAppEvent(XApplication app, string eventType, string msg)
 {
     string arg = kAppEventMessage.Equals(eventType) ? string.Format("'{0}',{1}", eventType, msg) : string.Format("'{0}'", eventType);
     XApplicationList appList = GetAppList();
     XWebApplication defaultApp = (XWebApplication)appList.GetDefaultApp();
     if (eventType.Equals(kAppEventMessage))
     {
         string jsString = JsForFireAppEvent(arg);
         if (IsDefaultApp(app))
         {
             foreach (XApplication activeApp in activeApps)
             {
                 if (!IsDefaultApp(activeApp))
                 {
                     ((XWebApplication)activeApp).JsEvaluator.Eval(jsString);
                 }
             }
         }
         else
         {
             defaultApp.JsEvaluator.Eval(jsString);
         }
     }
     else if (eventType.Equals(kAppEventStart))
     {
         if (!IsDefaultApp(app))
         {
             string jsString = JsForFireAppEvent(arg);
             defaultApp.JsEvaluator.Eval(jsString);
         }
     }
     else if (eventType.Equals(kAppEventClose))
     {
         string jsString = JsForFireAppEvent(arg);
         defaultApp.JsEvaluator.Eval(jsString);
     }
     else
     {
         XLog.WriteWarn("unkonw app event " + eventType);
     }
 }
Exemple #9
0
        private void CheckVersion(XApplication app)
        {
            //FIXME: 暂不处理 EngineVersion 无值的判断
            if (null != app.AppInfo.EngineVersion)
            {
                try
                {
                    Version appEngineVersion = new Version(app.AppInfo.EngineVersion);
                    Version sysEngineVersion = new Version(XSystemConfiguration.GetInstance().XFaceVersion);

                    if (appEngineVersion > sysEngineVersion)
                    {
                        XToastPrompt.GetInstance().Toast(xFaceLibResources.Engine_Version_TooLow_Error);
                    }
                }
                catch (FormatException ex)
                {
                    XLog.WriteError("CheckVersion error:" + ex.Message);
                }
            }
        }
Exemple #10
0
 /// <summary>
 /// app对应的URL
 /// </summary>
 /// <param name="app"></param>
 /// <returns></returns>
 public virtual Uri GetURL(XApplication app)
 {
     throw new NotImplementedException("not override method exist!");
 }