예제 #1
0
        public void PopulateItems()
        {
            var e = GetInputElement();

            if (e != null)
            {
                var items = new List <ParameterWrapper>();

                // add instance parameters
                items.AddRange(GetParameters(e, "Instance"));

                // add type parameters
                if (e.CanHaveTypeAssigned())
                {
                    var et = DocumentManager.Instance.CurrentDBDocument.GetElement(e.GetTypeId());
                    if (et != null)
                    {
                        items.AddRange(GetParameters(et, "Type"));
                    }
                }
                ItemsCollection = new ObservableCollection <ParameterWrapper>(items.OrderBy(x => x.Name));
            }

            if (SelectedItem == null)
            {
                SelectedItem = ItemsCollection.FirstOrDefault();
            }
        }
예제 #2
0
        /// <summary>
        /// Updates the score of the provided match
        /// The entry gets updated in the ItemsCollection
        /// </summary>
        /// <param name="item">Item to update</param>
        /// <param name="homeScore">Score of the Home Team. Allows null, won't update if no data provided</param>
        /// <param name="awayScore">Score of the Away Team. Allows null, won't update if no data provided</param>
        /// <returns>The updated item</returns>
        public override Match Update(Match item)
        {
            var collectionItem = ItemsCollection.FirstOrDefault(x => x.Id == item.Id);

            //In case the item does not exists in the collection it's added
            if (collectionItem == null)
            {
                return(null);
            }

            collectionItem.HomeScore = item.HomeScore;
            collectionItem.AwayScore = item.AwayScore;

            return(collectionItem);
        }