Esempio n. 1
0
 /// <summary>
 /// Create conrete thread by ThreadFactory
 /// </summary>
 /// <param name="ThreadName"></param>
 /// <param name="_tokenSource"></param>
 /// <param name="_threadParameter"></param>
 public ThreadContext(PINThreadName ThreadName,
                      CancellationTokenSource _tokenSource,
                      ICloneable _threadParameter)
 {
     superThread = ThreadFactory.createThread(ThreadName,
                                              _tokenSource,
                                              _threadParameter);
 }
Esempio n. 2
0
        /// <summary>
        /// Create different concrete thread by different ThreadName
        /// </summary>
        public static PINThread createThread(PINThreadName ThreadName, CancellationTokenSource _tokenSource, ICloneable _threadParameter)
        {
            PINThread thread = null;

            switch (ThreadName)
            {
            case PINThreadName.GetNumber:
                thread = new ThreadGetNumber(_tokenSource, _threadParameter);
                break;

            case PINThreadName.DigitInitial:
                thread = new ThreadDigitInitial(_tokenSource, _threadParameter);
                break;

            default:
                break;
            }
            return(thread);
        }