Esempio n. 1
0
        protected override void Start()
        {
            if (_state == null)
            {
                _state = new FlexDialogState();
            }

            SpawnIterator(DoStart);
        }
        /// <summary>
        /// Initialize - Init the Dialog
        /// </summary>
        /// <param name="state"></param>
        public void Initialize(FlexDialogState state)
        {
            SetTitle(state.Title);
            SetVisibility(state.Visible);

            SuspendLayout();

            state.Controls.ForEach(InsertControl);
            state.Buttons.ForEach(InsertButton);

            if (controlPanel.HasChildren)
            {
                int bottom = controlPanel.Controls[controlPanel.Controls.Count - 1].Bottom;
                int width  = ClientSize.Width;

                if (buttonPanel.HasChildren &&
                    buttonPanel.Controls[0].Left < _margin)
                {
                    width += _margin - buttonPanel.Controls[0].Left;
                }
                ClientSize = new Size(width, bottom + _margin + buttonPanel.Height);
            }
            ResumeLayout();
        }
Esempio n. 3
0
        public IEnumerator <ITask> OnHandOff(HandOff handOff)
        {
            Fault fault = null;

            ServiceInfoType[] services = null;

            dir.QueryRequestType request = new dir.QueryRequestType(
                new ServiceInfoType(Contract.Identifier)
                );
            dir.Query query = new dir.Query(request);
            query.TimeSpan = new TimeSpan(0, 0, 2);
            DirectoryPort.Post(query);

            yield return(Arbiter.Choice(
                             query.ResponsePort,
                             delegate(dir.QueryResponseType success)
            {
                services = success.RecordList;
            },
                             delegate(Fault f)
            {
                fault = f;
            }
                             ));

            if (fault != null)
            {
                handOff.ResponsePort.Post(fault);
                yield break;
            }

            foreach (ServiceInfoType service in services)
            {
                FlexDialogOperations fwd   = ServiceForwarder <FlexDialogOperations>(service.Service);
                FlexDialogState      state = null;

                Get get = new Get();
                get.TimeSpan = new TimeSpan(0, 0, 2);
                fwd.Post(get);

                yield return(Arbiter.Choice(
                                 get.ResponsePort,
                                 delegate(FlexDialogState success)
                {
                    state = success;
                },
                                 delegate(Fault f)
                {
                    fault = f;
                }
                                 ));

                if (state != null && state.Title == handOff.Body.Title)
                {
                    handOff.Body.Service = service.HttpServiceAlias.ToString();
                    DoSendNotification(handOff);
                    handOff.ResponsePort.Post(handOff.Body);
                    yield break;
                }
            }

            handOff.ResponsePort.Post(
                Fault.FromCodeSubcodeReason(
                    FaultCodes.Receiver,
                    DsspFaultCodes.UnknownEntry,
                    "Unable to find dialog with title: " + handOff.Body.Title
                    )
                );
        }