-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix invoke in main thread issue for macOS, increase version to 1.2.3
- Loading branch information
Showing
27 changed files
with
174 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,44 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Linq.Expressions; | ||
using System.Reactive.Concurrency; | ||
using System.Reactive.Linq; | ||
|
||
using ReactiveUI; | ||
using ReactiveUI.Fody.Helpers; | ||
|
||
namespace Atomex.Client.Desktop.Common | ||
{ | ||
public static class ObservableExtensions | ||
{ | ||
public static IObservable<(T1, T2)> WhereAllNotNull<T1, T2>(this IObservable<(T1?, T2?)> observable) => | ||
observable.Where(t => t.Item1 != null && t.Item2 != null); | ||
|
||
public static IDisposable SubscribeInMainThread<T>( | ||
this IObservable<T> observable, | ||
Action<T> onNext) | ||
{ | ||
return observable | ||
.ObserveOn(RxApp.MainThreadScheduler) | ||
.Subscribe(onNext); | ||
} | ||
|
||
public static ObservableAsPropertyHelper<TRet> ToPropertyExInMainThread<TObj, TRet>( | ||
this IObservable<TRet> item, | ||
TObj source, | ||
Expression<Func<TObj, TRet>> property, | ||
bool deferSubscription = false) where TObj : ReactiveObject | ||
{ | ||
return item.ToPropertyEx(source, property, deferSubscription, RxApp.MainThreadScheduler); | ||
} | ||
|
||
public static IDisposable InvokeCommandInMainThread<T, TResult>( | ||
this IObservable<T> item, | ||
ReactiveCommandBase<T, TResult>? command) | ||
{ | ||
return item | ||
.ObserveOn(RxApp.MainThreadScheduler) | ||
.InvokeCommand(command); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.