Ejemplo n.º 1
0
 public void StopCPPPlayer2()
 {
     try
     {
         lock (locked)
         {
             if (!CFlag)
             {
                 if (TsCmdStoreID != null)
                 {
                     string strSql = string.Format("update PLAYRECORD set PR_REC_STATUS = '{0}' where PR_SourceID='{1}'", "删除", TsCmdStoreID);
                     strSql += "delete from InfoVlaue";
                     //string strSql = "update PLAYRECORD set PR_REC_STATUS = '删除'";
                     mainForm.dba.UpdateDbBySQL(strSql);
                     Console.WriteLine(strSql + "成功!");
                 }
                 CoreEvent.SetEvent(m_handle);
                 //CoreEvent.CloseHandle(m_handle);
                 pipeStream.Close();
                 CFlag = true;
             }
         }
     }
     catch
     {
         return;
     }
 }
Ejemplo n.º 2
0
 public void StopCPPPlayer()
 {
     try
     {
         pipeStream.WaitForConnection();
         using (StreamReader sr = new StreamReader(pipeStream))
         {
             string line;
             while ((line = sr.ReadLine()) != null)
             {
                 Thread.Sleep(500);
                 string strValue = line;
                 if (line == "-1000")
                 {
                     //CFlag=true;
                     Console.WriteLine(m_handle);
                     break;
                 }
             }
         }
         //CoreEvent.SetEvent(m_handle);
         lock (locked)
         {
             if (!CFlag)
             {
                 if (TsCmdStoreID != null)
                 {
                     string strSql = string.Format("update PLAYRECORD set PR_REC_STATUS = '{0}' where PR_SourceID='{1}'", "删除", TsCmdStoreID);
                     strSql += "delete from InfoVlaue";
                     //string strSql = "update PLAYRECORD set PR_REC_STATUS = '删除'";
                     mainForm.dba.UpdateDbBySQL(strSql);
                     Console.WriteLine(strSql + "成功!");
                 }
                 CoreEvent.SetEvent(m_handle);
                 //CoreEvent.CloseHandle(m_handle);
                 pipeStream.Close();
                 CFlag = true;
             }
         }
         //CoreEvent.CloseHandle(m_handle);
     }
     catch
     {
         return;
     }
 }
Ejemplo n.º 3
0
 public bool CreatePipeandEvent(string strPiPeName, string strEventName)
 {
     try
     {
         m_strPiPeName  = strPiPeName;
         m_strEventName = strEventName;
         pipeStream     = new NamedPipeServerStream(strPiPeName);
         m_handle       = CoreEvent.CreateEvent(default(IntPtr), false, false, strEventName);
         CFlag          = false;//停止的标示
         strNO          = strNO + "1";
         return(true);
     }
     catch
     {
         return(false);
     }
 }