public PromotionControl() { this.InitializeComponent(); this.PromoControl = this; if (DesignerProperties.GetIsInDesignMode((DependencyObject)this.PromoControl)) { return; } if (!string.IsNullOrEmpty(RegistryManager.Instance.PromotionId) || FeatureManager.Instance.IsPromotionFixed) { this.mPromotionImage.ImageName = Path.Combine(RegistryManager.Instance.ClientInstallDir, "Promotions/promotion.jpg"); this.mPromotionImageGrid.Background = (Brush) new SolidColorBrush(Color.FromArgb(byte.MaxValue, (byte)0, (byte)0, (byte)0)); } this.mBootStringIndex = new Random().Next(this.mBootStrings.Count); this.mBootStringTimer.Tick += new EventHandler(this.BootStringTimer_Tick); this.mBootStringTimer.Interval = 3000; BlueStacksUIBinding.Bind(this.BootText, this.mBootStrings[this.mBootStringIndex], ""); int num = RegistryManager.Instance.AvgBootTime / 500; if (num <= 0) { RegistryManager.Instance.AvgBootTime = 20000; RegistryManager.Instance.NoOfBootCompleted = 0; num = 40; } this.progressTimer.Tick += new EventHandler(this.ProgressTimer_Tick); this.progressTimer.Interval = num; this.progressTimer.Start(); if (PromotionObject.Instance == null) { PromotionObject.LoadDataFromFile(); } PromotionObject.BootPromotionHandler += new EventHandler(this.PromotionControl_BootPromotionHandler); }
internal static void HandleGenericRedDotNotification(JObject resJson, string vmName) { JObject jobject = JObject.Parse(resJson["bluestacks_notification"][(object)"payload"][(object)"GenericRedDotNotificationItem"].ToString()); if (JsonExtensions.IsNullOrEmptyBrackets(jobject["nyapps_cross_promotion"].ToString())) { return; } PromotionManager.AddNewMyAppsCrossPromotion((JToken)jobject); PromotionObject.Save(); string appPackage = jobject["nyapps_cross_promotion"][(object)"app_pkg"].ToString(); BlueStacksUIUtils.DictWindows[vmName].Dispatcher.Invoke((Delegate)(() => BlueStacksUIUtils.DictWindows[vmName].mWelcomeTab.mHomeAppManager.AddIconWithRedDot(appPackage))); }
internal static void LoadDataFromFile() { try { if (!File.Exists(PromotionObject.FilePath)) { return; } string filePath = PromotionObject.FilePath; using (XmlReader xmlReader = XmlReader.Create(filePath, new XmlReaderSettings() { ProhibitDtd = true })) { Logger.Info("vikramTest: Loading PromotionObject Settings from " + PromotionObject.FilePath); PromotionObject.Instance = (PromotionObject) new XmlSerializer(typeof(PromotionObject)).Deserialize(xmlReader); Logger.Info("vikramTest: Done loading promotionObject."); PromotionObject.Instance.QuestHdPlayerRules.ClearSync <string, long>(); PromotionObject.Instance.QuestRules.ClearSync <QuestRule>(); PromotionObject.Instance.ResetQuestRules.ClearSync <string, long[]>(); } } catch (Exception ex) { Logger.Error("Error Loading PromotionObject Settings " + ex.ToString()); } finally { if (PromotionObject.Instance == null) { PromotionObject.Instance = new PromotionObject(); } if (PromotionObject.Instance.DockOrder.Count == 0) { PromotionObject.Instance.SetDefaultDockOrder(true); } PromotionObject.CacheOldBootPromotions(); } }