/*
* Copyright (c) 2025 LG Electronics Inc.
* SPDX-License-Identifier: LicenseRef-LGE-Proprietary
*/
using System;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using Aurora;
using Aurora.Api;
using VisionCommon;
namespace VisionUI.Setup {
///
/// 센터 튜닝 로그 뷰
/// CenterTuningLogView.xaml behind code
///
public partial class CenterTuningLogView : UserControl {
private SubSysInfo _SubSysInfo;
private SubSysRecipe _SubSysRecipe;
///
/// 생성자
///
/// 서브시스템 정보
public CenterTuningLogView(SubSysInfo subSysInfo) {
_SubSysInfo = subSysInfo;
_SubSysRecipe = VisionRecipeManager.GetSubSysRecipe(subSysInfo);
InitializeComponent();
SetObservable();
}
private void SetObservable() {
var disposable = VisionEnv.AuroraEnv.EventObservable.AsObservable(VisionEventId.NOTIFY_CENTERTUNING_COMPLETED).
Where(x => x.From == _SubSysInfo.SubSysName).Subscribe(msg => ChangeLastRowColor(msg));
DisposableManager.AddDisposable(eDpsGroupKey.SubMenu_CenterTuning, disposable);
}
private void ChangeLastRowColor(EventMessage msg) {
Application.Current.Dispatcher.Invoke((Action)(() => {
int currentCnt = (int)msg.Param;
dataGridCenterTuning.SelectedIndex = currentCnt - 1;
}));
}
}
}