145 lines
5.1 KiB
C#
145 lines
5.1 KiB
C#
/*
|
|
* Copyright (c) 2025 LG Electronics Inc.
|
|
* SPDX-License-Identifier: LicenseRef-LGE-Proprietary
|
|
*/
|
|
using Aurora.Api;
|
|
using AuroraUIComponent.UserControls;
|
|
using AuroraUIComponent.Util;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Reactive.Linq;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using VisionCommon;
|
|
using VisionUI.Pattern;
|
|
|
|
namespace VisionUI.Aligner {
|
|
/// <summary>
|
|
/// 얼라인 레시피 세팅 뷰
|
|
/// AlignRecipeSettingView.xaml BehindCode
|
|
/// </summary>
|
|
public partial class AlignRecipeSettingView : UserControl, IUpdateRecipe {
|
|
private Logger _Logger;
|
|
private AlignInfo _AlignInfo;
|
|
private AlignRecipe _AlignRecipe;
|
|
private List<UCKeyContentView> ParamContents = new List<UCKeyContentView>();
|
|
/// <summary>
|
|
/// 생성자
|
|
/// </summary>
|
|
/// <param name="alignInfo">얼라인 정보</param>
|
|
public AlignRecipeSettingView(AlignInfo alignInfo) {
|
|
_Logger = new Logger($"AlignRecipeSettingView[{alignInfo.AlignName}]");
|
|
_AlignInfo = alignInfo;
|
|
_AlignRecipe = VisionRecipeManager.GetAlignRecipe(_AlignInfo);
|
|
ProcPatternSettingView = new ProcPatternSettingView(_AlignInfo.ToSubSysInfo(), _AlignRecipe.AlignId.ToString());
|
|
InitializeComponent();
|
|
CreateProcPatternSettingView();
|
|
|
|
// ContentView 전체 사용을 위한 Codes
|
|
ParamContents = WpfUtil.GetLogicalChildCollection<UCKeyContentView>(this).ToList(); // ToggleValves
|
|
foreach(var param in ParamContents) {
|
|
param.SetFoldingChangedEventHandler(FoldingChangedNotifyEventHandler);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Proc패턴 세팅 뷰 새로고침
|
|
/// </summary>
|
|
public void ClearView() {
|
|
_AlignRecipe = VisionRecipeManager.GetAlignRecipe(_AlignInfo);
|
|
ProcPatternSettingView.RefreshViews(_AlignInfo.ToSubSysInfo(), _AlignRecipe.AlignId.ToString());
|
|
}
|
|
|
|
private void FoldingChangedNotifyEventHandler(object sender, RoutedEventArgs e) {
|
|
if (_foldingEventLock) {
|
|
return;
|
|
}
|
|
else {
|
|
IsAllOpen = ParamContents?.All(x => x.IsFolding == false) ?? false;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Proc패턴 세팅 뷰 생성
|
|
/// </summary>
|
|
public void CreateProcPatternSettingView() {
|
|
}
|
|
|
|
private void UserControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) {
|
|
bool isVisible = (bool)e.NewValue;
|
|
if (isVisible == true) {
|
|
RefreshVisionRecipes();
|
|
UpdateRecipeFromFile();
|
|
RefreshView();
|
|
}
|
|
}
|
|
|
|
public void RefreshVisionRecipes() {
|
|
_AlignRecipe = VisionRecipeManager.GetAlignRecipe(_AlignInfo);
|
|
(DataContext as AlignRecipeSettingViewModel).RefreshVisionRecipes();
|
|
}
|
|
|
|
public void UpdateRecipeFromFile() {
|
|
(DataContext as AlignRecipeSettingViewModel).UpdateRecipeFromFile();
|
|
UpdateRecipeFromUI_ProcPatternSetting();
|
|
}
|
|
|
|
private void UpdateRecipeFromUI_ProcPatternSetting() {
|
|
ProcPatternSettingView.UpdateRecipeFromUI();
|
|
}
|
|
|
|
public void UpdateRecipeFromUI() {
|
|
(DataContext as AlignRecipeSettingViewModel).UpdateRecipeFromUI();
|
|
UpdateRecipeFromUI_ProcPatternSetting();
|
|
}
|
|
|
|
public void RefreshView() {
|
|
// ContentView Folding => AllOpen
|
|
foreach (var param in ParamContents) {
|
|
param.ChangeFold(false);
|
|
}
|
|
IsAllOpen = ParamContents?.All(x => x.IsFolding == false) ?? false;
|
|
}
|
|
|
|
|
|
#region Folding Util Button
|
|
|
|
|
|
public bool IsAllOpen {
|
|
get { return (bool)GetValue(IsAllOpenProperty); }
|
|
set { SetValue(IsAllOpenProperty, value); }
|
|
}
|
|
|
|
// Using a DependencyProperty as the backing store for IsAllOpen. This enables animation, styling, binding, etc...
|
|
public static readonly DependencyProperty IsAllOpenProperty =
|
|
DependencyProperty.Register("IsAllOpen", typeof(bool), typeof(AlignRecipeSettingView), new PropertyMetadata(false));
|
|
|
|
|
|
private ProcPatternSettingView _ProcPatternSettingView;
|
|
public ProcPatternSettingView ProcPatternSettingView {
|
|
get { return _ProcPatternSettingView; }
|
|
set { _ProcPatternSettingView= value; }
|
|
}
|
|
|
|
private bool _foldingEventLock;
|
|
// 1 개라도 Open 시 Foidng button
|
|
private void BtnClick_Fold(object sender, RoutedEventArgs e) {
|
|
_foldingEventLock = true;
|
|
if (IsAllOpen) {
|
|
foreach (var param in ParamContents) {
|
|
param.ChangeFold(true);
|
|
}
|
|
}
|
|
else {
|
|
foreach (var param in ParamContents) {
|
|
param.ChangeFold(false);
|
|
}
|
|
}
|
|
IsAllOpen= !IsAllOpen;
|
|
_foldingEventLock = false;
|
|
}
|
|
#endregion
|
|
}
|
|
} |