public MainViewModel(IPhoneRepositoryAsync repository, IDialogManager dialogManager) { MainViewController _controller = new MainViewController(repository, dialogManager, this); this.WhenActivated(disposables => { _controller.BindTitle().DisposeWith(disposables); _controller.BindRefreshFilter().DisposeWith(disposables); _controller.BindRefreshCommand().DisposeWith(disposables); _controller.BindTestCommand().DisposeWith(disposables); _controller.BindEditCommand().DisposeWith(disposables); _controller.BindConfirmCommand().DisposeWith(disposables); _controller.BindOpenFilesCommand().DisposeWith(disposables); _controller.BindOpenFolderCommand().DisposeWith(disposables); RefreshCommand.Execute().Subscribe(phones => { var m = this; //то что сделать после обработки по умолчанию }).DisposeWith(disposables); }); }
public MainViewModel() { MainViewController _controller = new MainViewController(this); /* this.WhenAnyValue(m => m.Title) * .Subscribe(title => * { * if (string.IsNullOrWhiteSpace(title) || title == "…") * this.Title = "Radish"; * else * this.Title = "Radish - " + title; * * this.RefreshFilter.Clear(); * if (int.TryParse(title, out int id)) * this.RefreshFilter.Add(a => a.Id > id); * else * this.RefreshFilter.Add(a => a.Id > 2); * this.RefreshFilter.Add(b => b.DisplayId == 1); * });*/ this.WhenActivated(disposables => { _controller.BindTitle().DisposeWith(disposables); _controller.BindRefreshFilter().DisposeWith(disposables); _controller.BindRefreshCommand().DisposeWith(disposables); _controller.BindTestCommand().DisposeWith(disposables); _controller.BindEditCommand().DisposeWith(disposables); _controller.BindConfirmCommand().DisposeWith(disposables); _controller.BindOpenFilesCommand().DisposeWith(disposables); _controller.BindOpenFolderCommand().DisposeWith(disposables); RefreshCommand.Execute().Subscribe(phones => { var m = this; //то что сделать после обработки по умолчанию }).DisposeWith(disposables); }); }