55 lines
1.8 KiB
C#
55 lines
1.8 KiB
C#
using Prism.Ioc;
|
|
using System;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using XplorePlane.Services;
|
|
using XplorePlane.ViewModels;
|
|
|
|
namespace XplorePlane.Views
|
|
{
|
|
public partial class ImageProcessingPanelView : UserControl
|
|
{
|
|
private IImageProcessingService _imageProcessingService;
|
|
|
|
public ImageProcessingPanelView()
|
|
{
|
|
InitializeComponent();
|
|
Loaded += OnLoaded;
|
|
}
|
|
|
|
private void OnLoaded(object sender, RoutedEventArgs e)
|
|
{
|
|
var container = ContainerLocator.Current;
|
|
if (container == null) return;
|
|
|
|
if (DataContext == null)
|
|
DataContext = container.Resolve<ImageProcessingViewModel>();
|
|
|
|
_imageProcessingService = container.Resolve<IImageProcessingService>();
|
|
}
|
|
|
|
private void OnProcessorComboChanged(object sender, SelectionChangedEventArgs e)
|
|
{
|
|
if (sender is ComboBox cmb && cmb.SelectedItem is ProcessorItem item
|
|
&& _imageProcessingService != null)
|
|
{
|
|
try
|
|
{
|
|
var processor = _imageProcessingService.GetProcessor(item.Key);
|
|
parameterControl.LoadProcessor(processor);
|
|
}
|
|
catch (ArgumentException)
|
|
{
|
|
// 16-bit processor — no UI parameters supported via ProcessorParameterControl
|
|
parameterControl.Clear();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void OnParameterChanged(object sender, EventArgs e)
|
|
{
|
|
// Parameters are applied directly to the processor instance inside ProcessorParameterControl.
|
|
// Nothing extra needed here — ApplyProcessingCommand will pick them up via the service.
|
|
}
|
|
}
|
|
} |