Click here to Skip to main content
15,907,910 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: GUI updations on socket callback Pin
Michael Sync12-Aug-09 3:21
Michael Sync12-Aug-09 3:21 
GeneralRe: GUI updations on socket callback Pin
JS 200812-Aug-09 19:11
JS 200812-Aug-09 19:11 
My scenario is like this.

SocketReceiveCallback(object sender, SocketAsyncEventArgs e )
{
// read data from e.Buffer.
if ( dataReceived == TotalDataSize ) // checks of the complete reception of one image
{
// update the GUI using the received data.
System.Diagnostics.Debug.WriteLine( “ received image “ );
Dispatcher.BeginInvoke(new DisplayImageDelgate(DislayImageData), imageData); // imageData is a class containing the received data

}
Else
{
// call socket.receiveAsync() to get next set of data.
}
}


private void DisplayImageData (MyImageData data)
{
if (data.ImageStream != null)
{

BitmapImage bmp = new BitmapImage();
bmp.SetSource(new MemoryStream(data.ImageStream));
myReceivedImageCtrl.Source = bmp; //GUI update should happen at this point.
System.Diagnostics.Debug.WriteLine( “ Draw image “ );

}

}

Please note that my application, there is continues async requests to server ( corresponding to user action ) and server responds with a stream of image data( eg:- 100 images. The application needs to update the GUI immediately after each image is received ( even while the server streams the data). In the above case although the SocketReceiveCallback is getting the data continuously from server, the GUI update happens only after all the data receive is completed( which can take a long time ).
It seems that although the DisplayImage function is invoked using BeginInvoke, the system actually executes the display function at a later stage, causing ‘jumping’ image displays
The debug trace obtained was:-

received image
received image
received image
received image
Draw image
Draw image
Draw image


Instead of the needed

received image
Draw image
received image
Draw image
received image
Draw image


What could be done?
Thanks and Regards
JS
GeneralRe: GUI updations on socket callback Pin
Michael Sync14-Aug-09 4:10
Michael Sync14-Aug-09 4:10 
QuestionCancel rendering of a Control in Wpf Pin
jopiron12-Aug-09 0:25
jopiron12-Aug-09 0:25 
AnswerRe: Cancel rendering of a Control in Wpf Pin
Pete O'Hanlon12-Aug-09 0:37
mvePete O'Hanlon12-Aug-09 0:37 
GeneralRe: Cancel rendering of a Control in Wpf Pin
jopiron12-Aug-09 0:43
jopiron12-Aug-09 0:43 
GeneralRe: Cancel rendering of a Control in Wpf Pin
Pete O'Hanlon12-Aug-09 0:56
mvePete O'Hanlon12-Aug-09 0:56 
GeneralRe: Cancel rendering of a Control in Wpf Pin
jopiron12-Aug-09 1:32
jopiron12-Aug-09 1:32 
GeneralRe: Cancel rendering of a Control in Wpf Pin
jopiron12-Aug-09 1:52
jopiron12-Aug-09 1:52 
QuestionWhat do i need to install silverlight and make it run in visual studio2008 Pin
Andile.M11-Aug-09 22:44
Andile.M11-Aug-09 22:44 
AnswerRe: What do i need to install silverlight and make it run in visual studio2008 Pin
Pete O'Hanlon12-Aug-09 0:02
mvePete O'Hanlon12-Aug-09 0:02 
AnswerRe: What do i need to install silverlight and make it run in visual studio2008 Pin
Michael Sync12-Aug-09 3:18
Michael Sync12-Aug-09 3:18 
QuestionHow to use same usercontrol multiple time in the silverlight Pin
Nekkantidivya11-Aug-09 20:40
Nekkantidivya11-Aug-09 20:40 
AnswerRe: How to use same usercontrol multiple time in the silverlight Pin
Pete O'Hanlon11-Aug-09 21:45
mvePete O'Hanlon11-Aug-09 21:45 
AnswerRe: How to use same usercontrol multiple time in the silverlight Pin
Jeremy Likness13-Aug-09 5:32
professionalJeremy Likness13-Aug-09 5:32 
QuestionPositioning controls on a WPF form Pin
Etienne_12311-Aug-09 10:27
Etienne_12311-Aug-09 10:27 
AnswerRe: Positioning controls on a WPF form Pin
Mark Salsbery11-Aug-09 10:59
Mark Salsbery11-Aug-09 10:59 
GeneralRe: Positioning controls on a WPF form Pin
Etienne_12311-Aug-09 21:30
Etienne_12311-Aug-09 21:30 
QuestionRe: Positioning controls on a WPF form Pin
Mark Salsbery12-Aug-09 6:41
Mark Salsbery12-Aug-09 6:41 
GeneralRe: Positioning controls on a WPF form Pin
Pierre Leclercq15-Aug-09 0:53
Pierre Leclercq15-Aug-09 0:53 
AnswerRe: Positioning controls on a WPF form Pin
#realJSOP12-Aug-09 2:14
professional#realJSOP12-Aug-09 2:14 
GeneralRe: Positioning controls on a WPF form Pin
Pierre Leclercq15-Aug-09 0:44
Pierre Leclercq15-Aug-09 0:44 
GeneralRe: Positioning controls on a WPF form [modified] Pin
Mark Salsbery15-Aug-09 5:58
Mark Salsbery15-Aug-09 5:58 
GeneralRe: Positioning controls on a WPF form Pin
Pierre Leclercq15-Aug-09 6:26
Pierre Leclercq15-Aug-09 6:26 
QuestionHow to add runtime events for dynamic textbox controls in wpf [modified] Pin
Veerendranadh11-Aug-09 0:15
Veerendranadh11-Aug-09 0:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.