예제 #1
0
        public StartUpViewModel(IScreen screen) : base(screen)
        {
            IsDbAvailable = App.Features.InAppDatabase == Infrastructure.Features.FeatureAvailability.Available &&
                            App.Features.MultiUserEnabled == Infrastructure.Features.FeatureAvailability.Available;
            Identifier = new TestIndentifier {
                ImpulseRate = _minimumImpulseRate, Correction = false
            };

            NavigateCommand      = ReactiveCommand.Create(StartTest);
            NavigateToturialMode = ReactiveCommand.Create(StartTurotial);
            Quantums             = QuantumTypeLookup.Load();
            Counts          = TestCountTypeLookup.Load();
            SelectedQuantum = Quantums.FirstOrDefault(x => x.Item == Quantum.TwoHalf);
            SelectedCount   = Counts.FirstOrDefault(x => x.Item == TestCount.Sixty);
            Representations = RepresentationTypeLookup.Load();

            SelectedRepresentation = Representations.FirstOrDefault(x => x.Item == RepresentationType.UI);
            SelectedUser           = UserManager.GetDefaultUser();
            SuggestedUsers         = new ObservableCollection <User>();
            this.WhenActivated(disposables =>
            {
                this
                .WhenAnyValue(x => x.SelectedRepresentation)
                .WhereNotNull()
                .Subscribe(x => Identifier.RepresentationType = x.Item)
                .DisposeWith(disposables);

                this.WhenAnyValue(x => x.SearchTerm)
                .WhereNotNull()
                .Subscribe(term => Search(term.Trim()));
            });
        }