Files
XplorePlane/XP.ImageProcessing.RoiControl/PointListConverter.cs
T
XplorePlane Developer 957157ae80 fix: 修复编译错误、BGA向导预览、算子重复插入及状态栏消息
## Compilation fixes
- Fix XAML namespace reference XplorePlane.Converters → XplorePlane.Helpers (EventLogView, StateDisplayView)
- Add missing using for ISampleTypeRepository / JsonSampleTypeRepository in App.xaml.cs
- Fix ILoggerService.Warn() calls using Exception as first arg instead of message string
- Serialize CncProgram to JSON when passing to MatrixLayout (expects string, not CncProgram object)
- Suppress CS8632 nullable annotation warnings project-wide

## BGA wizard fixes
- Fix preview not showing on step 3: force RefreshBgaPreview() when entering final step
- Add step validation in CanNext() to prevent skipping to preview with invalid inputs
- Notify NextCommand.CanExecuteChanged when inputs change
- Fix RunProgress runtime binding error: set Mode=OneWay for ProgressBar.Value

## Operator toolbox: prevent duplicate insertion
- Add static OperatorTarget property for direct dispatch to active pipeline
- PipelineEditorView registers as toolbox target on load (floating window only)
- CNC page sets initial target; PipelineEditorWindow resets to CNC pipeline on close
- '+' button inserts only to the active pipeline instead of broadcasting to all subscribers

## Pipeline editor status bar messages
- Add StatusBarMessageEvent / StatusBarMessagePayload to CommonEvents.cs
- PipelineEditorViewModel publishes status on all ops (add/remove/reorder/save/execute)
- MainViewModel subscribes and displays on main window bottom status bar
- Auto-clear after timeout (3s info, 5s error)

## docs
- Merge three architecture docs into consolidated XplorePlane-架构与结构说明.md
2026-07-24 15:59:16 +08:00

68 lines
2.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;
namespace XP.ImageProcessing.RoiControl
{
/// <summary>
/// 将Point列表转换为PointCollection,支持ObservableCollection变化通知
/// </summary>
public class PointListToPointCollectionConverter : IValueConverter
{
public object? Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is List<Point> pointList)
{
return new PointCollection(pointList);
}
else if (value is ObservableCollection<Point> observablePoints)
{
var pointCollection = new PointCollection(observablePoints);
return pointCollection;
}
else if (value is IEnumerable<Point> enumerable)
{
return new PointCollection(enumerable);
}
return new PointCollection();
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is PointCollection pointCollection)
{
var list = new ObservableCollection<Point>();
foreach (Point p in pointCollection)
{
list.Add(p);
}
return list;
}
return new ObservableCollection<Point>();
}
}
/// <summary>
/// 索引转换为位置标签
/// </summary>
public class IndexToPositionConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is int index)
{
return (index + 1).ToString();
}
return "0";
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}