Exemplo n.º 1
0
        /// <summary>
        /// Wrap a port with a controller
        /// </summary>
        /// <param name="port">The port to wrap with this controller</param>
        /// <param name="nbMinResendToChannel">Minimum number of times a zero should be sent to a channel before stopping sending this channel, when the value is zero</param>
        /// <param name="disposePortWithController">If the port should be disposed by the controller</param>
        public DmxUniverseController(IDmxPort port, int nbMinResendToChannel = 6, bool disposePortWithController = false)
        {
            _port = port;
            _nbMinResendToChannel      = nbMinResendToChannel;
            _disposePortWithController = disposePortWithController;

            _thread =
                new Thread(ThreadMethod)
            {
                Name         = string.Format("{0} - Port '{1}'", GetType().Name, _port.PhysicalPortId),
                IsBackground = true,
                Priority     = ThreadPriority.Highest
            };
            _thread.Start();
        }
 public static IDmxUniverseController CreateController(this IDmxPort forPort)
 {
     return(new DmxUniverseController(forPort, disposePortWithController: true));
 }