G
Guest
Hi Dear MVP's and Everyone,
I am writing a program that gets some information from a web service using a
callback function. When the callback function receives the necessary
information, it updates the items in the listview first removing the item to
be updated from the list
at the specified index and then inserting it at the top of the list. Unless
the number of updates to be received is zero, the callback function calls the
BeginXXX web method iteratively. The problem occurs when the program tries to
update the last
item. The execution freezes at the step where the last item is removed from
the list. The same thing happens when the item to be updated is the first
item in the list. However there won't be any problem when the item is updated
without being removed or a new item is added. I applied the CF SP3 but this
time I receive WebException when the program tries to send some information
to the web service. I am using Asus MyPal PDA and I extracted the
netcf.all.wce4.arm4.cab to apply the service pack. Inserting a dummy item at
the end of the list won't work. Locking the ListView control while doing the
process won't work, either. The code of the callback function is like the
following:
private void WsGeriÇağrı(IAsyncResult ar)
{
int i;
kahveWR.Siparişİçeriği sipariş; /* the update information received from
the web service */
gws=(kahveWR.KahveWebService)ar.AsyncState;
sipariş=(kahveWR.Siparişİçeriği)gws.EndGetOrder(ar);
i=ListedekiYeri(sipariş.Ürün,1); /* the index of the item to be updated in
the list is found here */
ListViewItem madde=new ListViewItem(sipariş.Ürün);
madde.SubItems.Add(sipariÅŸ.Adet.ToString());
madde.SubItems.Add(this.listView1.Items.SubItems[2].Text);
madde.ImageIndex=2;
this.listView1.Items.RemoveAt(i); /* this is the line where execution
freezes */
this.listView1.Items.Insert(0,madde);
siparişSayısı--; /* variable holding the number of items to be updated */
label1.Text=siparişSayısı.ToString();
if (siparişSayısı>0)
geriSonuç=ws.BeginGetOrder("Melike Öztürk",geriÇağrı,ws); /* calling the
web method again */
else
servisÇağrıldı=false;
}
I don't have any idea what the solution might be. Do you have friends?
I am writing a program that gets some information from a web service using a
callback function. When the callback function receives the necessary
information, it updates the items in the listview first removing the item to
be updated from the list
at the specified index and then inserting it at the top of the list. Unless
the number of updates to be received is zero, the callback function calls the
BeginXXX web method iteratively. The problem occurs when the program tries to
update the last
item. The execution freezes at the step where the last item is removed from
the list. The same thing happens when the item to be updated is the first
item in the list. However there won't be any problem when the item is updated
without being removed or a new item is added. I applied the CF SP3 but this
time I receive WebException when the program tries to send some information
to the web service. I am using Asus MyPal PDA and I extracted the
netcf.all.wce4.arm4.cab to apply the service pack. Inserting a dummy item at
the end of the list won't work. Locking the ListView control while doing the
process won't work, either. The code of the callback function is like the
following:
private void WsGeriÇağrı(IAsyncResult ar)
{
int i;
kahveWR.Siparişİçeriği sipariş; /* the update information received from
the web service */
gws=(kahveWR.KahveWebService)ar.AsyncState;
sipariş=(kahveWR.Siparişİçeriği)gws.EndGetOrder(ar);
i=ListedekiYeri(sipariş.Ürün,1); /* the index of the item to be updated in
the list is found here */
ListViewItem madde=new ListViewItem(sipariş.Ürün);
madde.SubItems.Add(sipariÅŸ.Adet.ToString());
madde.SubItems.Add(this.listView1.Items.SubItems[2].Text);
madde.ImageIndex=2;
this.listView1.Items.RemoveAt(i); /* this is the line where execution
freezes */
this.listView1.Items.Insert(0,madde);
siparişSayısı--; /* variable holding the number of items to be updated */
label1.Text=siparişSayısı.ToString();
if (siparişSayısı>0)
geriSonuç=ws.BeginGetOrder("Melike Öztürk",geriÇağrı,ws); /* calling the
web method again */
else
servisÇağrıldı=false;
}
I don't have any idea what the solution might be. Do you have friends?