public MainViewModel()
        {
            this.activator                = new ViewModelActivator();
            this.isCachingEnabled         = true;
            this.isDataOrderCacheFriendly = true;
            this.reset = new Subject <Unit>();

            this.dinosaurs = this
                             .WhenAnyValue(x => x.IsDataOrderCacheFriendly, x => x.IsCachingEnabled, (isDataOrderCacheFriendly, _) => isDataOrderCacheFriendly)
                             .Select(GetDinosaurViewModels)
                             .Do(_ => this.ResetCounters())
                             .ToProperty(this, x => x.Dinosaurs);

            this.colorKeys = TimelineColors
                             .GetColors()
                             .Select(colorInfo => new ColorKeyViewModel(colorInfo.era, colorInfo.period, colorInfo.color))
                             .ToList();

            this
            .WhenActivated(
                disposables =>
            {
                Disposable
                .Create(() => this.ResetCounters())
                .DisposeWith(disposables);
            });
        }
Exemple #2
0
 public DinosaurViewModel(Dinosaur model)
 {
     this.name          = model.Name;
     this.era           = model.Era.Value;
     this.period        = model.Period.Value;
     this.periodDisplay = $"{this.era}, {this.period}";
     this.color         = TimelineColors.GetColorFor(this.era, this.period);
 }