예제 #1
0
 public MainPageViewModel(IScheduler scheduler)
 {
     _scheduler = scheduler;
     _max       = new MVx.Observable.Property <long>(TimeSpan.FromSeconds(30).Ticks, nameof(MaxTicks), args => PropertyChanged?.Invoke(this, args));
     _elapsed   = new MVx.Observable.Property <long>(0, nameof(ElapsedTicks), args => PropertyChanged?.Invoke(this, args));
     _reset     = new MVx.Observable.Command(true);
 }
예제 #2
0
 public MainPageViewModel()
 {
     _circles        = new MVx.Observable.Property <IEnumerable <Circle> >(nameof(Circles), args => PropertyChanged?.Invoke(this, args));
     _selected       = new MVx.Observable.Property <Circle>(nameof(Selected), args => PropertyChanged?.Invoke(this, args));
     _adjustDiameter = new MVx.Observable.Command();
     _undo           = new MVx.Observable.Command();
     _redo           = new MVx.Observable.Command();
 }
예제 #3
0
 public MainPageViewModel()
 {
     _isDualMode      = new MVx.Observable.Property <bool>(false, nameof(IsDualMode), args => PropertyChanged?.Invoke(this, args));
     _modeDescription = new MVx.Observable.Property <string>(string.Empty, nameof(ModeDescription), args => PropertyChanged?.Invoke(this, args));
     _screen1Visible  = new MVx.Observable.Property <bool>(true, nameof(Screen1Visible), args => PropertyChanged?.Invoke(this, args));
     _screen1Bounds   = new MVx.Observable.Property <Rect>(Rect.Empty, nameof(Screen1Bounds), args => PropertyChanged?.Invoke(this, args));
     _screen2Visible  = new MVx.Observable.Property <bool>(false, nameof(Screen2Visible), args => PropertyChanged?.Invoke(this, args));
     _screen2Bounds   = new MVx.Observable.Property <Rect>(Rect.Empty, nameof(Screen2Bounds), args => PropertyChanged?.Invoke(this, args));
 }
예제 #4
0
        public ViewModel(Store.Client.IStoreClient storeClient, Platform.ISchedulers schedulers)
        {
            _storeClient = storeClient;
            _schedulers  = schedulers;

            _logger = global::Uno.Extensions.LogExtensionPoint.AmbientLoggerFactory.CreateLogger <ViewModel>();

            _loadCheese = new MVx.Observable.Command(true);
            _cheeses    = new MVx.Observable.Property <IEnumerable <Store.Client.Cheese> >(Enumerable.Empty <Store.Client.Cheese>(), nameof(Cheeses), args => PropertyChanged?.Invoke(this, args));
        }
예제 #5
0
        public MainPageViewModel(IScheduler scheduler)
        {
            _scheduler       = scheduler;
            _flightType      = new MVx.Observable.Property <FlightType>(FlightType.OneWay, nameof(FlightType), args => PropertyChanged?.Invoke(this, args));
            _outboundText    = new MVx.Observable.Property <string>(DateTime.Now.ToString("d"), nameof(OutboundText), args => PropertyChanged?.Invoke(this, args));
            _outboundValid   = new MVx.Observable.Property <bool>(nameof(OutboundValid), args => PropertyChanged?.Invoke(this, args));
            _returnText      = new MVx.Observable.Property <string>(DateTime.Now.ToString("d"), nameof(ReturnText), args => PropertyChanged?.Invoke(this, args));
            _returnValid     = new MVx.Observable.Property <bool>(nameof(ReturnValid), args => PropertyChanged?.Invoke(this, args));
            _returnAvailable = new MVx.Observable.Property <bool>(false, nameof(ReturnAvailable), args => PropertyChanged?.Invoke(this, args));
            _message         = new MVx.Observable.Property <string>(string.Empty, nameof(Message), args => PropertyChanged?.Invoke(this, args));
            _book            = new MVx.Observable.Command();

            _outboundDate = _outboundText.Select(text => DateTime.TryParseExact(text, "d", Thread.CurrentThread.CurrentUICulture, System.Globalization.DateTimeStyles.None, out DateTime date) ? (DateTime?)date : null);
            _returnDate   = _returnText.Select(text => DateTime.TryParseExact(text, "d", Thread.CurrentThread.CurrentUICulture, System.Globalization.DateTimeStyles.None, out DateTime date) ? (DateTime?)date : null);
        }
예제 #6
0
        public CellViewModel(MVx.Observable.IBus bus, int row, char column, IScheduler scheduler)
        {
            _bus       = bus;
            _text      = new MVx.Observable.Property <string>(nameof(Text), args => PropertyChanged?.Invoke(this, args));
            _content   = new MVx.Observable.Property <object>(nameof(Content), args => PropertyChanged?.Invoke(this, args));
            _scheduler = scheduler;

            Row    = row;
            Column = column;

            _subscription = new CompositeDisposable(
                ShouldUpdateContentWhenContentChangedReceived(),
                SholdPublishTextChangedWhenTextChanged()
                );
        }
예제 #7
0
        public ViewModel(Data.IProvider dataProvider, Lensman.Event.IBus eventBus, Platform.ISchedulers schedulers, Guid userId)
        {
            _dataProvider = dataProvider;
            _eventBus     = eventBus;
            _userId       = userId;
            _schedulers   = schedulers;

            _logger = global::Uno.Extensions.LogExtensionPoint.AmbientLoggerFactory.CreateLogger <ViewModel>();

            _recognised = new BehaviorSubject <Director.Client.Recognition>(null);
            _face       = new MVx.Observable.Property <Director.Client.Face>(nameof(Face), args => PropertyChanged?.Invoke(this, args));

            _ian      = new MVx.Observable.Command();
            _rachel   = new MVx.Observable.Command();
            _mia      = new MVx.Observable.Command();
            _max      = new MVx.Observable.Command();
            _alan     = new MVx.Observable.Command();
            _notAFace = new MVx.Observable.Command();
        }
예제 #8
0
        public MainPageViewModel()
        {
            _filter   = new MVx.Observable.Property <string>(nameof(Filter), args => PropertyChanged?.Invoke(this, args));
            _name     = new MVx.Observable.Property <string>(nameof(Name), args => PropertyChanged?.Invoke(this, args));
            _surname  = new MVx.Observable.Property <string>(nameof(Surname), args => PropertyChanged?.Invoke(this, args));
            _names    = new MVx.Observable.Property <IEnumerable <FullName> >(nameof(Names), args => PropertyChanged?.Invoke(this, args));
            _selected = new MVx.Observable.Property <FullName?>(null, nameof(Selected), args => PropertyChanged?.Invoke(this, args));
            _create   = new MVx.Observable.Command();
            _update   = new MVx.Observable.Command();
            _delete   = new MVx.Observable.Command();

            _allNames = new BehaviorSubject <IEnumerable <FullName> >(Enumerable.Empty <FullName>());
            _fullName = Observable
                        .CombineLatest(_name, _surname)
                        .Select(parts => parts.Any(part => string.IsNullOrEmpty(part)) ? (FullName?)null : new FullName {
                Name = parts[0], Surname = parts[1]
            })
                        .Publish()
                        .RefCount();
        }
예제 #9
0
        public ViewModel()
        {
            _state                  = new MVx.Observable.Property <State>(State.SignIn, nameof(State), args => PropertyChanged?.Invoke(this, args));
            _name                   = new MVx.Observable.Property <string>(DefaultName, nameof(Name), args => PropertyChanged?.Invoke(this, args));
            _hubState               = new MVx.Observable.Property <HubConnectionState>(HubConnectionState.Disconnected, nameof(HubState), args => PropertyChanged?.Invoke(this, args));
            _connect                = new MVx.Observable.Command();
            _lastMessageReceived    = new MVx.Observable.Property <Message.Model>(nameof(LastMessageReceived), args => PropertyChanged?.Invoke(this, args));
            _messageToSend          = new MVx.Observable.Property <string>(nameof(MessageToSend), args => PropertyChanged?.Invoke(this, args));
            _messageToSendIsEnabled = new MVx.Observable.Property <bool>(false, nameof(MessageToSendIsEnabled), args => PropertyChanged?.Invoke(this, args));
            _currentTheme           = new MVx.Observable.Property <string>("Light", nameof(CurrentTheme), args => PropertyChanged?.Invoke(this, args));
            _toggleTheme            = new MVx.Observable.Command(true);
            _sendMessage            = new MVx.Observable.Command();


            _allMessages = new ObservableCollection <Message.Model>();

            _connection = new HubConnectionBuilder()
                          .WithUrl("https://unochatservice20200716114254.azurewebsites.net/ChatHub")
                          //.WithUrl("http://localhost:61877")
                          .WithAutomaticReconnect()
                          .Build();
        }
예제 #10
0
파일: ViewModel.cs 프로젝트: ibebbs/CODuo
        public ViewModel(Data.IProvider dataProvider, Platform.ISchedulers schedulers)
        {
            _dataProvider = dataProvider;
            _schedulers   = schedulers;

            _currentContainer                         = new MVx.Observable.Property <Common.Container>(nameof(CurrentContainer), args => PropertyChanged?.Invoke(this, args));
            _sliderMinimum                            = new MVx.Observable.Property <long>(nameof(SliderMinimum), args => PropertyChanged?.Invoke(this, args));
            _sliderMaximum                            = new MVx.Observable.Property <long>(nameof(SliderMaximum), args => PropertyChanged?.Invoke(this, args));
            _sliderCurrent                            = new MVx.Observable.Property <long>(nameof(SliderCurrent), args => PropertyChanged?.Invoke(this, args));
            _selectedRegion                           = new MVx.Observable.Property <int>(0, nameof(SelectedRegion), args => PropertyChanged?.Invoke(this, args));
            _regionIntensity                          = new MVx.Observable.Property <IReadOnlyDictionary <int, double?> >(Enumerable.Range(0, 15).ToDictionary(i => i, _ => default(double?)), nameof(RegionIntensity), args => PropertyChanged?.Invoke(this, args));
            _currentComposition                       = new MVx.Observable.Property <IReadOnlyDictionary <string, double> >(Enum.GetNames(typeof(Common.FuelType)).ToDictionary(name => name, _ => 0.0), nameof(CurrentComposition), args => PropertyChanged?.Invoke(this, args));
            _currentPeriod                            = new MVx.Observable.Property <Common.Period>(nameof(CurrentPeriod), args => PropertyChanged?.Invoke(this, args));
            _currentRegion                            = new MVx.Observable.Property <Common.Region>(nameof(CurrentRegion), args => PropertyChanged?.Invoke(this, args));
            _currentOperator                          = new MVx.Observable.Property <Common.Operator>(nameof(CurrentOperator), args => PropertyChanged?.Invoke(this, args));
            _currentRegionPopulation                  = new MVx.Observable.Property <int>(nameof(CurrentRegionPopulation), args => PropertyChanged?.Invoke(this, args));
            _currentRegionGeneration                  = new MVx.Observable.Property <Common.RegionGeneration>(nameof(CurrentRegionGeneration), args => PropertyChanged?.Invoke(this, args));
            _tonnesOfCO2PerHour                       = new MVx.Observable.Property <double>(nameof(TonnesOfCO2PerHour), args => PropertyChanged?.Invoke(this, args));
            _domesticConsumption                      = new MVx.Observable.Property <double>(nameof(DomesticConsumption), args => PropertyChanged?.Invoke(this, args));
            _domesticCarbonOffsetCostPerHour          = new MVx.Observable.Property <double>(nameof(DomesticCarbonOffsetCostPerHour), args => PropertyChanged?.Invoke(this, args));
            _domesticCarbonOffsetCostPerPersonPerYear = new MVx.Observable.Property <double>(nameof(DomesticCarbonOffsetCostPerPersonPerYear), args => PropertyChanged?.Invoke(this, args));
        }
예제 #11
0
 public MainPageViewModel()
 {
     _counter   = new MVx.Observable.Property <int>(nameof(Counter), args => PropertyChanged?.Invoke(this, args));
     _increment = new MVx.Observable.Command(true);
 }
예제 #12
0
 public MainPageViewModel()
 {
     _celcius    = new MVx.Observable.Property <int>(nameof(Celcius), args => PropertyChanged?.Invoke(this, args));
     _fahrenheit = new MVx.Observable.Property <int>(nameof(Fahrenheit), args => PropertyChanged?.Invoke(this, args));
 }