Example #1
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()
                    )
                );
        }