예제 #1
0
        public SkillBreakdownViewModel(PlayerInfo playerInfo)
        {
            ComboBoxEntities = new SynchronizedObservableCollection <ComboBoxEntity>
            {
                new ComboBoxEntity(SkillViewType.FlatView, "Flat View"),
                new ComboBoxEntity(SkillViewType.AggregatedSkillIdView, "Aggregate by Id"),
                new ComboBoxEntity(SkillViewType.AggregatedSkillNameView, "Aggregate by Name")
            };

            //NOTE: These are duplicated in the xaml because of a wpf bug
            SortDescriptionMappings = new Dictionary <SkillViewType, IList <SortDescription> >
            {
                {
                    SkillViewType.FlatView,
                    new List <SortDescription>
                    {
                        new SortDescription(nameof(SkillResult.Time), ListSortDirection.Ascending)
                    }
                },
                {
                    SkillViewType.AggregatedSkillIdView,
                    new List <SortDescription>
                    {
                        new SortDescription(nameof(AggregatedSkillResult.Amount), ListSortDirection.Descending)
                    }
                },
                {
                    SkillViewType.AggregatedSkillNameView,
                    new List <SortDescription>
                    {
                        new SortDescription(nameof(AggregatedSkillResult.Amount), ListSortDirection.Descending)
                    }
                }
            };

            //set the intial view
            var initialView = SkillViewType.AggregatedSkillNameView;

            SortDescriptionSource  = SortDescriptionMappings[initialView];
            SelectedCollectionView = ComboBoxEntities.First(cbe => cbe.Key == initialView);

            PlayerInfo = playerInfo;
            SkillLog   = PlayerInfo.SkillLog;

            //subscribe to future changes and invoke manually
            SkillLog.CollectionChanged += (sender, args) =>
            {
                UpdateAggregatedSkillLogs(args.NewItems.Cast <SkillResult>());
                CasualMessenger.Instance.Messenger.Send(new ScrollPlayerStatsMessage(), this);
            };

            UpdateAggregatedSkillLogs(SkillLog);
        }
예제 #2
0
 public AaronCarPartCollection GetCarPartCollectionByHash(uint hash)
 {
     return(_carPartCollections.First(c => c.Hash == hash));
 }