Esempio n. 1
0
        private IEnumerator <ITask> OnStartup()
        {
            rst4.Get get;
            yield return(_clockPort.Get(GetRequestType.Instance, out get));

            rst4.ServiceTutorial4State state = get.ResponsePort;
            if (state == null)
            {
                LogError("Unable to Get state from ServiceTutorial4", (Fault)get.ResponsePort);
            }
            #endregion

            #region CODECLIP 01-4
            else // if (state != null)
            {
                ServiceTutorial6State initState = new ServiceTutorial6State();
                initState.InitialTicks = state.Ticks;

                PartnerType partner = FindPartner("Clock");
                if (partner != null)
                {
                    initState.Clock = partner.Service;
                }

                Replace replace = new Replace();
                replace.Body = initState;

                _mainPort.Post(replace);
            }
            #endregion

            #region CODECLIP 01-5
            rst4.Subscribe subscribe;
            yield return(_clockPort.Subscribe(_clockNotify, out subscribe));

            Fault fault = subscribe.ResponsePort;
            if (fault != null)
            {
                LogError("Unable to subscribe to ServiceTutorial4", fault);
            }
        }
Esempio n. 2
0
 public IEnumerator <ITask> ReplaceHandler(Replace replace)
 {
     _state = replace.Body;
     replace.ResponsePort.Post(DefaultReplaceResponseType.Instance);
     yield break;
 }