Exemplo n.º 1
0
        /// <summary>
        /// Adds the item.
        /// </summary>
        /// <param name="item">The item.</param>
        public void AddItem(TimelineItemViewModel item)
        {
            item.SetInformation(this._information);
            this.Items.Add(item);

            var maxValue = this.Items.Max(i => i.Value);

            if (this.Maximum != maxValue)
            {
                this.SetMaxValue(maxValue + 1);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds the items.
        /// </summary>
        private void AddItems()
        {
            if (this.SettingsService.GroupBySkill)
            {
                this.GroupBySKill();
                return;
            }

            var combineGems  = this._skills.SelectMany(s => s.Gems).AsEnumerable <WikiItem>();
            var combineItems = combineGems.Concat(this._items);

            foreach (var items in combineItems.GroupBy(g => g.Level))
            {
                var views = new List <WikiItemBaseViewModel>();
                foreach (var item in items)
                {
                    WikiItemBaseViewModel view = null;
                    if (item is Gem gem)
                    {
                        view = new GemViewModel(gem);
                    }

                    if (item is UniqueItem uniqueItem)
                    {
                        view = new UniqueItemViewModel(uniqueItem, false);
                    }

                    if (view == null)
                    {
                        continue;
                    }

                    views.Add(view);
                }

                if (views.Any())
                {
                    var timelineItem = new TimelineItemViewModel(items.Key)
                    {
                        DetailedView = new GroupItemViewModel(views),
                    };
                    this.Timeline.AddItem(timelineItem);
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Groups the by s kill.
        /// </summary>
        private void GroupBySKill()
        {
            var skillGroups = this._skills.GroupBy(s => s.Gems.Max(g => g.Level));

            foreach (var group in skillGroups)
            {
                var timelineItem = new TimelineItemViewModel(group.Key);

                var wikiItems = new List <WikiItemBaseViewModel>();
                foreach (var entry in group.AsEnumerable())
                {
                    wikiItems.AddRange(entry.Gems.Select(g => new GemViewModel(g)));
                }

                foreach (var item in this._items.Where(i => i.Level == group.Key))
                {
                    wikiItems.Add(new UniqueItemViewModel(item, false));
                }

                timelineItem.DetailedView = new GroupItemViewModel(wikiItems);

                this.Timeline.AddItem(timelineItem);
            }

            foreach (var uniqueItem in this._items)
            {
                if (skillGroups.Any(s => s.Key == uniqueItem.Level))
                {
                    continue;
                }

                var timelineItem = new TimelineItemViewModel(uniqueItem.Level)
                {
                    DetailedView = new UniqueItemViewModel(uniqueItem, false),
                };
                this.Timeline.AddItem(timelineItem);
            }
        }