Beispiel #1
0
 public void task_exec()
 {
     try
     {
         rd.Execute(cpp);
         cpp.Close();
     }
     catch (System.Runtime.InteropServices.COMException comEx)
     {
         Debug.Assert(false, comEx.ErrorCode.ToString("X"));
     }
     catch (Exception ex)
     {
         Debug.Assert(false, ex.Message);
     }
 }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="cpps"></param>
        /// <param name="remoteIP"></param>
        private void RemoveExist(CommPortProxysCollection cpps, string remoteIP)
        {
            ArgumentChecker.CheckNotNull(cpps);
            //foreach( CommPortProxy c in cpps )

            bool removed = true;

            while (removed)
            {
                removed = false;

                for (int i = 0; i < cpps.Count; i++)
                {
                    CommPortProxy c = cpps[i];
                    if (c.RemoteHostIP == remoteIP)
                    {
                        c.Close();
                        cpps.RemoveAt(i);
                        removed = true;
                        break;
                    }
                }
            }
        }