예제 #1
0
        public void Update(Selection selection, bool fullSnapshot)
        {
            Price       = selection.Price;
            Status      = selection.Status;
            Tradability = selection.Tradable;

            if (fullSnapshot)
            {
                _tags = new Dictionary <string, string>(StringComparer.InvariantCultureIgnoreCase);

                foreach (var key in selection.TagKeys)
                {
                    _tags.Add(key, selection.GetTagValue(key));
                }

                Name = selection.Name;

                // Result and PlaceResult (in the context of racing fixtures)
                // are only present on a full snapshot
                if (selection.Result != null)
                {
                    if (Result == null)
                    {
                        Result = new SelectionResultState(selection.Result);
                    }
                    else
                    {
                        ((IUpdatableSelectionResultState)Result).Update(selection.Result);
                    }
                }

                if (selection.PlaceResult != null)
                {
                    if (PlaceResult == null)
                    {
                        PlaceResult = new SelectionResultState(selection.PlaceResult);
                    }
                    else
                    {
                        ((IUpdatableSelectionResultState)PlaceResult).Update(selection.PlaceResult);
                    }
                }
            }

            UpdateLineOnRollingSelection(selection);
        }
        public void Update(Selection selection, bool fullSnapshot)
        {
            Price = selection.Price;
            Status = selection.Status;
            Tradability = selection.Tradable;

            if (fullSnapshot)
            {
                _tags = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);

                foreach (var key in selection.TagKeys)
                    _tags.Add(key, selection.GetTagValue(key));

                Name = selection.Name;

                // Result and PlaceResult (in the context of racing fixtures) 
                // are only present on a full snapshot
                if (selection.Result != null)
                {
                    if (Result == null)
                        Result = new SelectionResultState(selection.Result);
                    else
                        ((IUpdatableSelectionResultState)Result).Update(selection.Result);
                }

                if (selection.PlaceResult != null)
                {
                    if (PlaceResult == null)
                        PlaceResult = new SelectionResultState(selection.PlaceResult);
                    else
                        ((IUpdatableSelectionResultState)PlaceResult).Update(selection.PlaceResult);
                }
            }

            UpdateLineOnRollingSelection(selection);
        }