public static extern int fnRegisterProgressCallback(PROGRESSCALLBACK pFnProgCallBack, int type);
private void pbUpdateProgress() { object obj3; byte[] timeInfo = new byte[3]; uint currPlayedBytes = 0; int currPlayedStatus = 0; lock (this.playbackLockUpdate) { this.PlaybackCtrl.UnregisterCallbacks(this.PlaybackCtrl.PLAYBACK); this.elapsedT[0] = 0; this.elapsedT[1] = 0; this.elapsedT[2] = 0; this.currPlayedBytes = 0; this.currPlayedStatus = 1; } PROGRESSCALLBACK pFnProgCallBack = new PROGRESSCALLBACK(this.pbDisplayProgress); fnRegisterProgressCallback(pFnProgCallBack, this.PlaybackCtrl.PLAYBACK); ERRORCALLBACK pFnErrorCallBack = new ERRORCALLBACK(this.pbErrorLog); fnRegisterErrorCallback(pFnErrorCallBack); ERRORCALLBACK pFnExacqErrorCallBack = new ERRORCALLBACK(this.pbExacqErrorLog); fnRegisterExacqErrorCallback(pFnExacqErrorCallBack); GCHandle handle = GCHandle.Alloc(pFnProgCallBack); GCHandle handle2 = GCHandle.Alloc(pFnErrorCallBack); GCHandle handle3 = GCHandle.Alloc(pFnExacqErrorCallBack); int num3 = 0; Label_00CF: Monitor.Enter(obj3 = this.playbackLockUpdate); try { timeInfo[0] = this.elapsedT[0]; timeInfo[1] = this.elapsedT[1]; timeInfo[2] = this.elapsedT[2]; if (currPlayedBytes == this.currPlayedBytes) { num3++; } else { num3 = 0; } currPlayedBytes = this.currPlayedBytes; currPlayedStatus = this.currPlayedStatus; } finally { Monitor.Exit(obj3); } string text = string.Format("{0}:{1}:{2}", Convert.ToString(timeInfo[0]), Convert.ToString(timeInfo[1]), Convert.ToString(timeInfo[2])); this.PlaybackGuiCtrl.SetLabelText(this.pbElapsedTimeVal, text); this.PlaybackGuiCtrl.SetLabelText(this.pbPlayedBytesVal, Convert.ToString(currPlayedBytes)); if ((this.PlaybackCtrl.TotalFileTime != 0) && ((this.PlaybackCtrl.GetTotalTimeInSec(timeInfo) > this.PlaybackCtrl.TotalFileTime) || (num3 > 0x3e8))) { this.PlaybackCtrl.Stop(this.PlaybackCtrl.PLAYBACK); currPlayedStatus = 5; } if ((this.PlaybackCtrl.TotalPlaySize != 0) && ((currPlayedBytes >= this.PlaybackCtrl.TotalPlaySize) || (num3 > 0x3e8))) { this.PlaybackCtrl.Stop(this.PlaybackCtrl.PLAYBACK); currPlayedStatus = 5; } if ((currPlayedStatus == 5) | (currPlayedStatus == 3)) { this.pbReInitWindow(); this.PlaybackCtrl.TotalPlaySize = 0; this.PlaybackCtrl.TotalFileTime = 0; this.PlaybackCtrl.IsFinished = true; } else { this.PlaybackGuiCtrl.SetButtonState(this.pbStartBut, false); this.PlaybackCtrl.IsFinished = false; Thread.Sleep(500); goto Label_00CF; } handle.Free(); handle2.Free(); handle3.Free(); new Thread(new ThreadStart(this.PlaybackDoneEvent.SiRFLiveEventSet)).Start(); }
public static extern int fnRegisterProgressCallback(PROGRESSCALLBACK pFnCallBack, int type);
private void cpUpdateProgress() { byte[] timeInfo = new byte[3]; uint currPlayedBytes = 0; int currPlayedStatus = 0; lock (this.cpLockUpdate) { this.cpCtrl.UnregisterCallbacks(this.cpCtrl.CAPTURE); this.elapsedT[0] = 0; this.elapsedT[1] = 0; this.elapsedT[2] = 0; this.currPlayedBytes = 0; this.currPlayedStatus = 1; } PROGRESSCALLBACK pFnCallBack = new PROGRESSCALLBACK(this.cpDisplayProgress); fnRegisterProgressCallback(pFnCallBack, this.cpCtrl.CAPTURE); DISKFILLEDCALLBACK diskfilledcallback = new DISKFILLEDCALLBACK(this.cpDiskFilled); fnRegisterDiskSpaceExceededCallback(diskfilledcallback); ERRORCALLBACK pFnErrorCallBack = new ERRORCALLBACK(this.cpErrorLog); fnRegisterErrorCallback(pFnErrorCallBack); ERRORCALLBACK pFnExacqErrorCallBack = new ERRORCALLBACK(this.cpExacqErrorLog); fnRegisterExacqErrorCallback(pFnExacqErrorCallBack); GCHandle handle = GCHandle.Alloc(pFnCallBack); GCHandle handle2 = GCHandle.Alloc(diskfilledcallback); GCHandle handle3 = GCHandle.Alloc(pFnErrorCallBack); GCHandle handle4 = GCHandle.Alloc(pFnExacqErrorCallBack); while (true) { lock (this.cpLockUpdate) { timeInfo[0] = this.elapsedT[0]; timeInfo[1] = this.elapsedT[1]; timeInfo[2] = this.elapsedT[2]; currPlayedBytes = this.currPlayedBytes; currPlayedStatus = this.currPlayedStatus; } string text = string.Format("{0}:{1}:{2}", Convert.ToString(timeInfo[0]), Convert.ToString(timeInfo[1]), Convert.ToString(timeInfo[2])); this.cpGuiCtrl.SetLabelText(this.cpElapsedTimeVal, text); this.cpGuiCtrl.SetLabelText(this.cpCaptureBytesVal, Convert.ToString(currPlayedBytes)); if ((this.cpCtrl.TotalFileTime != 0) && (this.cpCtrl.GetTotalTimeInSec(timeInfo) > this.cpCtrl.TotalFileTime)) { this.cpCtrl.Stop(this.cpCtrl.CAPTURE); currPlayedStatus = 5; } if ((this.cpCtrl.TotalPlaySize != 0) && (currPlayedBytes >= this.cpCtrl.TotalPlaySize)) { this.cpCtrl.Stop(this.cpCtrl.CAPTURE); currPlayedStatus = 5; } if ((currPlayedStatus == 5) | (currPlayedStatus == 3)) { this.cpReInitWindow(); this.cpCtrl.TotalPlaySize = 0; this.cpCtrl.TotalFileTime = 0; this.cpCtrl.IsFinished = true; break; } this.cpGuiCtrl.SetButtonState(this.cpStartBut, false); this.cpCtrl.IsFinished = false; Thread.Sleep(500); } handle.Free(); handle2.Free(); handle3.Free(); handle4.Free(); new Thread(new ThreadStart(this.cpDoneEvent.SiRFLiveEventSet)).Start(); }