36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
using System.Reactive.Disposables;
|
|
using System.Windows;
|
|
using Intromat.ViewModels;
|
|
using ReactiveUI;
|
|
|
|
namespace Intromat.Views
|
|
{
|
|
public partial class CodePreviewView : IViewFor<CodePreviewViewModel>
|
|
{
|
|
public static readonly DependencyProperty ViewModelProperty = DependencyProperty.Register(nameof(ViewModel),
|
|
typeof(CodePreviewViewModel), typeof(CodePreviewView), new PropertyMetadata(null));
|
|
|
|
public CodePreviewView()
|
|
{
|
|
InitializeComponent();
|
|
|
|
this.WhenActivated(d =>
|
|
{
|
|
this.OneWayBind(ViewModel, vm => vm.CompiledCode, v => v.codeTextBlock.Text).DisposeWith(d);
|
|
this.OneWayBind(ViewModel, vm => vm.CompilerError, v => v.errorTextBlock.Text).DisposeWith(d);
|
|
});
|
|
}
|
|
|
|
public CodePreviewViewModel? ViewModel
|
|
{
|
|
get => (CodePreviewViewModel?)GetValue(ViewModelProperty);
|
|
set => SetValue(ViewModelProperty, value);
|
|
}
|
|
|
|
object? IViewFor.ViewModel
|
|
{
|
|
get => ViewModel;
|
|
set => ViewModel = (CodePreviewViewModel?)value;
|
|
}
|
|
}
|
|
} |