58 lines
2.0 KiB
C#
58 lines
2.0 KiB
C#
using Aurora;
|
|
using Aurora.Api;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using VisionCommon;
|
|
|
|
namespace VisionUI.RecipeMenu {
|
|
/// <summary>
|
|
/// VisionDef 모델 사용
|
|
/// </summary>
|
|
public class UCVisionRecipeMenuModel : UCVisionRecipeMenuViewModelBase, IModelViewModel {
|
|
/// <summary>
|
|
/// 생성자
|
|
/// </summary>
|
|
/// <param name="aurora">오로라 환경</param>
|
|
/// <param name="onlyPropertyGrid">프로퍼티 그리드만 사용할지 여부</param>
|
|
public UCVisionRecipeMenuModel(IAuroraEnvironment aurora, bool onlyPropertyGrid = false) : base(aurora, onlyPropertyGrid) {
|
|
}
|
|
|
|
#region IModelViewModel Interface
|
|
public bool CanRename(string oldName, string newName, out string errMsg) {
|
|
return base.CanRename(oldName, newName, out errMsg);
|
|
}
|
|
|
|
public void OnChanged(string modelName) {
|
|
_Aurora.ModelManager.ReloadModelItem(modelName, VisionKeys.VisionRecipeKey);
|
|
SelectedVisionDef = _Aurora.ModelManager.ModelItem(modelName, VisionKeys.VisionRecipeKey) as VisionDef;
|
|
ShowInitZeroIndexValue();
|
|
}
|
|
|
|
public void OnSaved(string modelName) {
|
|
|
|
}
|
|
|
|
public bool PreSaved(string modelName) {
|
|
foreach (var unitRecipe in SelectedVisionDef.UnitRecipes) {
|
|
foreach (var subSysRecipe in unitRecipe.SubSysRecipes) {
|
|
CalculateCoordSystem(subSysRecipe);
|
|
}
|
|
}
|
|
if (StaticCoordSettingVM != null) {
|
|
return StaticCoordSettingVM.SaveRecipe();
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public void Reloaded(string modelName) {
|
|
_Aurora.ModelManager.ReloadModelItem(modelName, VisionKeys.VisionRecipeKey);
|
|
SelectedVisionDef = _Aurora.ModelManager.ModelItem(modelName, VisionKeys.VisionRecipeKey) as VisionDef;
|
|
ShowInitZeroIndexValue();
|
|
}
|
|
#endregion
|
|
}
|
|
}
|