65 lines
2.0 KiB
C#
65 lines
2.0 KiB
C#
/*
|
|
* Copyright (c) 2025 LG Electronics Inc.
|
|
* SPDX-License-Identifier: LicenseRef-LGE-Proprietary
|
|
*/
|
|
using System;
|
|
using System.Windows;
|
|
using VisionCommon;
|
|
|
|
namespace VisionUI {
|
|
/// <summary>
|
|
/// Interaction logic for MultiOcrSettingWindow.xaml
|
|
/// </summary>
|
|
public partial class MultiOcrSettingWindow : Window, IPatternSettingWindow, IDisposable {
|
|
public string WINDOW_TITLE => "Multi OCR";
|
|
|
|
private PatternAgentBase _patternAgent;
|
|
private PatternInfo _patternInfo;
|
|
private ICameraDisplay _cameraDisplay;
|
|
private FovInfo _fovInfo;
|
|
|
|
public MultiOcrSettingWindow(
|
|
PatternAgentBase patternAgent, PatternInfo patternInfo, ICameraDisplay cameraDisplay, FovInfo fovInfo) {
|
|
InitializeComponent();
|
|
|
|
_patternAgent = patternAgent;
|
|
_patternInfo = patternInfo;
|
|
_cameraDisplay = cameraDisplay;
|
|
_fovInfo = fovInfo;
|
|
|
|
SetTitle();
|
|
CreateView();
|
|
}
|
|
|
|
private void CreateView() {
|
|
#if !USE_COGNEX
|
|
var multiOcrSettingView = new MultiOcrSettingView(_patternAgent, _patternInfo, _cameraDisplay, _fovInfo);
|
|
multiOcrSettingView.DataContext = new MultiOcrSettingViewModel(_patternAgent, _patternInfo, _cameraDisplay, _fovInfo);
|
|
ocrSettingScrollViewer.Content = multiOcrSettingView;
|
|
#endif
|
|
}
|
|
|
|
public void SetTitle() {
|
|
Title = WINDOW_TITLE;
|
|
}
|
|
|
|
public void ResetPosition() {
|
|
Left = WindowUtil.GetLeftWithRatioOnMainWindow(0.6);
|
|
Top = WindowUtil.GetTopWithRatioOnMainWindow(0.2);
|
|
}
|
|
|
|
private void Window_Closed(object sender, EventArgs e) {
|
|
Dispose();
|
|
}
|
|
|
|
public void Dispose() {
|
|
_cameraDisplay.ClearFindGraphics();
|
|
_cameraDisplay.ClearMeasureGraphics();
|
|
_cameraDisplay.ClearFindLabelNumGraphicsAll();
|
|
#if !USE_COGNEX
|
|
var view = ocrSettingScrollViewer.Content as MultiOcrSettingView;
|
|
view?.Dispose();
|
|
#endif
|
|
}
|
|
}
|
|
} |