I think that the SelectedTool state variable should be readonly and set upon the tool selection (should this be ObservableAsPropertyHelper?) I would actually drive this the other way around - the SelectedTool as an Enum should be the Source Of Truthâ„¢, and have the button state be a reflection...
The thing with ReactiveUI when you bind to things like a ListBox using the OneWayBind method, is that it will try to automatically apply a custom template for the data based upon the views it finds with Splat.Locator.Resolve. In your case, it is trying to find and build a view...
c#,mvvm,system.reactive,reactiveui
I would set up a proxy via using a Subject: var areAllAvailable = new BehaviorSubject<bool>(true); PauseCommand = new ReactiveCommand(areAllAvailable); PlayCommand = new ReactiveCommand(areAllAvailable); Observable.CombineLatest(PauseCommand.IsExecuting, PlayCommand.IsExecuting, (pa,pl) => !(pa || pl)) .Subscribe(allAreAvailable); ...
Merge has a max parallelism parameter: AsyncCommand = ReactiveCommand.CreateAsyncObservable(_ => { // Set progress bar indicator to 0 var set = new [] {...} // The set of items to process // Set the progress bar indicator max to the count of the items to process return set .ToObservable() .Select(item...
You must call Subscribe either way. Queries in Rx use lazy evaluation, which means that merely defining a query does not start it. Lazy evaluation allows you to build a query by applying operators conditionally, to define a query only once and store it in a field for later, or...
c#,parallel-processing,system.reactive,reactiveui
As usual, Paul Betts has answered a similar question that solves my problem: The question: Reactive Extensions Parallel processing based on specific number Has some information on using Observable.Defer and then merging into batches, using that I've modified my previous code like so: return inputs.Select(i => new AccountViewModel(i)) .ToObservable() .ObserveOn(RxApp.MainThreadScheduler)...
So as usual it was the programmer's problem. :D This is the way I did it now and I'm quite happy with the solution. I missed using System;, which made C# take the Subscribe method from another lib. this.WhenAnyValue(activity => activity.ViewModel.WeatherIcon) .Subscribe(image => { if (image == null) return; WeatherImageView.SetImageDrawable(image.ToNative());...
I think you may be over-thinking it. Everything you've suggested sounds reasonable and would result in easy to follow code in the first instance. You can wrap the regex projection+filtering logic into a custom operator with a meaningful name to maximise readability. Check if performance is a problem before you...
I'm not familiar with ReactiveUI, but if it uses the same IObservable as Reactive Extensions, then you could do this: this.WhenAny(x => x.IsMax, x => x.Value) .Where(_ => Identifier == "xyz") .Subscribe(_ => { isOk = true; }); Is this what you wanted? PS.: I should have asked this in...
c#,windows-phone-7,mvvm,listbox,reactiveui
In xaml in ListBox: SelectedItem={Binding SelectedStudent, Mode=TwoWay} Then in ViewModel: public ObservableCollection<YOUR_OBJECT_HERE> SelectedItems { get; set;} EDIT Full example: <ListBox Margin="5,0" Grid.Row="1" Grid.RowSpan="2" ItemsSource="{Binding Roles}" SelectedItem="{Binding SelectedItem, Mode=TwoWay}"> <ListBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Path=Title}" /> </DataTemplate> </ListBox.ItemTemplate> </ListBox> ViewModel public class RolesViewModel :...
the called method signature that I was using was causing the issue. private Task<Unit> DeleteImpl() { throw new NotImplementedException(); } was missing the async keyword changing the method to private async Task<Unit> DeleteImpl() { throw new NotImplementedException(); } ...
javascript,mongodb,d3.js,meteor,reactiveui
Thank you all.... No need of any corrections to the code. I got it worked by changing the _id of the documents. I gave my own _id instead of the auto generated _ids in mongoldb
c#,system.reactive,reactive-programming,reactiveui
Throttle doesn't set the scheduler, write Throttle(timespan, RxApp.MainThreadScheduler) instead
The UserError framework would work well for this scenario, it's probably what I would do. The advantage of using UserError is that you can simulate all of the scenarios really easily (i.e. user declines first view, decides yes later; user clicks yes; etc etc). Define a subclass of UserError (LocationPermissionError...
The first won't work as it's observing property changes and ItemChanged itself won't change, it's an observable. The second is pretty much correct, but requires a bit of a modification. WhenAnyObservable requires that all the observables are the same type. As you're uninterested in the actual result, you can select...
Not at the moment - you can certainly use ReactiveUI without routing though, it's an entirely optional feature
c#,mvvm,reactiveui,cancellation
RxUI 5.x doesn't have this built-in, but it's easy to fake: var results = searchCommand.RegisterAsync<List<Location>>( _ => Observable.StartAsync(ct => DoSearchAsync(query, ct))); In RxUI v6, this is built in: searchCommand = ReactiveCommand.CreateAsyncTask( (_, ct) => DoSearchAsync(query, ct)); ...
Your Throttle doesn't set a scheduler, this is a classic TestScheduler mistake
wpf,system.reactive,reactiveui,csla
It appears that this is a bug in ReactiveUI. If their type isn't actually serializable and isn't designed to flow across AppDomain, process, or network boundaries, then it shouldn't be marked as serializable.
Looks like this issue was fixed in ReactiveUI 6.2.1.
mvvm,routing,windows-runtime,reactiveui
It states that by setting up ReactiveUI.Mobile, you will be able to achieve correct handling of the back button for free. I've tried to look around for documentation but can't seem to find any. Setting up RxUI.Mobile is super platform-dependent, and you only get a free back button on...
Try the following: this.WhenAnyValue (x => x.Month, y => y.Year ) .Select (x => String.Format("{0} {1}", CultureInfo.CurrentCulture.DateTimeFormat.GetAbbreviatedMonthName (x.Item1), x.Item2)) .ToProperty (this, x => x.DateLabel, out dateLabel); I think that will do what you want!...
This code is perfect, i think you're just missing a using statement, "using System.Reactive" Update: The reason that this doesn't work is code that's not in the snippet. You declared TryAuthenticateCommand as IReactiveCommand which doesn't implement IObservable<T> (what would T be?). In this case, since you're not providing an async...
The way to do it is via Splat's service locator: Locator.CurrentMutable.RegisterConstant( new MyCoolTypeConverter(), typeof(IBindingTypeConverter)); Update: If you're using RxUI 5.x, it's "RxApp.CurrentMutable"...
c#,wpf,system.reactive,reactiveui
This API is actually intentionally missing, because there is no elegant way for Create to return both the ReactiveCommand and the IDisposable result from Create. You could do something ugly with out parameters, but it'd end up being pretty cumbersome. While I definitely also sometimes miss a CreateWithAction or something...
The reason you're seeing these exceptions is because you're using WhenActivated in the ViewModel, and those VMs are being removed before the Task completes. You don't need to use WhenActivated in the ViewModel unless: You need to know when the View associated with this ViewModel actually becomes visible or is...
How about this: var canExecute = this.WhenAny(x => x.kvartal.KanGodkendeBilag, x => x.IsBusy, (bilag, busy) => bilag.Value && !busy.Value); GodkendeBilagCommand = ReactiveCommand.Create(canExecute); ...
In ReactiveUI, the desire to do this means that you are Doing It Wrong (or at least, not the RxUI way). IsSaveable is related to IsValid, you should describe that using WhenAny and ToProperty. Maybe you could write that as: this.WhenAny(x => x.IsValid, x => x.IsChanged, (valid, changed) => valid.Value...
It seems a bit confusing because of all the parallel patterns are mixed together here: I would suggest something more like (untested): Command = ReactiveCommand.CreateAsyncObservable(_ => { return items.ToObservable() .SelectMany(RunSlowProcess, (item, itemIndex, processed) => itemIndex); }) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(i => Progress = i); ...
I think this is what you're after: (from progressController in Dialogs.ShowProgress("logging in", "doing stuff...") from result in DoTheActualLogin(pair) select new { result, progressController }) .Subscribe(anon => {...}, ex => {...}) ...