Esempio n. 1
0
        internal void Init()
        {
            HomeApp homeApp = (HomeApp)null;

            if (FeatureManager.Instance.IsHtmlHome)
            {
                this.mBrowser = this.AddBrowser(this.ParentWindow.Utils.GetHtmlHomeUrl(false), true);
                this.mHomeHtmlLoadStartTime            = DateTime.Now;
                this.browserExpectedLoadTimer          = new DispatcherTimer();
                this.browserExpectedLoadTimer.Tick    += new EventHandler(this.DispatcherTimer_Tick);
                this.browserExpectedLoadTimer.Interval = new TimeSpan(0, 0, 0, 0, RegistryManager.Instance.AvgHomeHtmlLoadTime);
                this.browserExpectedLoadTimer.Start();
            }
            else
            {
                homeApp = new HomeApp(this.ParentWindow);
                if (!this.mContentGrid.Children.Contains((UIElement)homeApp))
                {
                    this.mContentGrid.Children.Add((UIElement)homeApp);
                }
            }
            this.mHomeAppManager = new HomeAppManager(homeApp, this.ParentWindow);
            if (RegistryManager.Instance.InstallationType == InstallationTypes.GamingEdition)
            {
                this.mHomeAppManager.ChangeHomeAppVisibility(Visibility.Hidden);
                this.mBackground.ImageName  = Path.Combine(RegistryManager.Instance.ClientInstallDir, "Promo\\boot_promo_0.png");
                this.mBackground.Visibility = Visibility.Visible;
            }
            if (!FeatureManager.Instance.IsPromotionDisabled && !Opt.Instance.hiddenBootMode)
            {
                return;
            }
            this.RemovePromotionGrid();
            this.mHomeAppManager.ChangeHomeAppLoadingGridVisibility(Visibility.Visible);
        }
        internal void OpenApp(string packageName, bool isCheckForGrm = true)
        {
            AppIconModel appIcon = this.GetAppIcon(packageName);

            if (appIcon == null)
            {
                return;
            }
            if ((uint)appIcon.AppIncompatType > 0U & isCheckForGrm && !this.mParentWindow.mTopBar.mAppTabButtons.mDictTabs.ContainsKey(packageName))
            {
                GrmHandler.HandleCompatibility(appIcon.PackageName, this.mParentWindow.mVmName);
            }
            else
            {
                this.mParentWindow.mTopBar.mAppTabButtons.AddAppTab(appIcon.AppName, appIcon.PackageName, appIcon.ActivityName, appIcon.ImageName, false, true, false);
                this.mParentWindow.mAppHandler.SwitchWhenPackageNameRecieved = appIcon.PackageName;
                this.mParentWindow.mAppHandler.SendRunAppRequestAsync(appIcon.PackageName, "", false);
                if (appIcon.IsRedDotVisible)
                {
                    appIcon.IsRedDotVisible = false;
                    HomeAppManager.AddPackageInRedDotShownRegistry(appIcon.PackageName);
                }
                HomeAppManager.SendStats(appIcon.PackageName);
            }
        }
 private void HomeApp_AppSuggestionHandler(bool checkForAnimationIcon)
 {
     this.mParentWindow?.Dispatcher.Invoke((Delegate)(() =>
     {
         try
         {
             this.RemoveIconIfExists();
             lock (((ICollection)PromotionObject.Instance.AppSuggestionList).SyncRoot)
             {
                 foreach (AppSuggestionPromotion appSuggestion in PromotionObject.Instance.AppSuggestionList)
                 {
                     if (!new JsonParser(this.mParentWindow.mVmName).IsAppInstalled(appSuggestion.AppPackage))
                     {
                         if (HomeAppManager.CheckIfPresentInRedDotShownRegistry(appSuggestion.AppPackage))
                         {
                             appSuggestion.IsShowRedDot = false;
                         }
                         this.AddAppSuggestionIcon(appSuggestion);
                     }
                     else
                     {
                         if (!HomeAppManager.CheckIfPresentInRedDotShownRegistry(appSuggestion.AppPackage) && appSuggestion.IsShowRedDot)
                         {
                             this.GetAppIcon(appSuggestion.AppPackage)?.AddRedDot();
                         }
                         else
                         {
                             appSuggestion.IsShowRedDot = false;
                         }
                         this.GetAppIcon(appSuggestion.AppPackage)?.AddPromotionBorderInstalledApp(appSuggestion);
                     }
                 }
             }
             bool enable = this.dictAppIcons.Keys.Intersect <string>((IEnumerable <string>)PackageActivityNames.ThirdParty.AllOneStorePackageNames).Any <string>();
             foreach (string storePackageName in PackageActivityNames.ThirdParty.AllOneStorePackageNames)
             {
                 Utils.EnableDisableApp(storePackageName, enable, this.mParentWindow.mVmName);
             }
             this.mParentWindow.StaticComponents.PlayPauseGifs(true);
         }
         catch (Exception ex)
         {
             Logger.Error("Error in HomeApp_AppSuggestionHandler", (object)ex);
         }
     }));
 }
 internal void AddIconWithRedDot(string appPackage)
 {
     lock (((ICollection)PromotionObject.Instance.AppSuggestionList).SyncRoot)
     {
         JsonParser jsonParser = new JsonParser(this.mParentWindow.mVmName);
         foreach (AppSuggestionPromotion appSuggestion in PromotionObject.Instance.AppSuggestionList)
         {
             if (string.Equals(appSuggestion.AppPackage, appPackage, StringComparison.InvariantCulture))
             {
                 if (!jsonParser.IsAppInstalled(appSuggestion.AppPackage))
                 {
                     HomeAppManager.RemovePackageInRedDotShownRegistry(appSuggestion.AppPackage);
                     this.AddAppSuggestionIcon(appSuggestion);
                 }
                 else
                 {
                     HomeAppManager.RemovePackageInRedDotShownRegistry(appSuggestion.AppPackage);
                     this.GetAppIcon(appPackage)?.AddRedDot();
                 }
             }
         }
     }
 }
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     Logger.Info("Clicked app icon, package name {0}", (object)this.mAppIconModel.PackageName);
     if (this.mUnInstallTabButton.IsMouseOver)
     {
         this.UninstallButtonClicked();
     }
     else if (this.mErrorGrid.IsVisible)
     {
         this.mErrorGrid.Visibility = Visibility.Hidden;
         if (this.mAppIconModel.IsDownLoadingFailed)
         {
             this.mDownloader?.DownloadApk(this.mAppIconModel.ApkUrl, this.mAppIconModel.PackageName, false, false, "");
         }
         else
         {
             if (!this.mAppIconModel.IsInstallingFailed)
             {
                 return;
             }
             this.mDownloader?.InstallApk(this.mAppIconModel.PackageName, this.mAppIconModel.ApkFilePath, false, false, "");
         }
     }
     else
     {
         if (this.mAppIconModel.IsDownloading)
         {
             return;
         }
         if (this.mAppIconModel.IsInstalling)
         {
             if (this.mDownloader != null)
             {
                 return;
             }
             this.ParentWindow.mWelcomeTab.mFrontendPopupControl.Init(this.mAppIconModel.PackageName, this.mAppIconModel.AppName, PlayStoreAction.OpenApp, false);
         }
         else if (this.mAppIconModel.IsRerollIcon)
         {
             this.HandleRerollClick();
         }
         else if (this.mAppIconModel.IsAppSuggestionActive)
         {
             this.HandleAppSuggestionClick();
             if (!this.mAppIconModel.IsRedDotVisible)
             {
                 return;
             }
             this.mAppIconModel.IsRedDotVisible = false;
             HomeAppManager.AddPackageInRedDotShownRegistry(this.mAppIconModel.PackageName);
         }
         else
         {
             if (string.IsNullOrEmpty(this.mAppIconModel.PackageName))
             {
                 return;
             }
             if (string.Equals(this.mAppIconModel.PackageName, "help_center", StringComparison.InvariantCulture))
             {
                 this.ParentWindow.mTopBar.mAppTabButtons.AddWebTab(BlueStacksUIUtils.GetHelpCenterUrl(), "STRING_FEEDBACK", "help_center", true, "STRING_FEEDBACK", false);
             }
             else if (string.Equals(this.mAppIconModel.PackageName, "instance_manager", StringComparison.InvariantCulture))
             {
                 BlueStacksUIUtils.LaunchMultiInstanceManager();
             }
             else if (string.Equals(this.mAppIconModel.PackageName, "macro_recorder", StringComparison.InvariantCulture))
             {
                 this.ParentWindow.mCommonHandler.ShowMacroRecorderWindow();
             }
             else
             {
                 this.ParentWindow.mWelcomeTab.mHomeAppManager.OpenApp(this.mAppIconModel.PackageName, true);
             }
         }
     }
 }