private void timerFile_Tick(object sender, EventArgs e) { for (int i = 0; i < m_lstDownloadFile.Count; i++) { UInt32 iConnID = m_lstDownloadFile[i].GetConnID(); if (iConnID != -1) { string sName = m_lstDownloadFile[i].GetFilename(); int uiCurrentPos = 0; int iSize = 0; if (NVSSDK.NetClient_NetFileGetDownloadPos(iConnID, ref uiCurrentPos, ref iSize) >= 0) { string sPos = "0%"; if (uiCurrentPos > 0 & uiCurrentPos < 100) { sPos = uiCurrentPos.ToString() + "%/"; } sPos += iSize.ToString() + "dB"; m_lstDownloadFile[i].SetPosition(iSize); for (int j = 0; j < lvFileData.Items.Count; j++) { string sFileName = lvFileData.Items[j].SubItems[1].Text.ToString(); if (sName == sFileName) { lvFileData.Items[j].SubItems[6].Text = sPos; break; } } } } // enf of if (m_ulConnID != -1) } // end of for (int i = 0; i < m_lstDownloadFile.Count, i++) }
private void ProgressDownlondByTime() { if (m_ulConnID != -1) { int uiCurrentPos = 0; int iSize = 0; if (NVSSDK.NetClient_NetFileGetDownloadPos(m_ulConnID, ref uiCurrentPos, ref iSize) >= 0) { long uiBeginTime = CommonFunction.NvsFileTimeToAbsSeconds(m_StartTime); long uiEndTime = CommonFunction.NvsFileTimeToAbsSeconds(m_EndTime); long iTimeInterval = uiEndTime - uiBeginTime; if (iTimeInterval > 0) { long iCurrentInterval = uiCurrentPos - uiBeginTime; if (iCurrentInterval > 0 && iCurrentInterval < iTimeInterval) { long iProcess = iCurrentInterval * 100 / iTimeInterval; if (iProcess > 100) { return; } pbDownloadTime.Value = Convert.ToInt32(iProcess); } } DateTime dtTime = CommonFunction.ConvertIntToDateTime(uiCurrentPos); lbDownloadStatusTime.Text = dtTime.Year.ToString() + "-" + dtTime.Month.ToString("D2") + "-" + dtTime.Day.ToString("D2") + " " + dtTime.Hour.ToString("D2") + ":" + dtTime.Minute.ToString("D2") + ":" + dtTime.Second.ToString("D2"); } } }
private void UI_UpdateProgressByFile() { if (m_ulConnID != -1) { int iProgress = 0, iSize = 0; int iRet = NVSSDK.NetClient_NetFileGetDownloadPos(m_ulConnID, ref iProgress, ref iSize); if (iRet >= 0) { string sProgress = "***" + iProgress.ToString() + "%/" + iSize.ToString() + "dB***"; lbDownloadProgress.Text = sProgress; if (iProgress > 0 & iProgress < 100) { pgbDownload.Value = iProgress; } } } if (m_iPlayerID != -1) { if (PLAYSDK.TC_GetFrameCount(m_iPlayerID) == 0) { return; } int i = PLAYSDK.TC_GetPlayingFrameNum(m_iPlayerID); int j = PLAYSDK.TC_GetFrameCount(m_iPlayerID); int iProgress = i * 100 / j; string sProgress = "***" + iProgress.ToString() + "%***"; lbPlayProgress.Text = sProgress; if (iProgress <= 100 & iProgress >= 0) { pgbPlay.Value = iProgress; } } }
private void UI_UpdateProgressByTime() { if (m_ulConnID != -1) { int iCurrentDonwnTime = 0, iSize = 0; int iRet = NVSSDK.NetClient_NetFileGetDownloadPos(m_ulConnID, ref iCurrentDonwnTime, ref iSize); if (iRet >= 0) { DateTime dtTime = CommonFunction.ConvertIntToDateTime(iCurrentDonwnTime); lbDownloadProgress.Text = dtTime.Year.ToString() + "-" + dtTime.Month.ToString() + "-" + dtTime.Day.ToString() + " " + dtTime.Hour.ToString() + ":" + dtTime.Minute.ToString() + ":" + dtTime.Second.ToString() + " Size:" + iSize.ToString() + "db"; long uiBeginTime = CommonFunction.NvsFileTimeToAbsSeconds(m_begintime); long uiEndTime = CommonFunction.NvsFileTimeToAbsSeconds(m_endtime); long iTimeInterval = uiEndTime - uiBeginTime; if (iTimeInterval > 0) { long iCurrentInterval = iCurrentDonwnTime - uiBeginTime; if (iCurrentInterval > 0 && iCurrentInterval < iTimeInterval) { long iProcess = iCurrentInterval * 100 / iTimeInterval; if (iProcess > 100) { return; } pgbDownload.Value = Convert.ToInt32(iProcess); } } } } if (m_iPlayerID != -1) { Int32 uiCurrentPlayTime = 0; PLAYSDK.TC_GetUserDataInfo(m_iPlayerID, -1, 0, ref uiCurrentPlayTime, Marshal.SizeOf(uiCurrentPlayTime)); if (uiCurrentPlayTime > 0) { DateTime dtTime = CommonFunction.ConvertIntToDateTime(uiCurrentPlayTime); lbDownloadProgress.Text = dtTime.Year.ToString() + "-" + dtTime.Month.ToString() + "-" + dtTime.Day.ToString() + " " + dtTime.Hour.ToString() + ":" + dtTime.Minute.ToString() + ":" + dtTime.Second.ToString(); long uiBeginTime = CommonFunction.NvsFileTimeToAbsSeconds(m_begintime); long uiEndTime = CommonFunction.NvsFileTimeToAbsSeconds(m_endtime); long iTimeInterval = uiEndTime - uiBeginTime; if (iTimeInterval > 0) { long iCurrentInterval = uiCurrentPlayTime - uiBeginTime; if (iCurrentInterval > 0 && iCurrentInterval < iTimeInterval) { long iProcess = iCurrentInterval * 100 / iTimeInterval; if (iProcess > 100) { return; } pgbDownload.Value = Convert.ToInt32(iProcess); } } } } }