reactiveui

ReactiveUI: Testing observable properties from unit tests

♀尐吖头ヾ 提交于 2019-12-13 04:19:12
问题 There is this example on the official RX blog: var scheduler = new TestScheduler(); var xs = scheduler.CreateColdObservable( OnNext(10, 42), OnCompleted<int>(20) ); var res = scheduler.Start(() => xs); res.Messages.AssertEqual( OnNext(210, 42), // Subscribed + 10 OnCompleted<int>(220) // Subscribed + 20 ); xs.Subscriptions.AssertEqual( Subscribe(200, 1000) // [Subscribed, Disposed] ); I'd like to do something like this with reactiveui. I mean instead of the scheduler.CreateColdObservable(...)

ReactiveUI - WhenActivated and Output Properties

只愿长相守 提交于 2019-12-13 03:46:27
问题 I'm using ReactiveUI and I'm trying to change all my ViewModels' rules with WhenActivated but I'm unable understand how to have it working well in conjunction with output properties. The pattern is something like this.WhenActivated( registerDisposable => { registerDisposable(this.Bind(…)); registerDisposable(this.WhenAny(…)); registerDisposable(this.WhenAnyValue(…)); }); and the output properties looks like protected readonly ObservableAsPropertyHelper<object> _Obj; public object Obj => _Obj

ReactiveUI 5 instant search

陌路散爱 提交于 2019-12-13 03:03:31
问题 Following my earlier question about Reactive Extensions Instant Search for WPF/MVVM, wherein... I would like to implement a TextBox where, as you type, results appear instantly in another ListBox ...I found that this problem had originally been addressed by ReactiveUI and there was a relatively straightforward solution posted in the ReactiveUI blog and documentation. Fast forward to ReactiveUI 5, and the API has been changed, and the old examples don't work any more. ReactiveAsyncCommand has

ReactiveCommand pass Command Parameter

狂风中的少年 提交于 2019-12-12 13:29:24
问题 I want to use command to realize the KeyDown Event in textbox, I wnat to let the command can recognize which key input such as KeyEventArgs do in KeyDown Event and do some other things, So I want to pass command parameter into ReactiveCommand (just like Eventargs do in Event Method), but I don't know how to do it. I have WPF Xaml code : <Window x:Class="NameSpaceTest.OpenFileW" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006

Issues with IMutableDependencyResolver and Structuremap in ReactiveUI

。_饼干妹妹 提交于 2019-12-12 01:47:12
问题 First off, let me say that I don't think that is is an issue with ReactiveUI per se, which is why I've not created an issue on its github repo, and second, I realise that I'm using a beta version of ReactiveUI. I want to use Structuremap because I'm going to have a plugin scenario in my WPF app, and the DI container in Splat isn't cut out for that sort of thing. Observe these unit tests: [Fact] public void ShouldBeAbleToOverrideDefaultDependencyResolver() { Locator.Current = new

CreateAsyncObservable not raising OnComplete

…衆ロ難τιáo~ 提交于 2019-12-11 20:47:58
问题 Still playing around with ReactiveUi. I'm currently having trouble determining when a sequence has ended. I have the following code : public RxTest() { DownloadDocument = ReactiveCommand.CreateAsyncObservable(_ => GetItems().ToObservable()); DownloadDocument.Subscribe(Console.WriteLine, () => Console.WriteLine("Done")); } public ReactiveCommand<int> DownloadDocument { get; set; } public void RunCommand() { DownloadDocument.Execute(new object()); } IEnumerable<int> GetItems() { for (int i = 0;

Should i dispose IScheduler.Schedule subscription mannualy to avoid memory leaks?

元气小坏坏 提交于 2019-12-11 18:04:18
问题 In my project i have to call RxApp.MainThreadScheduler.Schedule(() => ...) Should I dispose subscription mannualy by adding DisposeWith(DisposableOnDestroy) or it automatically called by destructor? I have read ReactiveUI recomendations, but did not find answer RxApp.MainThreadScheduler.Schedule(() => this.RaisePropertyChanged(statisticName)) 回答1: No, only Dispose if you want to cancel a queued operation early. Also, what you're trying to do with RaisePropertyChanged here will eventually make

Tracking the execution of dynamic data filters and sorts

半城伤御伤魂 提交于 2019-12-11 16:37:30
问题 ReactiveUI recommends the use of dynamic-data going forward. I try to migrate what make sense as I have to work in my view models . Recently I've been facing a problem that I just can't seem able to find a solution to. In one of my pages, dynamic data is used with a SourceCache of 100,000 items on which I need to apply dynamic filters and sorts. This issue is that even if filtering on 100,000 happens relatively fast on a mobile device the user has no idea if we are done filtering or not. The

Xamarin.Android and Spinner binding with ReactiveUI

元气小坏坏 提交于 2019-12-11 15:27:36
问题 I'm trying to bind to a Spinner using ReactiveUI in a Xamarin.Android application. To add items to the Spinner , I need to use ArrayAdapter . But ArrayAdapter needs Android.Content.Context . Should I pass it into the ViewModel? Anyone know about an application written in Xamarin.Android, which uses ReactiveUI, where I could look inspiration? The ReactiveUI documentation only has a reference to a sample application written for iOS. View <?xml version="1.0" encoding="utf-8"?> <RelativeLayout

Should we use Reactive Extension's Observable pattern to run multiple dependent async tasks? [closed]

一世执手 提交于 2019-12-11 15:14:32
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 10 months ago . I have a general question regarding designing the architecture of my cross-platform solution (Xamarin.Forms and ASP.NET Core). I have a requirement of calling multiple API endpoints (similar to a blog aggregation app) and I want to create a shared REST API wrapper library