Esempio n. 1
0
        internal void InitMoreAppsIcon()
        {
            AppIconModel model = new AppIconModel();

            model.AppName   = LocaleStrings.GetLocalizedString("STRING_MORE_APPS", "");
            model.ImageName = "moreapps";
            model.AddToDock(50.0, 50.0);
            this.moreAppsIcon        = new AppIconUI(this.ParentWindow, model);
            this.moreAppsIcon.Click += new RoutedEventHandler(this.MoreAppsIcon_Click);
            this.mDockPanel.Children.Add((UIElement)this.moreAppsIcon);
        }
        private void AddAppSuggestionIcon(AppSuggestionPromotion appSuggestionInfo)
        {
            string       appPackage    = appSuggestionInfo.AppPackage;
            double       height        = 50.0;
            double       width         = 50.0;
            AppIconModel newIconForKey = this.GetNewIconForKey(appPackage);

            try
            {
                if (newIconForKey == null)
                {
                    return;
                }
                newIconForKey.IsAppSuggestionActive = true;
                newIconForKey.PackageName           = appPackage;
                if (appSuggestionInfo.IsShowRedDot)
                {
                    newIconForKey.IsRedDotVisible = true;
                }
                newIconForKey.Init(appSuggestionInfo);
                if (appSuggestionInfo.IsEmailRequired && !RegistryManager.Instance.Guest[this.mParentWindow.mVmName].IsGoogleSigninDone)
                {
                    return;
                }
                if (string.Equals(appSuggestionInfo.AppLocation, "dock", StringComparison.InvariantCultureIgnoreCase))
                {
                    if (appSuggestionInfo.IconHeight != 0.0)
                    {
                        height = appSuggestionInfo.IconHeight;
                    }
                    if (appSuggestionInfo.IconWidth != 0.0)
                    {
                        width = appSuggestionInfo.IconWidth;
                    }
                    newIconForKey.AddToDock(height, width);
                    this.mHomeApp?.AddDockPanelIcon(newIconForKey, (DownloadInstallApk)null);
                }
                else if (string.Equals(appSuggestionInfo.AppLocation, "more_apps", StringComparison.InvariantCultureIgnoreCase))
                {
                    newIconForKey.AddToMoreAppsDock(55.0, 55.0);
                    this.mHomeApp?.AddMoreAppsDockPanelIcon(newIconForKey, (DownloadInstallApk)null);
                }
                else
                {
                    newIconForKey.AddToInstallDrawer();
                    this.mHomeApp?.AddInstallDrawerIcon(newIconForKey, (DownloadInstallApk)null);
                }
            }
            catch (Exception ex)
            {
                Logger.Error("Exception in adding app suggestion icon: " + ex.ToString());
            }
        }