From 819da3f29d3d4f74ef93ba95c34b4be9c8f8e79b Mon Sep 17 00:00:00 2001 From: Simon G Date: Wed, 14 Apr 2021 15:56:02 +0200 Subject: [PATCH] - start implementing ChannelViewModel --- Mystify/ViewModels/ChannelViewModel.cs | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Mystify/ViewModels/ChannelViewModel.cs diff --git a/Mystify/ViewModels/ChannelViewModel.cs b/Mystify/ViewModels/ChannelViewModel.cs new file mode 100644 index 0000000..6d3209e --- /dev/null +++ b/Mystify/ViewModels/ChannelViewModel.cs @@ -0,0 +1,34 @@ +// Author: Gockner, Simon +// Created: 2021-04-14 +// Copyright(c) 2021 SimonG. All Rights Reserved. + +using System.Windows.Input; +using Lib.Audio.Interfaces; +using ReactiveUI; + +namespace Mystify.ViewModels +{ + public class ChannelViewModel : ViewModelBase + { + private readonly IChannel _channel; + + public ChannelViewModel(IChannel channel) => _channel = channel; + + public IControllable? Controllable + { + get => _channel.Controllable; + set + { + if (value != null) + _channel.MapControllable(value); + } + } + + public bool IsControllableMapped => Controllable != null; + public bool IsPopupOpen { get; private set; } + + public ICommand SelectControllableCommand => ReactiveCommand.Create(SelectControllable); + + private void SelectControllable() => IsPopupOpen = true; + } +} \ No newline at end of file