public QueuesViewModel(IParameterViewStackService parameterViewStackService, IQueueService queueService) : base(parameterViewStackService) { _queueService = queueService; _queueService .Queue .Connect() .RefCount() .Transform(x => new QueuedItemViewModel(x)) .AutoRefresh(x => x.CurrentQueueTime) .Sort(SortExpressionComparer <QueuedItemViewModel> .Descending(x => x.CurrentQueueTime)) .ObserveOn(RxApp.MainThreadScheduler) .Bind(out _queue) .DisposeMany() .Subscribe() .DisposeWith(Subscriptions); Observable .Interval(TimeSpan.FromSeconds(5)) .Subscribe(_ => _queueService.GetQueue(Guid.Empty)) .DisposeWith(Subscriptions); InitializeData = ReactiveCommand.CreateFromObservable(ExecuteInitializeData); }
public StoreDetailViewModel( IParameterViewStackService parameterViewStackService, IPopupViewStackService popupViewStackService, IStoreService storeService, IQueueService queueService, IDialogs dialogs) : base(parameterViewStackService) { _popupViewStackService = popupViewStackService; _storeService = storeService; _queueService = queueService; _dialogs = dialogs; var getStore = ReactiveCommand.CreateFromObservable <Guid, Unit>(ExecuteGetStore); this.WhenAnyValue(x => x.StoreId) .Where(x => x != Guid.Empty) .DistinctUntilChanged() .InvokeCommand(getStore) .DisposeWith(Subscriptions); InitializeData = ReactiveCommand.CreateFromObservable <Guid, Unit>(ExecuteInitializeData); Add = ReactiveCommand.CreateFromObservable(ExecuteAdd); }
public TabViewModel(string tabTitle, string tabIcon, IParameterViewStackService stackService, Func <ViewModelBase> pageCreate) : base(stackService) { TabIcon = tabIcon; TabTitle = tabTitle; ViewModel = pageCreate(); }
public TabViewModel(string tabTitle, string tabIcon, IParameterViewStackService stackService, Func <NavigationViewModelBase> pageCreate) { _pageCreate = pageCreate; TabIcon = tabIcon; TabTitle = tabTitle; ViewModel = _pageCreate(); }
private static ViewModelBase CreateMenuItem <TViewModel>(IParameterViewStackService service) where TViewModel : ViewModelBase { var viewmodel = Locator.Current.GetService <TViewModel>(); viewmodel.SetNavigationService(service); return(viewmodel); }
public BottomMenuViewModel(IParameterViewStackService parameterViewStackService) : base(parameterViewStackService) { TabViewModels = new List <Func <IParameterViewStackService, TabViewModel> > { service => new TabViewModel("Search", "", service, () => CreateMenuItem <StoreSearchViewModel>(service)), service => new TabViewModel("Queue", "", service, () => CreateMenuItem <QueuesViewModel>(service)), service => new TabViewModel("Me", "", service, () => CreateMenuItem <UserViewModel>(service)) }; }
public UserViewModel(IParameterViewStackService parameterViewStackService, ISettings settings) : base(parameterViewStackService) { settings .WhenAnyValue(x => x.UserName) .ToProperty(this, nameof(UserName), out _userName) .DisposeWith(Subscriptions); SignUp = ReactiveCommand.CreateFromObservable(ExecuteSignUp); }
public MainViewModel( IParameterViewStackService parameterViewStackService, INotificationManager notificationManager, IBlobCache blobCache) : base(parameterViewStackService) { _parameterViewStackService = parameterViewStackService; _notificationManager = notificationManager; _blobCache = blobCache; }
public SpeakerDetailViewModel(IParameterViewStackService viewStackService, ISpeakerService speakerService) { _viewStackService = viewStackService; _speakerService = speakerService; this.WhenAnyValue(x => x.Speaker) .WhereNotNull() .Subscribe(x => ImageSource = ImageSource.FromUri(x.ProfilePicture)); GetSpeaker = ReactiveCommand.CreateFromTask <Guid>(ExecuteGetSpeaker); }
public StoreSearchViewModel( IParameterViewStackService parameterViewStackService, IPopupViewStackService popupViewStackService, IStoreService storeService, INotificationManager notificationManager) : base(parameterViewStackService) { _popupViewStackService = popupViewStackService; _storeService = storeService; _notificationManager = notificationManager; _searchFunction.DisposeWith(Subscriptions); _storeService .Stores .Connect() .RefCount() .Filter(_searchFunction.AsObservable()) .Transform(x => new StoreCardViewModel(x)) .ObserveOn(RxApp.MainThreadScheduler) .Bind(out _stores) .DisposeMany() .Subscribe() .DisposeWith(Subscriptions); _storeService .Metadata .ObserveOn(RxApp.MainThreadScheduler) .Bind(out _storeNames) .DisposeMany() .Subscribe() .DisposeWith(Subscriptions); var isLoading = this.WhenAnyObservable(x => x.Search.IsExecuting, x => x.InitializeData.IsExecuting, x => x.Details.IsExecuting, x => x.Category.IsExecuting, (search, initialize, details, category) => search || initialize || details || category); isLoading .ToProperty(this, nameof(IsLoading), out _isLoading, deferSubscription: true) .DisposeWith(Subscriptions); var canExecute = isLoading.Select(x => !x).StartWith(true); Search = ReactiveCommand.CreateFromObservable <string, Unit>(ExecuteSearch, canExecute); Details = ReactiveCommand.CreateFromObservable <StoreCardViewModel, Unit>(ExecuteDetails); InitializeData = ReactiveCommand.CreateFromObservable(ExecuteInitializeData); Category = ReactiveCommand.CreateFromObservable <string, Unit>(ExecuteCategory, canExecute); }
public NavigationRootViewModel() { _parameterViewStackService = Locator.Current.GetService <IParameterViewStackService>(); NavigationItems = new ObservableCollection <NavigationItemViewModel> { new NavigationItemViewModel { Title = "List View", Icon = ListAlt, IViewFor = typeof(ListOptionsViewModel) }, new NavigationItemViewModel { Title = "Collection View", Icon = LayerGroup, IViewFor = typeof(CollectionOptionsViewModel) } }; Navigate = ReactiveCommand.CreateFromObservable <NavigationItemViewModel, Unit>(ExecuteNavigate); }
public DrinkCollectionViewModel() { _viewStackService = Locator.Current.GetService <IParameterViewStackService>(); _coffeeService = Locator.Current.GetService <ICoffeeService>(); CoffeeDetails = ReactiveCommand.CreateFromObservable <DrinkViewModel, Unit>(ExecuteNavigate).DisposeWith(ViewModelSubscriptions); _coffeeService .ChangeSet .SubscribeOn(RxApp.TaskpoolScheduler) .Transform(x => new DrinkViewModel(x.Id, x.Name, x.Species, x.Regions, x.Image)) // .Sort(SortExpressionComparer<DrinkViewModel>.Ascending(p => p.Name)) .ObserveOn(RxApp.MainThreadScheduler) .Bind(out _coffeeList) .DisposeMany() .Subscribe() .DisposeWith(ViewModelSubscriptions); }
public SpeakerProfileViewModel(IParameterViewStackService viewStackService, ISpeakerService speakerService) { _viewStackService = viewStackService; _speakerService = speakerService; this.WhenAnyValue(x => x.SpeakerId) .Subscribe(id => { Observable .Return(Unit.Default) .SelectMany(async x => { Speaker = await _speakerService.Get(SpeakerId.ToString()); return(Unit.Default); }) .Subscribe(); }); }
public CollectionOptionsViewModel() { _viewStackService = Locator.Current.GetService <IParameterViewStackService>(); Navigate = ReactiveCommand.CreateFromObservable <CollectionOptionViewModel, Unit>(ExecuteNavigate); Items = new ObservableCollection <CollectionOptionViewModel> { new CollectionOptionViewModel { Option = CollectionOption.DetailNavigation }, new CollectionOptionViewModel { Option = CollectionOption.Search }, new CollectionOptionViewModel { Option = CollectionOption.InfiniteScroll } }; }
public SpeakerListViewModel(IParameterViewStackService viewStackService, ISpeakerService speakerService) { _viewStackService = viewStackService; _speakerService = speakerService; Refresh = ReactiveCommand.CreateFromTask(ExecuteRefresh); ItemTapped = ReactiveCommand.Create <SpeakerItemViewModel, Unit>(item => { var profile = new SpeakerDetailViewModel(_viewStackService, new SpeakerServiceMock()); _viewStackService.PushPage(profile, new NavigationParameter { { "Id", item.SpeakerId.ToString() } }).Subscribe(); return(Unit.Default); }); _isRefreshing = this.WhenAnyObservable(x => x.Refresh.IsExecuting) .ToProperty(this, x => x.IsRefreshing) .DisposeWith(Subscriptions); }
public CoffeeListViewModel(IParameterViewStackService parameterViewStackService, ICoffeeService coffeeService) { _viewStackService = parameterViewStackService; _coffeeService = coffeeService; CoffeeDetails = ReactiveCommand.CreateFromObservable <CoffeeCellViewModel, Unit>(ExecuteNavigate).DisposeWith(ViewModelSubscriptions); Refresh = ReactiveCommand.CreateFromTask(ExecuteRefresh).DisposeWith(ViewModelSubscriptions); _coffeeService .ChangeSet .Transform(x => new CoffeeCellViewModel(x.Id, x.Name, x.Species, x.Regions, x.Image)) .Sort(SortExpressionComparer <CoffeeCellViewModel> .Ascending(p => p.Name)) .Bind(out _coffeeList) .DisposeMany() .Subscribe() .DisposeWith(ViewModelSubscriptions); CoffeeDetails = ReactiveCommand.CreateFromObservable <CoffeeCellViewModel, Unit>(ExecuteNavigate).DisposeWith(ViewModelSubscriptions); }
public SplashViewModel(IParameterViewStackService parameterViewStackService, IAppStartup appStartup) : base(parameterViewStackService) { _appStartup = appStartup; Initialize = ReactiveCommand.CreateFromObservable(ExecuteInitialize); Navigate = ReactiveCommand.CreateFromObservable(ExecuteNavigate); var initializing = this.WhenAnyObservable(x => x.Initialize.IsExecuting) .StartWith(false); initializing .ToProperty(this, nameof(IsLoading), out _loading) .DisposeWith(Subscriptions); initializing .Zip(initializing.Skip(1), (first, second) => first && !second) .Where(x => x) .Select(x => Unit.Default) .InvokeCommand(Navigate); }
protected BaseViewModel(IParameterViewStackService parameterViewStackService) { var type = GetType(); this.Log().Write("View Model Initialization", type, LogLevel.Info); Disposable = new CompositeDisposable(); Id = type.Name; ParameterViewStackService = parameterViewStackService; GoBack = ReactiveCommand.CreateFromObservable(() => ParameterViewStackService.PopPage()); GoBackModal = ReactiveCommand.CreateFromObservable(() => ParameterViewStackService.PopModal()); GoBackToRoot = ReactiveCommand.CreateFromObservable(() => ParameterViewStackService.PopToRootPage()); GoBack .ThrownExceptions .Subscribe(x => this.Log().Write(x, nameof(GoBack), LogLevel.Error)); GoBackModal .ThrownExceptions .Subscribe(x => this.Log().Write(x, nameof(GoBackModal), LogLevel.Error)); GoBackToRoot .ThrownExceptions .Subscribe(x => this.Log().Write(x, nameof(GoBackToRoot), LogLevel.Error)); }
public ScheduleViewModel(IParameterViewStackService viewStackService) { _viewStackService = viewStackService; }
public SignUpViewModel(IParameterViewStackService parameterViewStackService) : base(parameterViewStackService) { Cancel = ReactiveCommand.CreateFromObservable(ExecuteCancel); }
public AgendaViewModel(IParameterViewStackService viewStackService) { _viewStackService = viewStackService; }
static NavigationExtensions() { _stackService = Locator.Current.GetService <IParameterViewStackService>(); }
public void SetNavigationService(IParameterViewStackService viewStackService) { ViewStackService = viewStackService; }
protected ViewModelBase(IParameterViewStackService parameterViewStackService) { ViewStackService = parameterViewStackService; }
public SponsorListViewModel(IParameterViewStackService viewStackService) { _viewStackService = viewStackService; }