13 lines
335 B
C#
13 lines
335 B
C#
using System;
|
|
using Avalonia.Threading;
|
|
|
|
namespace Flawless.Client;
|
|
|
|
public static class ObserverHelper
|
|
{
|
|
public static void SubscribeOnUIThread<T>(this IObservable<T> observer, Action<T> onNext)
|
|
{
|
|
var dispatcher = Dispatcher.UIThread;
|
|
observer.Subscribe(val => dispatcher.Invoke(() => onNext(val)));
|
|
}
|
|
} |