using ImageMagick;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;

namespace Ocr.Gui.Views;

/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class ImageView : Window
{
  private ImageViewModel ViewModel => (ImageViewModel)DataContext;

  public ImageView()
  {
    DataContext = new ImageViewModel();
    InitializeComponent();
  }

  public ImageView(MagickImage image)
  {
    DataContext = new ImageViewModel(image);
    InitializeComponent();
  }

  private void SldBorder_OnDragCompleted(object sender, DragCompletedEventArgs e)
  {
    var vm = ViewModel;
    vm.ProcessorConfig.Border = (int)Math.Round(((Slider)sender).Value);
  }
}