public RepairViewModel() { DisplayName = "Diagnose and Repair Synq Repository"; Activator = new ViewModelActivator(); ReactiveCommand.CreateAsyncTask( x => DomainEvilGlobal.SelectedGame.ActiveGame.Controller.BundleManager.Repo.Repair()) .SetNewCommand(this, x => x.ProcessCommand) .Subscribe(); ReactiveCommand.Create(ProcessCommand.IsExecuting.Select(x => !x)) .SetNewCommand(this, x => x.OkCommand) .Subscribe(x => TryClose()); //this.WhenActivated(d => ProcessCommand.Execute(null)); }
public PreferencesViewModel() { Activator = new ViewModelActivator(); _userSettings = Locator.Current.GetService<UserSettings>(); _apiKey = _userSettings.ApiKey; _refreshInterval = _userSettings.RefreshInterval; this.WhenActivated(d => { d(Close = ReactiveCommand.Create()); d(Closing = ReactiveCommand.Create()); d(Save = ReactiveCommand.Create()); d(Closing.Subscribe(_ => { var vm = Locator.Current.GetService<MainViewModel>(); vm.PreferencesOpened = false; })); d(Save.Subscribe(_ => { _userSettings.ApiKey = ApiKey; _userSettings.RefreshInterval = RefreshInterval; _userSettings.Save(); Close.Execute(null); })); }); }
public MainViewModel() { var whenAnyColorChanges = this.WhenAny(x => x.Red, x => x.Green, x => x.Blue, (r, g, b) => IntegersToColor(r.Value, g.Value, b.Value)); Activator = new ViewModelActivator(); this.WhenActivated(d => { //create color property d(whenAnyColorChanges .Where(c => c != null) .Select(c => new SolidColorBrush(c.Value)) .ToProperty(this, x => x.FinalColor, out this.color)); // create the command d(this.SearchCommand = ReactiveCommand.CreateAsyncObservable( whenAnyColorChanges.Select(x => x != null), c => this.GetImages(c as SolidColorBrush).Select(e => e))); // subscribe to the result of the command d(this.SearchCommand.Select(ie => new ReactiveList<string>(ie)).ToProperty(this, x => x.Images, out this.images)); }); }
protected RxViewModelBase() { Activator = new ViewModelActivator(); }
public ReactiveViewModel() { Activator = new ViewModelActivator(); }
protected ViewModel() { Activator = new ViewModelActivator(); }