61 lines
2.0 KiB
C#
61 lines
2.0 KiB
C#
/*
|
|
* Copyright (c) 2025 LG Electronics Inc.
|
|
* SPDX-License-Identifier: LicenseRef-LGE-Proprietary
|
|
*/
|
|
using Aurora.Api;
|
|
using Aurora.View;
|
|
using VisionCommon;
|
|
using System.Windows;
|
|
using System.Windows.Input;
|
|
using VisionCommonUI.Resources;
|
|
using VisionCommonUI;
|
|
|
|
namespace VisionCommonUI {
|
|
public class PatternTrackingSettingViewModel : NotifyPropertyChangedBase {
|
|
public ICommand CMD_Clear { get; }
|
|
public ICommand CMD_Save { get; }
|
|
public ICommand CMD_Close { get; }
|
|
|
|
private PatternRecipe _PatternRecipe;
|
|
public PatternRecipe PatternRecipe {
|
|
get => _PatternRecipe;
|
|
set {
|
|
SetProperty(ref _PatternRecipe, value);
|
|
}
|
|
}
|
|
|
|
private readonly Logger _Logger = new Logger(typeof(PatternTrackingSettingViewModel).Name);
|
|
private FovInfo _FovInfo;
|
|
|
|
public PatternTrackingSettingViewModel(FovInfo fovInfo) {
|
|
_FovInfo = fovInfo;
|
|
PatternRecipe = VisionRecipeManager.GetPatternRecipe(_FovInfo.ToSubSysInfo(), _FovInfo.FovId).Clone();
|
|
|
|
CMD_Clear = new DelegateCommand(Clear);
|
|
CMD_Save = new DelegateCommand(Save);
|
|
CMD_Close = new DelegateCommand(Close);
|
|
}
|
|
|
|
private void Clear(object obj) {
|
|
var result = MessageBoxUtil.ShowMessageBoxQuestion(StrTokens.MSG_Q_ClearPatternTracking);
|
|
if (result == MessageBoxResult.Yes) {
|
|
PatternTrackingManager.Clear(_FovInfo);
|
|
}
|
|
}
|
|
|
|
private void Save(object obj) {
|
|
var patternRecipe = VisionRecipeManager.GetPatternRecipe(_FovInfo.ToSubSysInfo(), _FovInfo.FovId);
|
|
patternRecipe.TrackingParam = PatternRecipe.TrackingParam.Clone() as TrackingParam;
|
|
RecipeFileManager.SaveVisionRecipe();
|
|
MessageBoxUtil.ShowMessageBoxOk(StrTokens.MSG_O_SaveCompleted);
|
|
}
|
|
|
|
private void Close(object obj) {
|
|
var window = obj as Window;
|
|
if (window != null) {
|
|
window.Close();
|
|
}
|
|
}
|
|
}
|
|
}
|