Beispiel #1
0
        private void SendAppRecommendationsImpressionStats()
        {
            JArray jarray = new JArray();
            RecommendedAppsSection child1 = this.mAppRecommendationSectionsPanel.Children[0] as RecommendedAppsSection;

            for (int index = 0; index < child1.mAppRecommendationsPanel.Children.Count; ++index)
            {
                RecommendedApps child2  = child1.mAppRecommendationsPanel.Children[index] as RecommendedApps;
                JObject         jobject = new JObject()
                {
                    {
                        "app_loc",
                        (JToken)(child2.AppRecomendation.ExtraPayload["click_generic_action"] == "InstallCDN" ? "cdn" : "gplay")
                    },
                    {
                        "app_pkg",
                        (JToken)child2.AppRecomendation.ExtraPayload["click_action_packagename"]
                    },
                    {
                        "is_installed",
                        (JToken)(this.ParentWindow.mAppHandler.IsAppInstalled(child2.AppRecomendation.ExtraPayload["click_action_packagename"]) ? "true" : "false")
                    },
                    {
                        "app_position",
                        (JToken)child2.RecommendedAppPosition.ToString((IFormatProvider)CultureInfo.InvariantCulture)
                    },
                    {
                        "app_rank",
                        (JToken)child2.RecommendedAppRank.ToString((IFormatProvider)CultureInfo.InvariantCulture)
                    }
                };
                jarray.Add((JToken)jobject);
            }
            ClientStats.SendFrontendClickStats("apps_recommendation", "impression", (string)null, (string)null, (string)null, (string)null, (string)null, jarray.ToString(Formatting.None));
        }
Beispiel #2
0
        internal void UpdateRecommendedAppsInstallStatus(string package)
        {
            if (this.mAppRecommendationSectionsPanel.Children.Count <= 0)
            {
                return;
            }
            int index1 = -1;
            RecommendedAppsSection child1           = this.mAppRecommendationSectionsPanel.Children[0] as RecommendedAppsSection;
            RecommendedApps        recommendedApps1 = (RecommendedApps)null;

            for (int index2 = 0; index2 < child1.mAppRecommendationsPanel.Children.Count; ++index2)
            {
                RecommendedApps child2 = child1.mAppRecommendationsPanel.Children[index2] as RecommendedApps;
                if (child2.AppRecomendation.AppPackage.Equals(package, StringComparison.InvariantCultureIgnoreCase))
                {
                    index1           = index2;
                    recommendedApps1 = child2;
                    break;
                }
            }
            if (index1 == -1)
            {
                return;
            }
            child1.mAppRecommendationsPanel.Children.RemoveAt(index1);
            if (this.sAppRecommendationsPool.Count > 0)
            {
                int count = 1;
                for (int index2 = 0; index2 < this.sAppRecommendationsPool.Count; ++index2)
                {
                    RecommendedApps recommendedApps2 = this.sAppRecommendationsPool[index2];
                    if (!this.ParentWindow.mAppHandler.IsAppInstalled(recommendedApps2.AppRecomendation.ExtraPayload["click_action_packagename"]))
                    {
                        recommendedApps2.RecommendedAppPosition = recommendedApps1.RecommendedAppPosition;
                        child1.mAppRecommendationsPanel.Children.Insert(index1, (UIElement)recommendedApps2);
                        JArray  jarray   = new JArray();
                        JObject jobject1 = new JObject();
                        jobject1.Add("app_loc", (JToken)(recommendedApps2.AppRecomendation.ExtraPayload["click_generic_action"] == "InstallCDN" ? "cdn" : "gplay"));
                        jobject1.Add("app_pkg", (JToken)recommendedApps2.AppRecomendation.ExtraPayload["click_action_packagename"]);
                        jobject1.Add("is_installed", (JToken)(this.ParentWindow.mAppHandler.IsAppInstalled(recommendedApps2.AppRecomendation.ExtraPayload["click_action_packagename"]) ? "true" : "false"));
                        int num = recommendedApps2.RecommendedAppPosition;
                        jobject1.Add("app_position", (JToken)num.ToString((IFormatProvider)CultureInfo.InvariantCulture));
                        num = recommendedApps2.RecommendedAppRank;
                        jobject1.Add("app_rank", (JToken)num.ToString((IFormatProvider)CultureInfo.InvariantCulture));
                        JObject jobject2 = jobject1;
                        jarray.Add((JToken)jobject2);
                        ClientStats.SendFrontendClickStats("apps_recommendation", "impression", (string)null, (string)null, (string)null, (string)null, (string)null, jarray.ToString(Formatting.None));
                        break;
                    }
                    ++count;
                }
                this.sAppRecommendationsPool.RemoveRange(0, count);
            }
            if (child1.mAppRecommendationsPanel.Children.Count == 0)
            {
                this.mAppRecommendationSectionsPanel.Children.Remove((UIElement)child1);
            }
            if (this.mAppRecommendationSectionsPanel.Children.Count != 0)
            {
                return;
            }
            this.mAppRecommendationSectionsPanel.Visibility    = Visibility.Collapsed;
            this.mAppRecommendationsGenericMessages.Visibility = Visibility.Visible;
        }
Beispiel #3
0
 private void ShowAppRecommendations(bool isContentReloadRequired)
 {
     try
     {
         this.Dispatcher.Invoke((Delegate)(() =>
         {
             if (this.ParentWindow != null && this.ParentWindow.ActualWidth <= 700.0 || (FeatureManager.Instance.IsCustomUIForDMMSandbox || !FeatureManager.Instance.IsSearchBarVisible) || RegistryManager.Instance.InstallationType == InstallationTypes.GamingEdition)
             {
                 if (this.mCurrentSidePanelVisibility.HasValue)
                 {
                     SidePanelVisibility?sidePanelVisibility1 = this.mCurrentSidePanelVisibility;
                     SidePanelVisibility sidePanelVisibility2 = SidePanelVisibility.BothSearchBarAndSidepanelHidden;
                     if (sidePanelVisibility1.GetValueOrDefault() == sidePanelVisibility2 & sidePanelVisibility1.HasValue)
                     {
                         return;
                     }
                 }
                 this.ChangeSideRecommendationsVisibility(false, false);
                 this.mCurrentSidePanelVisibility = new SidePanelVisibility?(SidePanelVisibility.BothSearchBarAndSidepanelHidden);
             }
             else
             {
                 if (!RegistryManager.Instance.IsPremium)
                 {
                     if (!FeatureManager.Instance.IsHtmlSideBar)
                     {
                         if (FeatureManager.Instance.IsShowAppRecommendations)
                         {
                             AppRecommendationSection appRecommendations = PromotionObject.Instance.AppRecommendations;
                             if ((appRecommendations != null ? (appRecommendations.AppSuggestions.Count == 0 ? 1 : 0) : 0) != 0)
                             {
                                 goto label_8;
                             }
                         }
                         else
                         {
                             goto label_8;
                         }
                     }
                     if (FeatureManager.Instance.IsHtmlSideBar)
                     {
                         if (!this.SideHtmlBrowserInited)
                         {
                             this.InitiateSideHtmlBrowser();
                         }
                         if (RegistryManager.Instance.IsPremium)
                         {
                             return;
                         }
                         if (this.mCurrentSidePanelVisibility.HasValue)
                         {
                             SidePanelVisibility?sidePanelVisibility1 = this.mCurrentSidePanelVisibility;
                             SidePanelVisibility sidePanelVisibility2 = SidePanelVisibility.OnlySidepanelVisible;
                             if (sidePanelVisibility1.GetValueOrDefault() == sidePanelVisibility2 & sidePanelVisibility1.HasValue)
                             {
                                 return;
                             }
                         }
                         this.ChangeSideRecommendationsVisibility(true, false);
                         this.mCurrentSidePanelVisibility = new SidePanelVisibility?(SidePanelVisibility.OnlySidepanelVisible);
                         return;
                     }
                     if (isContentReloadRequired || !this.mIsSidePanelContentLoadedOnce)
                     {
                         this.mAppRecommendationSectionsPanel.Children.Clear();
                         AppRecommendationSection appRecommendations = PromotionObject.Instance.AppRecommendations;
                         RecommendedAppsSection recommendedAppsSection = new RecommendedAppsSection(appRecommendations.AppSuggestionHeader);
                         recommendedAppsSection.AddSuggestedApps(this.ParentWindow, appRecommendations.AppSuggestions, appRecommendations.ClientShowCount);
                         if (recommendedAppsSection.mAppRecommendationsPanel.Children.Count != 0)
                         {
                             this.mAppRecommendationSectionsPanel.Children.Add((UIElement)recommendedAppsSection);
                             this.mAppRecommendationSectionsPanel.Visibility = Visibility.Visible;
                             this.mAppRecommendationsGenericMessages.Visibility = Visibility.Collapsed;
                             this.SendAppRecommendationsImpressionStats();
                         }
                         this.mIsSidePanelContentLoadedOnce = true;
                     }
                     if (this.mCurrentSidePanelVisibility.HasValue)
                     {
                         SidePanelVisibility?sidePanelVisibility1 = this.mCurrentSidePanelVisibility;
                         SidePanelVisibility sidePanelVisibility2 = SidePanelVisibility.BothSearchBarAndSidepanelVisible;
                         if (sidePanelVisibility1.GetValueOrDefault() == sidePanelVisibility2 & sidePanelVisibility1.HasValue)
                         {
                             return;
                         }
                     }
                     this.ChangeSideRecommendationsVisibility(true, true);
                     this.mCurrentSidePanelVisibility = new SidePanelVisibility?(SidePanelVisibility.BothSearchBarAndSidepanelVisible);
                     return;
                 }
                 label_8:
                 if (this.mCurrentSidePanelVisibility.HasValue)
                 {
                     SidePanelVisibility?sidePanelVisibility1 = this.mCurrentSidePanelVisibility;
                     SidePanelVisibility sidePanelVisibility2 = SidePanelVisibility.OnlySearchBarVisible;
                     if (sidePanelVisibility1.GetValueOrDefault() == sidePanelVisibility2 & sidePanelVisibility1.HasValue)
                     {
                         return;
                     }
                 }
                 this.ChangeSideRecommendationsVisibility(false, true);
                 this.mCurrentSidePanelVisibility = new SidePanelVisibility?(SidePanelVisibility.OnlySearchBarVisible);
             }
         }));
     }
     catch (Exception ex)
     {
         Logger.Warning("Exception in showing app recommendations, " + ex.ToString());
     }
 }