internal void SetDefaultMyAppsOrder(bool overwrite = true)
        {
            if (!(this.MyAppsOrder.Count == 0 | overwrite))
            {
                return;
            }
            SerializableDictionary <string, int> myAppsOrder            = this.MyAppsOrder;
            SerializableDictionary <string, int> serializableDictionary = new SerializableDictionary <string, int>();

            serializableDictionary.Add("com.android.vending", 1);
            myAppsOrder.ClearAddRange <string, int>((Dictionary <string, int>)serializableDictionary);
        }
        internal void SetDefaultDockOrder(bool overwrite = true)
        {
            if (!(this.DockOrder.Count == 0 | overwrite))
            {
                return;
            }
            SerializableDictionary <string, int> dockOrder = this.DockOrder;
            SerializableDictionary <string, int> serializableDictionary = new SerializableDictionary <string, int>();

            serializableDictionary.Add("appcenter", 1);
            serializableDictionary.Add("pikaworld", 2);
            dockOrder.ClearAddRange <string, int>((Dictionary <string, int>)serializableDictionary);
        }
        internal void SetDefaultMoreAppsOrder(bool overwrite = true)
        {
            if (!(this.MoreAppsDockOrder.Count == 0 | overwrite))
            {
                return;
            }
            SerializableDictionary <string, int> moreAppsDockOrder      = this.MoreAppsDockOrder;
            SerializableDictionary <string, int> serializableDictionary = new SerializableDictionary <string, int>();

            serializableDictionary.Add("com.android.chrome", 2);
            serializableDictionary.Add("com.android.camera2", 2);
            serializableDictionary.Add("com.bluestacks.settings", 3);
            serializableDictionary.Add("com.bluestacks.filemanager", 4);
            serializableDictionary.Add("instance_manager", 5);
            serializableDictionary.Add("help_center", 6);
            moreAppsDockOrder.ClearAddRange <string, int>((Dictionary <string, int>)serializableDictionary);
        }
        internal static void HandleGenericNotification(JObject resJson, string vmName)
        {
            GenericNotificationItem genericItem = new GenericNotificationItem();

            try
            {
                JObject resJson1 = JObject.Parse(resJson["bluestacks_notification"][(object)"payload"][(object)"GenericNotificationItem"].ToString());
                resJson1.AssignIfContains <string>("id", (System.Action <string>)(x => genericItem.Id             = x));
                resJson1.AssignIfContains <string>("priority", (System.Action <string>)(x => genericItem.Priority = EnumHelper.Parse <NotificationPriority>(x, NotificationPriority.Normal)));
                resJson1.AssignIfContains <string>("title", (System.Action <string>)(x => genericItem.Title       = x));
                resJson1.AssignIfContains <string>("message", (System.Action <string>)(x => genericItem.Message   = x));
                resJson1.AssignIfContains <bool>("showribbon", (System.Action <bool>)(x => genericItem.ShowRibbon = x));
                resJson1.AssignIfContains <string>("menuimagename", (System.Action <string>)(x => genericItem.NotificationMenuImageName = x));
                resJson1.AssignIfContains <string>("menuimageurl", (System.Action <string>)(x => genericItem.NotificationMenuImageUrl   = x));
                resJson1.AssignIfContains <bool>("isread", (System.Action <bool>)(x => genericItem.IsRead                 = x));
                resJson1.AssignIfContains <bool>("isdeleted", (System.Action <bool>)(x => genericItem.IsDeleted           = x));
                resJson1.AssignIfContains <bool>("deferred", (System.Action <bool>)(x => genericItem.IsDeferred           = x));
                resJson1.AssignIfContains <string>("creationtime", (System.Action <string>)(x => genericItem.CreationTime = DateTime.ParseExact(x, "yyyy/MM/dd HH:mm:ss", (IFormatProvider)CultureInfo.InvariantCulture)));
                if (!string.IsNullOrEmpty(genericItem.NotificationMenuImageName) && !string.IsNullOrEmpty(genericItem.NotificationMenuImageUrl))
                {
                    genericItem.NotificationMenuImageName = Utils.TinyDownloader(genericItem.NotificationMenuImageUrl, genericItem.NotificationMenuImageName, RegistryStrings.PromotionDirectory, false);
                }
                if (resJson1["ExtraPayload"] != null && !JsonExtensions.IsNullOrEmptyBrackets(resJson1.GetValue("ExtraPayload", StringComparison.InvariantCulture).ToString()))
                {
                    resJson1["ExtraPayload"].AssignIfContains <string>("payloadtype", (System.Action <string>)(x => genericItem.PayloadType = EnumHelper.Parse <NotificationPayloadType>(x, NotificationPayloadType.Generic)));
                    SerializableDictionary <string, string> extraPayload = genericItem.ExtraPayload;
                    if (extraPayload != null)
                    {
                        extraPayload.ClearAddRange <string, string>((Dictionary <string, string>)CloudNotificationManager.HandleExtraPayload(resJson1.GetValue("ExtraPayload", StringComparison.InvariantCulture).ToObject <JObject>(), genericItem.PayloadType));
                    }
                }
                ClientStats.SendMiscellaneousStatsAsync("notification_received", RegistryManager.Instance.UserGuid, RegistryManager.Instance.ClientVersion, genericItem.Id, genericItem.Title, genericItem.ExtraPayload.ContainsKey("campaign_id") ? genericItem.ExtraPayload["campaign_id"] : "", (string)null, (string)null, (string)null, "Android");
                genericItem.IsReceivedStatSent = true;
                if (resJson1["conditions"] != null && !JsonExtensions.IsNullOrEmptyBrackets(resJson1.GetValue("conditions", StringComparison.InvariantCulture).ToString()))
                {
                    resJson1["conditions"].AssignIfContains <string>("app_pkg_on_top", (System.Action <string>)(x => genericItem.DeferredApp     = x));
                    resJson1["conditions"].AssignIfContains <long>("app_usage_seconds", (System.Action <long>)(x => genericItem.DeferredAppUsage = x));
                }
                if (genericItem.ShowRibbon)
                {
                    if (resJson["bluestacks_notification"][(object)"payload"].ToObject <JObject>()["RibbonDesign"] != null)
                    {
                        if (!JsonExtensions.IsNullOrEmptyBrackets(resJson["bluestacks_notification"][(object)"payload"].GetValue("RibbonDesign")))
                        {
                            genericItem.NotificationDesignItem = new GenericNotificationDesignItem();
                            JObject resJson2 = JObject.Parse(resJson["bluestacks_notification"][(object)"payload"][(object)"RibbonDesign"].ToString());
                            resJson2.AssignIfContains <string>("titleforegroundcolor", (System.Action <string>)(x => genericItem.NotificationDesignItem.TitleForeGroundColor     = x));
                            resJson2.AssignIfContains <string>("messageforegroundcolor", (System.Action <string>)(x => genericItem.NotificationDesignItem.MessageForeGroundColor = x));
                            resJson2.AssignIfContains <string>("bordercolor", (System.Action <string>)(x => genericItem.NotificationDesignItem.BorderColor           = x));
                            resJson2.AssignIfContains <string>("ribboncolor", (System.Action <string>)(x => genericItem.NotificationDesignItem.Ribboncolor           = x));
                            resJson2.AssignIfContains <double>("auto_hide_timer", (System.Action <double>)(x => genericItem.NotificationDesignItem.AutoHideTime      = x));
                            resJson2.AssignIfContains <string>("hoverbordercolor", (System.Action <string>)(x => genericItem.NotificationDesignItem.HoverBorderColor = x));
                            resJson2.AssignIfContains <string>("hoverribboncolor", (System.Action <string>)(x => genericItem.NotificationDesignItem.HoverRibboncolor = x));
                            resJson2.AssignIfContains <string>("leftgifname", (System.Action <string>)(x => genericItem.NotificationDesignItem.LeftGifName           = x));
                            resJson2.AssignIfContains <string>("leftgifurl", (System.Action <string>)(x => genericItem.NotificationDesignItem.LeftGifUrl             = x));
                            if (!string.IsNullOrEmpty(genericItem.NotificationDesignItem.LeftGifName) && !string.IsNullOrEmpty(genericItem.NotificationDesignItem.LeftGifUrl))
                            {
                                Utils.TinyDownloader(genericItem.NotificationDesignItem.LeftGifUrl, genericItem.NotificationDesignItem.LeftGifName, RegistryStrings.PromotionDirectory, false);
                            }
                            if (resJson2["background_gradient"] != null)
                            {
                                foreach (JObject jobject in JArray.Parse(resJson2["background_gradient"].ToString()).ToObject <List <JObject> >())
                                {
                                    genericItem.NotificationDesignItem.BackgroundGradient.Add(new SerializableKeyValuePair <string, double>(jobject["color"].ToString(), jobject["offset"].ToObject <double>()));
                                }
                            }
                            if (resJson2["hover_background_gradient"] != null)
                            {
                                foreach (JObject jobject in JArray.Parse(resJson2["hover_background_gradient"].ToString()).ToObject <List <JObject> >())
                                {
                                    genericItem.NotificationDesignItem.HoverBackGroundGradient.Add(new SerializableKeyValuePair <string, double>(jobject["color"].ToString(), jobject["offset"].ToObject <double>()));
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error("Exception while parsing generic notification. Not showing notification and not adding in notification menu." + ex.ToString());
                return;
            }
            try
            {
                if (string.IsNullOrEmpty(genericItem.Title) && string.IsNullOrEmpty(genericItem.Message))
                {
                    genericItem.IsDeleted = true;
                }
                if (!genericItem.IsDeferred)
                {
                    GenericNotificationManager.AddNewNotification(genericItem, false);
                }
                if (genericItem.ShowRibbon && resJson["bluestacks_notification"][(object)"payload"].ToObject <JObject>()["RibbonDesign"] != null && !JsonExtensions.IsNullOrEmptyBrackets(resJson["bluestacks_notification"][(object)"payload"].GetValue("RibbonDesign")))
                {
                    if (!genericItem.IsDeferred)
                    {
                        BlueStacksUIUtils.DictWindows[vmName].HandleGenericNotificationPopup(genericItem);
                    }
                    else
                    {
                        CloudNotificationManager.HandleDeferredNotification(genericItem);
                    }
                }
                BlueStacksUIUtils.DictWindows[vmName].mTopBar.RefreshNotificationCentreButton();
            }
            catch (Exception ex)
            {
                Logger.Error("Exception when handling notification json. Id " + genericItem.Id + " Error: " + ex.ToString());
            }
        }