leoiser
July 23rd, 2007, 01:34 AM
Hi,
I am doing an application that is using webservice & displaying data.So every 30 seconds the application will call webservice, I use system.Threading.Timer it is working fine.CPU usage is very less (maximum 30).I got an additional task to play video files.So it will be maximum 8 video in a screen (video files located in local system) & very 30 seconds according to data from ws video file will change.I write the code like this.In timer callback event I am Executing 2 functions
System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(GetNextPage), state); // going 2 next page, in a page displaying 8 rows
System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(GetNextVideo), state); // displaying corresponding video
//in delegate of video I put the below code
wmp = (AxWMPLib.AxWindowsMediaPlayer)Arrctrl[0]; //Find the control bcos adding at runtime
thread = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(PlayCurrentWMP)); //PlayCurrentWMP is assign the URL & play
thread.Priority = System.Threading.ThreadPriority.Lowest;
thread.IsBackground = true;
thread.Start(wmp);
Please advice what is wrong in my coding. Thanks in advance
I am doing an application that is using webservice & displaying data.So every 30 seconds the application will call webservice, I use system.Threading.Timer it is working fine.CPU usage is very less (maximum 30).I got an additional task to play video files.So it will be maximum 8 video in a screen (video files located in local system) & very 30 seconds according to data from ws video file will change.I write the code like this.In timer callback event I am Executing 2 functions
System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(GetNextPage), state); // going 2 next page, in a page displaying 8 rows
System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(GetNextVideo), state); // displaying corresponding video
//in delegate of video I put the below code
wmp = (AxWMPLib.AxWindowsMediaPlayer)Arrctrl[0]; //Find the control bcos adding at runtime
thread = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(PlayCurrentWMP)); //PlayCurrentWMP is assign the URL & play
thread.Priority = System.Threading.ThreadPriority.Lowest;
thread.IsBackground = true;
thread.Start(wmp);
Please advice what is wrong in my coding. Thanks in advance