private async void AddToCartAsync()
        {
            try
            {
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Long);
                    return;
                }

                RestSharpService _restSharpService = new RestSharpService();

                string memberId       = GlobalVariables.LoggedUser.id.ToString();
                string productId      = Product.productId.ToString();
                string num            = ProductNum.ToString();
                string attributeValue = Product.itemAttributeValues[Index].attributeValue;

                SimpleRD simpleRD = await _restSharpService.AddToCart(memberId, productId, num, attributeValue);

                if (simpleRD.message == "success")
                {
                    CrossToastPopUp.Current.ShowToastSuccess("已添加到购物车!", ToastLength.Short);
                }
                else
                {
                    CrossToastPopUp.Current.ShowToastError("添加到购物车失败!", ToastLength.Long);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #2
0
        public void FillInfoByProductNum()
        {
            string deviceinfo = @"
谷微动漫|0003|超级抓神|gw_whwwj|00030001|礼品机|[详情](Device/0003/00030001/README.md)
油菜花|0001|芸苔盒子V1|ythzv1|00010001|支付盒子|[详情](Device/0001/00010001/README.md)
";

            string[] lines = deviceinfo.Split('\n');
            for (int i = 0; i < lines.Length; i++)
            {
                if (lines[i].Trim().Length < 10)
                {
                    continue;
                }
                string[] items = lines[i].Split('|');
                if (items[4] == ProductNum.ToString("X2").PadLeft(8, '0'))
                {
                    Manufacturers    = items[0];
                    ManufacturersNum = (uint)Int32.Parse(items[1], System.Globalization.NumberStyles.HexNumber);
                    Product          = items[2];
                }
            }
            if (string.IsNullOrEmpty(Manufacturers))
            {
                string productnum = ProductNum.ToString("X2").PadLeft(8, '0');
                Manufacturers    = $"未知厂商{productnum.Substring(0, 4)}";
                ManufacturersNum = (uint)Int32.Parse(productnum.Substring(0, 4), System.Globalization.NumberStyles.HexNumber);
                Product          = $"未知产品{productnum}";
            }
        }
Exemple #3
0
 private void ChangeButtonText()
 {
     if (ProductNum == TotalProductNum)
     {
         LoadMoreButtonText = ProductNum.ToString() + "/" + TotalProductNum.ToString() + "," + "已全部加载";
         ButtonIsEnable     = false;
     }
     else
     {
         LoadMoreButtonText = ProductNum.ToString() + "/" + TotalProductNum.ToString() + "," + "点击加载更多";
         ButtonIsEnable     = true;
     }
 }
Exemple #4
0
 public override string ToString()
 {
     return($"握手:设备编号:{ProductNum.ToString("X2").PadLeft(8,'0')},设备ID:{Utility.ByteToHex(DeviceID)},设备类型:{DeviceType}");
 }
Exemple #5
0
 public override string ToString()
 {
     return($"回应握手:设备编号:{ProductNum.ToString("X2").PadLeft(8, '0')},设备ID:{Utility.ByteToHex(DeviceID)},设备类型:{DeviceType},P位数:{GamePortCount},当前P位:{CurrGamePortIndex},游戏版本:{SoftVer},CNGPI:{GPIVersion}");
 }