示例#1
0
 public void AsyncGetDiamondShoppingItems(DiamondsShoppingItemType itemType)
 {
     if (GlobalData.Client != null)
     {
         App.BusyToken.ShowBusyWindow("正在加载虚拟商品...");
         GlobalData.Client.GetDiamondShoppingItems(true, SellState.OnSell, itemType);
     }
 }
        public EditDiamondShoppingItemWindow(DiamondsShoppingItemType itemType)
        {
            InitializeComponent();
            this.Title = "添加钻石商品";
            isAdd      = true;
            _syn       = SynchronizationContext.Current;
            Init();
            this.cmbItemType.SelectedValue = (int)itemType;

            GlobalData.Client.AddDiamondShoppingItemCompleted += Client_AddDiamondShoppingItemCompleted;
        }
示例#3
0
        public DiamondShoppingItem[] GetDiamondShoppingItems(bool getAllSellState, SellState state, DiamondsShoppingItemType itemType)
        {
            DiamondShoppingItem[] items = DBProvider.DiamondShoppingDBProvider.GetDiamondShoppingItems(getAllSellState, state, itemType);
            if (items == null)
            {
                return(items);
            }

            foreach (var item in items)
            {
                string filePath = Path.Combine(GetShoppingItemDirPath(item.Name), item.Name.GetHashCode().ToString() + ".jpg");

                if (File.Exists(filePath))
                {
                    using (FileStream stream = new FileStream(filePath, FileMode.Open))
                    {
                        item.IconBuffer = new byte[stream.Length];
                        stream.Read(item.IconBuffer, 0, (int)stream.Length);
                    }
                }
            }

            return(items);
        }
示例#4
0
 public void GetDiamondShoppingItems(DiamondsShoppingItemType itemType)
 {
     this._invoker.Invoke <DiamondShoppingItem[]>(this._context, "GetDiamondShoppingItems", this.GetDiamondShoppingItemsCompleted, GlobalData.Token, itemType);
 }
示例#5
0
 public void AsyncGetDiamondShoppingItem(DiamondsShoppingItemType itemType)
 {
     App.BusyToken.ShowBusyWindow("正在加载钻石商品...");
     GlobalData.Client.GetDiamondShoppingItems(itemType);
 }
示例#6
0
 public void GetDiamondShoppingItems(bool getAllSellState, MetaData.Shopping.SellState state, DiamondsShoppingItemType itemType)
 {
     this._invoker.Invoke <DiamondShoppingItem[]>(this._context, "GetDiamondShoppingItems", this.GetDiamondShoppingItemsCompleted, GlobalData.Token, getAllSellState, state, itemType);
 }
        public DiamondShoppingItem[] GetDiamondShoppingItems(bool getAllSellState, SellState state, DiamondsShoppingItemType itemType)
        {
            DiamondShoppingItem[] items = null;
            MyDBHelper.Instance.ConnectionCommandSelect(mycmd =>
            {
                string sqlText = "select * from diamondshoppingitem where `Type`=@Type ";
                mycmd.Parameters.AddWithValue("@Type", (int)itemType);
                if (!getAllSellState)
                {
                    sqlText += " and SellState=@SellState ";
                    mycmd.Parameters.AddWithValue("@SellState", (int)state);
                }
                mycmd.CommandText        = sqlText;
                DataTable table          = new DataTable();
                MySqlDataAdapter adapter = new MySqlDataAdapter(mycmd);
                adapter.Fill(table);
                items = MetaDBAdapter <DiamondShoppingItem> .GetDiamondShoppingItemFromDataTable(table);
                table.Dispose();
                adapter.Dispose();
            });

            return(items);
        }
 public MetaData.Shopping.DiamondShoppingItem[] GetDiamondShoppingItems(string token, DiamondsShoppingItemType itemType)
 {
     if (RSAProvider.LoadRSA(token))
     {
         try
         {
             return(DiamondShoppingController.Instance.GetDiamondShoppingItems(false, SellState.OnSell, itemType));
         }
         catch (Exception exc)
         {
             LogHelper.Instance.AddErrorLog("GetDiamondShoppingItems Exception. ClientIP=" + ClientManager.GetClientIP(token), exc);
             return(null);
         }
     }
     else
     {
         throw new Exception();
     }
 }