Google-Code-Fork / tibiaapi

Automatically exported from code.google.com/p/tibiaapi
MIT License
0 stars 0 forks source link

Website classes with multiple parallel asynchronous requests #49

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Website.GuildMembers returns a List<Website.CharInfo> but every CharInfo
only have the value name, the other values like level, profession,status
are not read.

It would also be nice to read if the Character status is online/offline.

Original issue reported on code.google.com by warma...@gmail.com on 9 Jun 2008 at 7:05

GoogleCodeExporter commented 9 years ago
I originally had it return a different object type with just the character 
details
shown on that page, but if I did that for every page there would be many 
different
objects. So,  I decided to just reuse CharInfo. Since Online/Offline status is 
not
available through the guild page, that information would not be available in 
such a
call. This is something you would have to do yourself, by looping through all 
the
names and fetching their respective pages using LookupPlayer.

Original comment by ian320 on 9 Jun 2008 at 7:20

GoogleCodeExporter commented 9 years ago
yea i tryed to make that way but it gives me an error, here's the code i use, 
maybe 
u know how to fix it;
After i load all the guild names into a grid in the first colum i try to  get 
the 
info of each character with this:
for (int i=0;i<gridgeneral.RowCount;i++)
            {
                Website.LookupPlayer(gridgeneral[0,i].Value.ToString(), delegate
(Website.CharInfo r)
                {
                    gridgeneral.Invoke(new EventHandler(delegate
                    {
                        gridgeneral[1, i].Value = r.Level;
                        gridgeneral[2, i].Value = r.Profession;
                        gridgeneral[3, i].Value = r.AccountStatus;
                    }));
                });
            }
but it gives this error: (translated from spanish xd) :IAsyncResult wasnt 
returned ; 
in this line of TibiaApi: HttpWebResponse response = 
(HttpWebResponse)request.EndGetResponse(ar);
maybe it's cos the bucle?

Original comment by warma...@gmail.com on 13 Jun 2008 at 3:31

GoogleCodeExporter commented 9 years ago
Fixed in r315. Your code should work perfectly now.

Original comment by ian320 on 16 Jun 2008 at 12:47