Ejemplo n.º 1
0
        public void ReplaceHandler(mdwebcam.Replace replace)
        {
            _state = replace.Body;
            if (_streamPort != null)
            {
                _streamPort.Post(new Shutdown());
            }
            try
            {
                _streamPort = mdwebcam.ReadStream.Create(_state.CaptureFile, Environment.TaskQueue);
            }
            catch (Exception e)
            {
                LogError("Unable to open stream file: " + e.Message);
            }

            replace.ResponsePort.Post(DefaultReplaceResponseType.Instance);

            SendNotification(_subMgrPort, replace);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Service startup
        /// </summary>
        protected override void Start()
        {
            _fwdPort       = ServiceForwarder <webcam.WebCamOperations>(ServiceInfo.Service);
            _utilitiesPort = DsspHttpUtilitiesService.Create(Environment);

            Uri httpAlias = ServiceInfo.HttpServiceAlias;

            if (httpAlias != null)
            {
                _prefix            = httpAlias.AbsolutePath;
                _alternatePrefixes = AlternateContractServiceInfo.ConvertAll <string>(
                    delegate(ServiceInfoType alternate)
                {
                    return(alternate.HttpServiceAlias.AbsolutePath);
                }
                    );
            }

            try
            {
                _streamPort = mdwebcam.ReadStream.Create(_state.CaptureFile, Environment.TaskQueue);
            }
            catch (Exception e)
            {
                LogError("Unable to open stream file: " + e.Message);
                base.StartFailed();
                return;
            }

            base.Start();

            base.MainPortInterleave.CombineWith(
                new Interleave(
                    new ExclusiveReceiverGroup(
                        Arbiter.Receive <mdwebcam.Frame>(true, _streamPort, ReadFrameHandler)
                        ),
                    new ConcurrentReceiverGroup()
                    )
                );
        }