using Aurora; using Aurora.Api; using Aurora.Api.Manager; using AuroraMassFlowMeter; using AuroraOCT.Trumpf; using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using WeldingCommon.Recipes; using WeldingCommon.RMS; namespace WeldingCommon.Utils { public static class AuroraEx { public static bool IsAutoActivation(this Device dev) { var Config = Application.Current.AuroraEnv().DeviceManager.GetDeviceConfig(dev.DeviceId); if(Config is OCTConfig config) return config.IsAutoActivation; return true; } #region RMS Interface object private static Func _factory; private static readonly ConcurrentDictionary _cache = new ConcurrentDictionary(); public static void RegisterRmsHandler() where T : RMSHandler, new() { _factory = () => (RMSHandler)_cache.GetOrAdd(typeof(T), _ => new T()); } public static RMSHandler RmsHandler(this IRecipeManager _) { if (_factory == null) throw new InvalidOperationException("RMSHandler가 등록되지 않았습니다. AuroraEx.RegisterRmsHandler()를 먼저 호출하세요."); return _factory(); } #endregion #region Recipe History Interface object private static RecipeChangeHistoryHandler _Instance; public static RecipeChangeHistoryHandler RchHandler(this IRecipeManager _) { if (_Instance == null) _Instance = new RecipeChangeHistoryHandler(); return _Instance; } #endregion } }