public void Send(Context context, XComponent.Authentication.UserObject.InitializationError evt, string privateTopic = null)
        {
            var incomingEvent = new IncomingEvent(evt != null ? evt : new XComponent.Authentication.UserObject.InitializationError(), IncomingEventType.Transition, HeaderFactory.Create(context, 6, privateTopic));

            Agent.Post(_engineAgentsById[context.AgentId], incomingEvent);
        }
        public void SendEvent(StdEnum stateMachineEnum, XComponent.Common.Event.DefaultEvent evt, string privateTopic = null)
        {
            var incomingEvent = new IncomingEvent(evt != null ? evt : new XComponent.Common.Event.DefaultEvent(), IncomingEventType.Transition, HeaderFactory.Create(18, (int)stateMachineEnum, 769565298, privateTopic));

            PostOnStateMachine(incomingEvent, stateMachineEnum);
        }
        public void SendEvent(StdEnum stateMachineEnum, XComponent.Authentication.UserObject.InitializationSuccess evt, string privateTopic = null)
        {
            var incomingEvent = new IncomingEvent(evt != null ? evt : new XComponent.Authentication.UserObject.InitializationSuccess(), IncomingEventType.Transition, HeaderFactory.Create(7, (int)stateMachineEnum, 769565298, privateTopic));

            PostOnStateMachine(incomingEvent, stateMachineEnum);
        }
示例#4
0
        public PatientData(DicomContentItem patientcontainer) : this()
        {
            foreach (var child in patientcontainer.Children())
            {
                DicomMeasuredValue measurementsequence;
                IMeasurementHeader temp;
                //Debug.WriteLine(child.Code + ": " + child.Get<string>());
                switch (child.Code.Value)
                {
                case "121033":
                    measurementsequence = child.Dataset.GetMeasuredValue(DicomTag.MeasuredValueSequence);
                    try {
                        temp = HeaderFactory.Parse("Age", (double)measurementsequence.Value, measurementsequence.Code.Meaning, measurementsequence.Code.Value);
                        SupportedUnitsHelpers.Convert(temp, DurationUnit.Year365);
                    }
                    catch (Exception) {
                        temp = new UnitHeaderAdapter("Age", new Duration((double)measurementsequence.Value, DurationUnit.Year365));
                    }
                    Debug.WriteLine(temp);
                    PatientAge = new Result(temp);
                    break;

                case "121032":
                    PatientSex = new StringResult("Sex", child.Dataset.GetCodeItem(DicomTag.ConceptCodeSequence).Meaning);
                    Debug.WriteLine(PatientSex);
                    break;

                case "8302-2":
                    measurementsequence = child.Dataset.GetMeasuredValue(DicomTag.MeasuredValueSequence);
                    temp = HeaderFactory.Parse("Height", (double)measurementsequence.Value, measurementsequence.Code.Meaning, measurementsequence.Code.Value);
                    SupportedUnitsHelpers.Convert(temp, LengthUnit.Centimeter);
                    Debug.WriteLine(temp);
                    PatientHeight = new Result(temp);
                    break;

                case "29463-7":
                    measurementsequence = child.Dataset.GetMeasuredValue(DicomTag.MeasuredValueSequence);
                    temp = HeaderFactory.Parse("Weight", (double)measurementsequence.Value, measurementsequence.Code.Meaning, measurementsequence.Code.Value);
                    SupportedUnitsHelpers.Convert(temp, MassUnit.Kilogram);
                    Debug.WriteLine(temp);
                    PatientWeight = new Result(temp);
                    break;

                case "F-008EC":
                    measurementsequence = child.Dataset.GetMeasuredValue(DicomTag.MeasuredValueSequence);
                    temp = HeaderFactory.Parse(child.Code.Meaning, (double)measurementsequence.Value, measurementsequence.Code.Meaning, "mmHg");
                    Debug.WriteLine(temp);
                    SystolicBloodPressure = new Result(temp);
                    break;

                case "F-008ED":
                    measurementsequence = child.Dataset.GetMeasuredValue(DicomTag.MeasuredValueSequence);
                    temp = HeaderFactory.Parse(child.Code.Meaning, (double)measurementsequence.Value, measurementsequence.Code.Meaning, "mmHg");
                    Debug.WriteLine(temp);
                    DiastolicBloodPressure = new Result(temp);
                    break;

                case "121029":
                    PatientName       = new StringResult("Patient Name", child.Get <string>().Replace('^', ' ').Trim());
                    PatientName.Value = PatientName.Value.Split(' ').Reverse().Aggregate((x, y) => { return((x + " " + y).Trim()); });
                    Debug.WriteLine(PatientName);
                    break;

                case "121030":
                    PatientID = new StringResult("Patient ID", child.Get <string>());
                    Debug.WriteLine(PatientID);
                    break;

                case "T9910-08":
                    ReferringPhysician = new StringResult("Referring Physician", child.Get <string>());
                    Debug.WriteLine(ReferringPhysician);
                    break;

                case "T9910-04":
                    ReasonForStudy = new StringResult("Reason For Study", child.Get <string>());
                    Debug.WriteLine(ReasonForStudy);
                    break;

                case "121031":
                    string input = child.Get <string>();
                    Debug.WriteLine("dob input: " + input);

                    var numbers = Regex.Split(input, @"\D+").ToList().GetRange(1, 3).Select(x => int.Parse(x)).ToArray();

                    PatientDOB = new StringResult("DOB", new DateTime(numbers[0], numbers[1], numbers[2]).Date.ToShortDateString());

                    Debug.WriteLine(PatientDOB.Value);
                    break;

                case "T9910-09":
                    string dateinput = child.Get <string>();
                    Debug.WriteLine("exam date input: " + dateinput);

                    var numbers2 = Regex.Split(dateinput, @"\D+").ToList().GetRange(1, 3).Select(x => int.Parse(x)).ToArray();

                    StudyDate = new StringResult("Study Date", new DateTime(numbers2[0], numbers2[1], numbers2[2]).Date.ToShortDateString());

                    Debug.WriteLine(StudyDate.Value);
                    break;

                default:
                    break;
                }
            }
            UpdateBSAResult();
            Debug.WriteLine(PatientDOB.Value);
        }
        public void Send(Context context, XComponent.Common.Event.DefaultEvent evt, string privateTopic = null)
        {
            var incomingEvent = new IncomingEvent(evt != null ? evt : new XComponent.Common.Event.DefaultEvent(), IncomingEventType.Transition, HeaderFactory.Create(context, 18, privateTopic));

            Agent.Post(_engineAgentsById[context.AgentId], incomingEvent);
        }
示例#6
0
        public void FormatParse()
        {
            var headerParser = HeaderFactory.Create(Configuration);

            enumParser = new EnumParser()
            {
                Configuration = Configuration
            };

            foreach (var excel in excelList)
            {
                foreach (var sheet in excel.sheetList)
                {
                    if (Configuration.IsDescription(sheet.name))
                    {
                        continue;
                    }

                    if (Configuration.IsEnum(sheet.name))
                    {
                        enumParser.Parse(sheet);
                    }
                    else
                    {
                        Row[] headerRow;

                        if (Configuration.Header == 1)
                        {
                            headerRow = new[] { sheet.worksheet.Rows[Configuration.StartRow] }
                        }
                        ;
                        else
                        {
                            headerRow = new[] { sheet.worksheet.Rows[Configuration.StartRow],
                                                sheet.worksheet.Rows[Configuration.StartRow + 1] }
                        };

                        var headerTypeList = headerParser.Parse(headerRow);

                        int maxHeaderReference = headerTypeList.Max(x => x.ReferenceIndex);

                        List <Row> dataRow = new List <Row>();

                        for (int i = Configuration.StartRow + headerRow.Length;
                             i < sheet.worksheet.Rows.Length;
                             i++)
                        {
                            Row row = sheet.worksheet.Rows[i];

                            List <Cell> cellList = new List <Cell>();

                            foreach (var c in row.FilledCells)
                            {
                                if (c.ReferenceIndex < Configuration.StartCol)
                                {
                                    continue;
                                }

                                if (c.ReferenceIndex > maxHeaderReference)
                                {
                                    break;
                                }

                                cellList.Add(c);
                            }

                            dataRow.Add(new Row()
                            {
                                r           = row.r,
                                FilledCells = cellList.ToArray()
                            });
                        }

                        string[] names   = sheet.name.Split('_');
                        string   tmpName = "";
                        if (names.Length > 1)
                        {
                            tmpName = names[0];
                        }
                        else
                        {
                            tmpName = sheet.name;
                        }

                        FormatSheet formatSheet = formatSheetList.Find(x => x.SheetName == tmpName);

                        if (formatSheet == null)
                        {
                            formatSheet                = new FormatSheet();
                            formatSheet.SheetName      = tmpName;
                            formatSheet.HeaderTypeList = headerTypeList;

                            formatSheetList.Add(formatSheet);
                        }

                        formatSheet.rowList.AddRange(dataRow);
                    }
                }
            }
        }
示例#7
0
        public void SendEvent(StdEnum stateMachineEnum, XComponent.HelloWorld.UserObject.SayHello evt, string privateTopic = null)
        {
            var incomingEvent = new IncomingEvent(evt != null ? evt : new XComponent.HelloWorld.UserObject.SayHello(), IncomingEventType.Transition, HeaderFactory.Create(9, (int)stateMachineEnum, -69981087, privateTopic));

            PostOnStateMachine(incomingEvent, stateMachineEnum);
        }
        public void SendEvent(StdEnum stateMachineEnum, XComponent.Referential.UserObject.Instrument evt, string privateTopic = null)
        {
            var incomingEvent = new IncomingEvent(evt != null ? evt : new XComponent.Referential.UserObject.Instrument(), IncomingEventType.Transition, HeaderFactory.Create(9, (int)stateMachineEnum, 183271270, privateTopic));

            PostOnStateMachine(incomingEvent, stateMachineEnum);
        }
        public void SendEvent(StdEnum stateMachineEnum, XComponent.TradeCapture.UserObject.Error evt, string privateTopic = null)
        {
            var incomingEvent = new IncomingEvent(evt != null ? evt : new XComponent.TradeCapture.UserObject.Error(), IncomingEventType.Transition, HeaderFactory.Create(12, (int)stateMachineEnum, 183271270, privateTopic));

            PostOnStateMachine(incomingEvent, stateMachineEnum);
        }
        public void Send(Context context, XComponent.TradeCapture.UserObject.UpdateAndRetry evt, string privateTopic = null)
        {
            var incomingEvent = new IncomingEvent(evt != null ? evt : new XComponent.TradeCapture.UserObject.UpdateAndRetry(), IncomingEventType.Transition, HeaderFactory.Create(context, 16, privateTopic));

            Agent.Post(_engineAgentsById[context.AgentId], incomingEvent);
        }
        public void Send(Context context, XComponent.Referential.UserObject.InstrumentSnapshot evt, string privateTopic = null)
        {
            var incomingEvent = new IncomingEvent(evt != null ? evt : new XComponent.Referential.UserObject.InstrumentSnapshot(), IncomingEventType.Transition, HeaderFactory.Create(context, 10, privateTopic));

            Agent.Post(_engineAgentsById[context.AgentId], incomingEvent);
        }
示例#12
0
        public void Send(Context context, XComponent.SlackProxy.UserObject.Success evt, string privateTopic = null)
        {
            var incomingEvent = new IncomingEvent(evt != null ? evt : new XComponent.SlackProxy.UserObject.Success(), IncomingEventType.Transition, HeaderFactory.Create(context, 11, privateTopic));

            Agent.Post(_engineAgentsById[context.AgentId], incomingEvent);
        }
示例#13
0
        public void SendEvent(StdEnum stateMachineEnum, XComponent.SlackProxy.UserObject.SendMessage evt, string privateTopic = null)
        {
            var incomingEvent = new IncomingEvent(evt != null ? evt : new XComponent.SlackProxy.UserObject.SendMessage(), IncomingEventType.Transition, HeaderFactory.Create(10, (int)stateMachineEnum, 777714140, privateTopic));

            PostOnStateMachine(incomingEvent, stateMachineEnum);
        }
示例#14
0
        internal EndpointData(MethodData method, HttpMethod httpMethod, ControllerData controller, bool deprecated)
        {
            _headers           = new Lazy <IReadOnlyList <RequestParameterData> >(() => HeaderFactory.GetEndpointHeaders(this));
            _requestParameters = new Lazy <IReadOnlyList <RequestParameterData> >(() => RequestParameterFactory.GetEndpointParameters(this).ToArray());
            _statusCodes       = new Lazy <IReadOnlyList <HttpStatusCode> >(() => StatusCodeFactory.GetEndpointStatusCodes(this).ToArray());
            _responseType      = new Lazy <TypeData>(() => ResponseFactory.GetEndpointResponse(this));

            Method     = method;
            HttpMethod = httpMethod;
            Controller = controller;
            Deprecated = deprecated;
        }
示例#15
0
 private void BindHeaders()
 {
     HeaderFactory.GetSupportedHeaders().Keys.ToList().ForEach(hn => _cmbHeaders.Items.Add(hn));
     _cmbHeaders.Items.Insert(0, string.Empty);
 }
示例#16
0
 public HeaderFactoryTests()
 {
     _subject = new HeaderFactory();
 }
示例#17
0
        private void OnPhoneCallStarted(IInternalPhoneCall phoneCall)
        {
            Check.Require(phoneCall, "phoneCall");
            Check.IsTrue(InternalState == _stateProvider.GetIdle(), string.Format("Failed to start the call. The phone can only start calls while in 'IDLE' state. CurrentState: '{0}'", CurrentState));
            Check.IsTrue(_isRunning, "Failed to start the call. The phone must be started first.");

            _pendingPhoneCall = phoneCall;

            if (_logger.IsInfoEnabled)
            {
                _logger.Info("Starting new phonecall...");
            }
            if (_logger.IsDebugEnabled)
            {
                _logger.Debug("Creating 'INVITE' request...");
            }
            var thisUri = AddressFactory.CreateUri(string.Empty, ListeningPoint.ToString());

            var requestUri   = phoneCall.GetToUri();
            var toAddress    = AddressFactory.CreateAddress(string.Empty, phoneCall.GetToUri());
            var fromAddress  = AddressFactory.CreateAddress(string.Empty, thisUri);
            var toHeader     = HeaderFactory.CreateToHeader(toAddress);
            var fromHeader   = HeaderFactory.CreateFromHeader(fromAddress, SipUtil.CreateTag());
            var cseqHeader   = HeaderFactory.CreateSCeqHeader(SipMethods.Invite, MessageCounter++);
            var callIdheader = HeaderFactory.CreateCallIdHeader(SipUtil.CreateCallId());
            var viaHeader    = HeaderFactory.CreateViaHeader(ListeningPoint.Address,
                                                             ListeningPoint.Port, SipConstants.Udp,
                                                             SipUtil.CreateBranch());
            var maxForwardsHeader = HeaderFactory.CreateMaxForwardsHeader(1);
            var request           = MessageFactory.CreateRequest(
                requestUri,
                SipMethods.Invite,
                callIdheader,
                cseqHeader,
                fromHeader,
                toHeader,
                viaHeader,
                maxForwardsHeader);

            /*add contactheader*/
            var contactUri    = AddressFactory.CreateUri(thisUri.User, viaHeader.SentBy.ToString());
            var contactHeader = HeaderFactory.CreateContactHeader(contactUri);

            request.Contacts.Add(contactHeader);

            if (_logger.IsDebugEnabled)
            {
                _logger.Debug("'INVITE' request created. Sending to callee..");
            }

            var clientTransaction = SipProvider.CreateClientTransaction(request);
            var dialog            = SipProvider.CreateClientDialog(clientTransaction as SipInviteClientTransaction);

            clientTransaction.SendRequest();

            if (_logger.IsDebugEnabled)
            {
                _logger.Debug("'INVITE' sent.");
            }

            if (_logger.IsInfoEnabled)
            {
                _logger.Info("Request sent. Transitioning to 'WAITPROVISIONAL' state...");
            }

            PendingInvite = new InviteInfo()
            {
                OriginalRequest = request,
                From            = request.From.SipUri,
                To = request.To.SipUri,
                InviteClientTransaction = (SipInviteClientTransaction)clientTransaction,
                IsIncomingCall          = false,
                Dialog = dialog
            };

            ChangeState(_stateProvider.GetWaitProvisional());
        }
        public void Send(Context context, XComponent.Order.UserObject.ExecutionInput evt, string privateTopic = null)
        {
            var incomingEvent = new IncomingEvent(evt != null ? evt : new XComponent.Order.UserObject.ExecutionInput(), IncomingEventType.Transition, HeaderFactory.Create(context, 8, privateTopic));

            Agent.Post(_engineAgentsById[context.AgentId], incomingEvent);
        }
示例#19
0
        public void Send(Context context, XComponent.HelloWorld.UserObject.SayHello evt, string privateTopic = null)
        {
            var incomingEvent = new IncomingEvent(evt != null ? evt : new XComponent.HelloWorld.UserObject.SayHello(), IncomingEventType.Transition, HeaderFactory.Create(context, 9, privateTopic));

            Agent.Post(_engineAgentsById[context.AgentId], incomingEvent);
        }
        public void SendEvent(StdEnum stateMachineEnum, XComponent.Order.UserObject.OrderInput evt, string privateTopic = null)
        {
            var incomingEvent = new IncomingEvent(evt != null ? evt : new XComponent.Order.UserObject.OrderInput(), IncomingEventType.Transition, HeaderFactory.Create(12, (int)stateMachineEnum, 823593371, privateTopic));

            PostOnStateMachine(incomingEvent, stateMachineEnum);
        }
示例#21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MessageFactory"/> class.
 /// </summary>
 /// <param name="factory">Factory used to create headers.</param>
 public MessageFactory(HeaderFactory factory)
 {
     _factory  = factory;
     _builders = new ObjectPool <MessageFactoryContext>(CreateBuilder);
 }
示例#22
0
 public HeaderParser()
 {
     _headerFactory = new HeaderFactory();
 }