コード例 #1
0
        public void Download(string sessionHandler, DataGrid DownloadedAuctionData, AllegroWebApiService service)
        {
            try
            {
                accountStructTable = service.doMyAccount2(sessionHandler, "sell", (int)offset, auctionsID, 100);
            }
            catch
            {
                //Shower.Dispatcher.Invoke(delegate { Shower.Items.Add("Nie można sprawdzić obecnych aukcji"); });
                MessageBoxResult wrongResult = MessageBox.Show("Błąd podczas pobierania aukcji", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                if (wrongResult == MessageBoxResult.OK)
                {
                    return;
                }
            }

            foreach (MyAccountStruct2 accountStruct in accountStructTable)
            {
                DownloadedAuctionData.Dispatcher.Invoke(delegate
                {
                    DownloadedAuctionData.Items.Add(new DataGridItem()
                    {
                        Column1  = accountStruct.myaccountarray[9],
                        Column2  = accountStruct.myaccountarray[33],
                        Column10 = accountStruct.myaccountarray[27],
                        Column3  = accountStruct.myaccountarray[4] + " zł",
                        Column4  = accountStruct.myaccountarray[17],
                        Column5  = accountStruct.myaccountarray[16],
                        Column6  = accountStruct.myaccountarray[0],
                        Column7  = accountStruct.myaccountarray[6],
                        Column8  = accountStruct.myaccountarray[7],
                    });
                });
            }
        }
コード例 #2
0
        /// <summary>
        /// Connect to SOAP service and retrieve list of auctions
        /// </summary>
        /// <param name="type">Auction collection to retrieve</param>
        /// <returns></returns>
        private List <String> getRawData(String type)
        {
            List <String> rawData = new List <String>();
            long          userid;
            long          servertime;

            //connect to Allegro
            String sessionHandle = sessionHandle = allegroWebApiService.doLogin(data.userLogin, data.userPassword, data.countryCode, data.webapiKey, data.localVersion, out userid, out servertime);

            //data are retrieved in chunks of 100. Loop and retrieve all data
            bool endOfData = false;
            int  start     = 0;

            while (!endOfData)
            {
                //get structure containing all the data
                MyAccountStruct2[] results = allegroWebApiService.doMyAccount2(sessionHandle, type, start, new int[] { }, 100);
                start += 100;

                //Are there any data to retrieve left?
                if (results.Length == 0)
                {
                    endOfData = true;
                }

                //add all returend items' id and title to list
                foreach (MyAccountStruct2 result in results)
                {
                    rawData.Add(result.myaccountarray[MYACCOUNTSTRUCT_ID_INDEX] + "-" + result.myaccountarray[MYACCOUNTSTRUCT_TITLE_INDEX]);
                }
            }

            return(rawData);
        }