示例#1
0
        private void btnStartLRF_Click(object sender, EventArgs e)
        {
            OnStartService start = new OnStartService(this, sicklrf.Contract.Identifier);

            start.Constructor = ServiceByContract(cs.Contract.Identifier);

            if (start.Constructor != null)
            {
                _eventsPort.Post(start);
            }
        }
        IEnumerator <ITask> OnStartServiceHandler(OnStartService onStartService)
        {
            if (onStartService.DriveControl == _driveControl &&
                onStartService.Constructor != null)
            {
                cs.ConstructorPort port = ServiceForwarder <cs.ConstructorPort>(onStartService.Constructor);

                ServiceInfoType request = new ServiceInfoType(onStartService.Contract);
                cs.Create       create  = new cs.Create(request);

                port.Post(create);

                string service = null;

                yield return(Arbiter.Choice(
                                 create.ResponsePort,
                                 delegate(CreateResponse response)
                {
                    service = response.Service;
                },
                                 delegate(Fault fault)
                {
                    LogError(fault);
                }
                                 ));


                if (service == null)
                {
                    yield break;
                }

                WinFormsServicePort.FormInvoke(
                    delegate()
                {
                    _driveControl.StartedSickLRF();
                }
                    );
            }
        }