示例#1
0
        async void getCartCountHomeOnly(App app = null)
        {
            Application.Current.Properties["cart_count"] = "0";
            Application.Current.Properties["fav_count"]  = "0";
            try
            {
                if (Application.Current.Properties.ContainsKey("user_id"))
                {
                    var response = await CartLogic.CartCount(Application.Current.Properties["user_id"].ToString());

                    if (response.status == 200)
                    {
                        Application.Current.Properties["cart_count"] = response.cart_count.ToString();
                        Application.Current.Properties["fav_count"]  = response.fav_count.ToString();
                        CartCount = Application.Current.Properties["cart_count"].ToString();
                        FavCount  = Application.Current.Properties["fav_count"].ToString();
                        OnPropertyChanged(nameof(CartCount));
                        OnPropertyChanged(nameof(FavCount));
                    }
                }
            }
            catch (Exception ex)
            {
                Config.ErrorStore("BadgesVM-getCartCountHomeOnly", ex.Message);
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
        }