/// <summary> /// Listen for events /// </summary> /// <param name="bsChannelID"></param> /// <param name="bsEventName"></param> /// <param name="bsEventParam"></param> void m_objFile_OnEvent(string bsChannelID, string bsEventName, string bsEventParam, object pEventObject) { Marshal.ReleaseComObject(pEventObject); if (bsEventName == "EOF") { int nIndex, nNextIndex; double dblFileTime, dblListTime; m_objPlaylist.PlaylistPosGet(out nIndex, out nNextIndex, out dblFileTime, out dblListTime); try { dataGridViewFiles.CurrentCell = dataGridViewFiles.Rows[nIndex].Cells[0]; } catch { } } }
private void timer1_Tick(object sender, EventArgs e) { if (aa) { return; } double a; double b; int c; int d; myPlaylist.PlaylistPosGet(out c, out d, out a, out b); trackBar2.Value = Convert.ToInt32(a); label4.Width = (trackBar2.Value * (trackBar2.Width - 20)) / trackBar2.Maximum; eMState eState; if (myPlaylist != null)//null exception için try-catch e alınmış. { myPlaylist.ObjectStateGet(out eState); try { int nCount; double dblListLen; myPlaylist.PlaylistGetCount(out nCount, out dblListLen); if (nCount > 0) { int nCurFile, nNextFile = 0; double dblFilePos, dblListPos = 0; myPlaylist.PlaylistPosGet(out nCurFile, out nNextFile, out dblFilePos, out dblListPos); string strPath; MItem pItem; double dblListOffset; myPlaylist.PlaylistGetByIndex(nCurFile, out dblListOffset, out strPath, out pItem); double dblIn, dblOut, dblFileLen = 0; pItem.FileInOutGet(out dblIn, out dblOut, out dblFileLen); if (dblOut > dblIn) { dblFileLen = dblOut; } string strFile = strPath.Substring(strPath.LastIndexOf('\\') + 1); label3.Text = Dbl2PosStr(dblFilePos) + "/" + Dbl2PosStr(dblFileLen) + " " + eState.ToString() + " (" + (nCurFile + 1) + "/" + nCount + ") " + Dbl2PosStr(dblListPos) + "/" + Dbl2PosStr(dblListLen) + " " + "\r\n" + strFile + "\r\n" + strPath; System.Runtime.InteropServices.Marshal.ReleaseComObject(pItem); } GC.Collect(); } catch { label4.Width = 0; throw; } string Dbl2PosStr(double _dblPos) { int nHour = (int)_dblPos / 3600; int nMinutes = ((int)_dblPos % 3600) / 60; int nSec = ((int)_dblPos % 60); _dblPos -= (int)_dblPos; int nMsec = (int)(_dblPos * 1000 + 0.5); string strRes = nHour.ToString("00") + ":" + nMinutes.ToString("00") + ":" + nSec.ToString("00") + "." + nMsec.ToString("000"); return(strRes); } } }