Animation

  • Thread starter Thread starter Viper
  • Start date Start date
V

Viper

Hi,
I want to show an animated picture while I'm synchronising data. I'm using
the C# language on a Pocket PC 2003.
I tried to use a thread but when I saw that a thread can be started but not
aborted I changed my mind. So I went to the timer control of a form, this
did'nt work.
The last try was with the Timer class using the timerdelegate where I
changed the Image of a picture box every 200 ms. I have 8 images (embedded)
and each 200ms I want the next picture assigned to my picturebox.

This does not work neather.

Can any one help me solving this???

Thanks

Carlo
 
Thanks, this did solve the problem partially.
I mean, during the call of a webservice the animation stops until I got the
data from the weservice. Any idea how I can solve this. For the moment I did
initiate a llopcount of 5 and this way the animation wil run 5 times even if
the ata has already returned (so ready to use). It is faking a delay of
getting the data (just for show) and that is not what I really want.

Carlo
 
Try approaching it from a different angle - make the web service call
asynchronous using BeginXXX/EndXXX calls. Once BeginXXX has returned initate
the animation. When your callback is invoked, set a flag that stops
animation (and call Application.DoEvents to have it processed)
 
If I do this I do not get a result of the webservice
If I use the webservice normally like before I get the excepted data in the
dataset.
Here the code I use:
public void SyncEmployees()
{
PocketKilometer.PocketWebservices.PocketKilometer kmWebservice; // The
webservice returning a dataset
AsyncCallback asCb;
kmWebservice = new PocketKilometer.PocketWebservices.PocketKilometer();

asCb= new AsyncCallback(this.SyncComplete);
lblStatus.Text = "Synchronisation ....";
animateCtl1.StartAnimation();// Start the animation (loop = 0)
IAsyncResult asResult =
kmWebservice.BeginGetEmployees(asCb,kmWebservice); // Start the asynchronous
call to the webservice
}

///
/// The callback method for the async call of the webservice
///
public void SyncComplete(IAsyncResult ar)
{
PocketKilometer.PocketWebservices.PocketKilometer kmWebservice =
(PocketKilometer.PocketWebservices.PocketKilometer) ar.AsyncState;
DataTable dt = null;
dt = kmWebservice.EndGetEmployees(ar).Tables[0];
SyncDatabase(dt);
animateCtl1.StopAnimation();
animateCtl1.Show();
}

What's wrong????
 
The only thing that I see is wrong there is that you are trying to do things
with the Animate control inside the AsyncCallback.
You cannot do this - suchg things are done via Control.Invoke.

What exactly is returned by EndGetEmployees?

--
Alex Feinman
---
Visit http://www.opennetcf.org
Viper said:
If I do this I do not get a result of the webservice
If I use the webservice normally like before I get the excepted data in the
dataset.
Here the code I use:
public void SyncEmployees()
{
PocketKilometer.PocketWebservices.PocketKilometer kmWebservice; // The
webservice returning a dataset
AsyncCallback asCb;
kmWebservice = new PocketKilometer.PocketWebservices.PocketKilometer();

asCb= new AsyncCallback(this.SyncComplete);
lblStatus.Text = "Synchronisation ....";
animateCtl1.StartAnimation();// Start the animation (loop = 0)
IAsyncResult asResult =
kmWebservice.BeginGetEmployees(asCb,kmWebservice); // Start the asynchronous
call to the webservice
}

///
/// The callback method for the async call of the webservice
///
public void SyncComplete(IAsyncResult ar)
{
PocketKilometer.PocketWebservices.PocketKilometer kmWebservice =
(PocketKilometer.PocketWebservices.PocketKilometer) ar.AsyncState;
DataTable dt = null;
dt = kmWebservice.EndGetEmployees(ar).Tables[0];
SyncDatabase(dt);
animateCtl1.StopAnimation();
animateCtl1.Show();
}

What's wrong????

Alex Feinman said:
Try approaching it from a different angle - make the web service call
asynchronous using BeginXXX/EndXXX calls. Once BeginXXX has returned initate
the animation. When your callback is invoked, set a flag that stops
animation (and call Application.DoEvents to have it processed)

--
Alex Feinman
---
Visit http://www.opennetcf.org
got
the I
did even
http://msdn.microsoft.com/library/d...spx?guid=3a013afd-791e-45ef-802a-4c1dbe1cfef9
started
but
where
 
It si solved and the reason was that, like you said i did something with the
animationcontrol.

Thanks

Alex Feinman said:
The only thing that I see is wrong there is that you are trying to do things
with the Animate control inside the AsyncCallback.
You cannot do this - suchg things are done via Control.Invoke.

What exactly is returned by EndGetEmployees?

--
Alex Feinman
---
Visit http://www.opennetcf.org
Viper said:
If I do this I do not get a result of the webservice
If I use the webservice normally like before I get the excepted data in the
dataset.
Here the code I use:
public void SyncEmployees()
{
PocketKilometer.PocketWebservices.PocketKilometer kmWebservice; // The
webservice returning a dataset
AsyncCallback asCb;
kmWebservice = new PocketKilometer.PocketWebservices.PocketKilometer();

asCb= new AsyncCallback(this.SyncComplete);
lblStatus.Text = "Synchronisation ....";
animateCtl1.StartAnimation();// Start the animation (loop = 0)
IAsyncResult asResult =
kmWebservice.BeginGetEmployees(asCb,kmWebservice); // Start the asynchronous
call to the webservice
}

///
/// The callback method for the async call of the webservice
///
public void SyncComplete(IAsyncResult ar)
{
PocketKilometer.PocketWebservices.PocketKilometer kmWebservice =
(PocketKilometer.PocketWebservices.PocketKilometer) ar.AsyncState;
DataTable dt = null;
dt = kmWebservice.EndGetEmployees(ar).Tables[0];
SyncDatabase(dt);
animateCtl1.StopAnimation();
animateCtl1.Show();
}

What's wrong????

Alex Feinman said:
Try approaching it from a different angle - make the web service call
asynchronous using BeginXXX/EndXXX calls. Once BeginXXX has returned initate
the animation. When your callback is invoked, set a flag that stops
animation (and call Application.DoEvents to have it processed)

--
Alex Feinman
---
Visit http://www.opennetcf.org
Thanks, this did solve the problem partially.
I mean, during the call of a webservice the animation stops until I got
the
data from the weservice. Any idea how I can solve this. For the
moment
http://msdn.microsoft.com/library/d...spx?guid=3a013afd-791e-45ef-802a-4c1dbe1cfef9
 
Back
Top