These are chat archives for AvaloniaUI/Avalonia

29th
Aug 2016
Ivan Kochurkin
@KvanTTT
Aug 29 2016 11:28
Hi! How can I ObserveOnDispatcher in Avalonia?
I want to update UI from another thread.
I can use Dispatcher.UIThread.InvokeAsync( but it is not clear solution.
If I use ObserveOnDispatcher code throws an exception: An exception of type 'System.InvalidOperationException' occurred in System.Reactive.Windows.Threading.dll but was not handled in user code
Andrey Kunchev
@donandren
Aug 29 2016 11:31
@KvanTTT you make it in a few different ways. using Observe on Scheduler and using a scheduler from AvaloniaScheduler.Instance, RxApp.MainThreadScheduler
danwalmsley
@danwalmsley
Aug 29 2016 11:35
@KvanTTT iv been using await Dispatcher.UiThread.InvokeTaskAsync
Seems to work well, im not aware of the other ways to do it
Thats the avalonia built in way to do it
Probably it crashes because that part of Rx might not have been ported yet
Ivan Kochurkin
@KvanTTT
Aug 29 2016 11:39
@donandren It seems to me that this code working:
Observable.FromEventPattern<WorkflowState>(
ev => _workflow.StateChanged += ev, ev => _workflow.StateChanged -= ev)
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(ev =>
{
    CurrentState = ev.EventArgs.Stage.ToString();
});
Thanks!
But I guess ObserveOnDispatcher method should works too.
@danwalmsley it is not very clear to write Dispatcher.UIThread.InvokeAsync(() => everywhere.
danwalmsley
@danwalmsley
Aug 29 2016 11:45
yeah I agree
Steven Kirk
@grokys
Aug 29 2016 21:24
ok, i'm back!
still struggling to get used to being in front of a computer tho
Steven Kirk
@grokys
Aug 29 2016 21:37
btw if anyone's interested, our team at GH are hiring for a developer for the VS plugin: https://jobs.lever.co/github/9be225ec-9ad0-4439-b173-0eeea4e9f587
send me a PM if you apply
Darnell Williams
@Seeker1437
Aug 29 2016 23:30
Man i wanna do it toooo but no degree or professional experience
This is epic, I wanna really do this now
D: