mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
UI - Streamlined VM names
This commit is contained in:
1 parent
cd8656cb0d
commit
eac08050bc
9 files changed
+76
-54
No files matched your search
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Reactive.Linq;
|
||||
using Artemis.Core;
|
||||
|
||||
namespace Artemis.UI.Shared.Extensions;
|
||||
|
||||
/// <summary>
|
||||
/// Provides utilities when working with layer properties in a UI context.
|
||||
/// </summary>
|
||||
public static class LayerPropertyExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns an observable sequence of layer property values starting with the current value.
|
||||
/// </summary>
|
||||
/// <param name="layerProperty">The layer property to create the sequence of.</param>
|
||||
/// <typeparam name="T">The value type of the layer property.</typeparam>
|
||||
/// <returns>An observable sequence of layer property values starting with the current value.</returns>
|
||||
public static IObservable<T> AsObservable<T>(this LayerProperty<T> layerProperty)
|
||||
{
|
||||
return Observable.FromEventPattern<LayerPropertyEventArgs>(x => layerProperty.Updated += x, x => layerProperty.Updated -= x)
|
||||
.Select(_ => layerProperty.CurrentValue)
|
||||
.StartWith(layerProperty.CurrentValue);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user