public MainViewModel(IBikingService bikingService)
 {
     LoadUsers = ReactiveCommand.CreateFromTask(bikingService.GetUsers);
     users     = LoadUsers.ToProperty(this, model => model.Users);
     bikes     = this.WhenAnyValue(model => model.SelectedUser)
                 .SelectMany(u => bikingService.GetBikes(u.Id))
                 .ToProperty(this, model => model.Bikes);
 }
 public UserViewModel(User user, IBikingService bikingService)
 {
     this.user = user;
     LoadBikes = ReactiveCommand.CreateFromTask(() => bikingService.GetBikes(user.Id));
     bikes     = LoadBikes.ToProperty(this, model => model.Bikes);
     this.WhenAnyValue(x => x.SelectedBike)
     .Where(x => x != null)
     .Subscribe(b => MessageBus.Current.SendMessage(b));
 }
Ejemplo n.º 3
0
        private static async Task PrintBikes(IBikingService client, int userId)
        {
            var bikes = await client.GetBikes(userId);

            foreach (var component in bikes)
            {
                Console.WriteLine(component);
            }

            Console.ReadLine();
        }