Exemplo n.º 1
0
 internal void Init(AppSuggestionPromotion appSuggestionInfo)
 {
     this.AppSuggestionInfo     = appSuggestionInfo;
     this.AppName               = appSuggestionInfo.AppName;
     this.ActivityName          = appSuggestionInfo.AppActivity;
     this.IsAppSuggestionActive = true;
     this.AppNameTooltip        = string.IsNullOrEmpty(this.AppSuggestionInfo.ToolTip) ? this.AppName : (string)null;
     this.AppNameTextWrapping   = TextWrapping.Wrap;
     this.AppNameTextTrimming   = TextTrimming.CharacterEllipsis;
     if (this.AppSuggestionInfo.ExtraPayload.ContainsKey("click_generic_action") && (EnumHelper.Parse <GenericAction>(this.AppSuggestionInfo.ExtraPayload["click_generic_action"], GenericAction.None) & (GenericAction.SettingsMenu | GenericAction.KeyBasedPopup | GenericAction.OpenSystemApp)) != (GenericAction)0)
     {
         this.mIsAppRemovable     = false;
         this.AppNameTextWrapping = TextWrapping.NoWrap;
         this.AppNameTextTrimming = TextTrimming.None;
     }
     this.mIsAppInstalled = false;
     this.mPromotionId    = this.AppSuggestionInfo.AppIconId;
     if (this.AppSuggestionInfo.AppIcon.EndsWith(".gif", StringComparison.InvariantCulture))
     {
         this.IsGifIcon = true;
     }
     this.ImageName = this.AppSuggestionInfo.AppIconPath;
     if (!this.AppSuggestionInfo.IsIconBorder)
     {
         return;
     }
     this.ApplyBorder(Path.Combine(RegistryStrings.PromotionDirectory, string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0}{1}.png", (object)this.AppSuggestionInfo.IconBorderId, (object)"app_suggestion_icon_border")));
 }
Exemplo n.º 2
0
 internal void AddPromotionBorderInstalledApp(AppSuggestionPromotion appSuggestionInfo)
 {
     this.AppSuggestionInfo = appSuggestionInfo;
     if (!this.AppSuggestionInfo.IsIconBorder)
     {
         return;
     }
     this.ApplyBorder(this.AppSuggestionInfo.IconBorderId + "app_suggestion_icon_border");
 }
        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());
            }
        }
 internal void OpenAppSuggestionPopup(
     AppSuggestionPromotion appInfoForShowingPopup,
     UIElement appNameTextBlock,
     bool staysOpen = true)
 {
     if (this.mHomeApp == null || appInfoForShowingPopup.ToolTip == null)
     {
         return;
     }
     this.mHomeApp.mSuggestedAppPopUp.PlacementTarget = appNameTextBlock;
     this.mHomeApp.mSuggestedAppPopUp.IsOpen          = true;
     this.mHomeApp.mSuggestedAppPopUp.StaysOpen       = staysOpen;
     this.mHomeApp.mAppSuggestionPopUp.Text           = appInfoForShowingPopup.ToolTip;
 }