Пример #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()));
            });
        }
Пример #2
0
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            var yp = (RepresentationType)value;

            return(RepresentationTypeLookup.Load().FirstOrDefault(x => x.Item == yp).Display);
        }