using System; using System.Collections.Generic; using System.IO; using Aitex.Common.Util; using Aitex.Core.Account; using Aitex.Core.RT.ConfigCenter; using Aitex.Core.RT.DataCenter; using Aitex.Core.RT.DataCollection; using Aitex.Core.RT.DBCore; using Aitex.Core.RT.Event; using Aitex.Core.RT.Log; using Aitex.Core.RT.OperationCenter; using Aitex.Core.RT.RecipeCenter; using Aitex.Core.Util; using Aitex.Core.WCF; using MECF.Framework.Common.Account; using MECF.Framework.Common.Equipment; using MECF.Framework.Common.IOCore; using MECF.Framework.Common.RecipeCenter; using MECF.Framework.Common.SCCore; using MECF.Framework.Common.SubstrateTrackings; using MECF.Framework.RT.Core.Applications; using MECF.Framework.RT.Core.Backend; using MECF.Framework.RT.Core.IoProviders; using SorterRT.Modules; using VirgoCommon; using VirgoRT.Backends; using VirgoRT.HostWrapper; using VirgoRT.Modules; using VirgoRT.Modules.PMs; namespace VirgoRT.Instances { class ToolLoader : IRtLoader { public void Initialize() { Singleton.Instance.Initialize(); Singleton.Instance.Initialize(); Singleton.Instance.Initialize( System.Configuration.ConfigurationManager.ConnectionStrings["PostgreSQL"].ConnectionString , RtInstance.DatabaseName , PathManager.GetCfgDir() + "DBModel.sql"); Singleton.Instance.Initialize(PathManager.GetCfgDir() + "EventDefine.xml"); Singleton.Instance.Initialize(); Singleton.Instance.Initialize(PathManager.GetCfgDir() + "System.sccfg"); Singleton.Instance.Initialize(); RecipeFileManager.Instance.Initialize(new VirgoRecipeFileContext(), new VirgoSequenceFileContext(), true); IoProviderManager.Instance.Initialize(PathManager.GetCfgDir() + "IoProviderConfig.xml"); IoManager.Instance.Initialize(PathManager.GetCfgDir() + "Interlock.Virgo.xml"); WaferManager.Instance.Initialize(); AccountExManager.Instance.Initialize(true); // Device manager Singleton.Instance.Initialize(); Singleton.Instance.Initialize(); Singleton.Instance.Initialize(); DataCollectionManager.Instance.Initialize(RtInstance.DatabaseName); RtSystemManager.Instance.AddCustomBackend("SC", new BackendSCConfigView()); RtSystemManager.Instance.AddCustomBackend("IO", new IOView()); RtSystemManager.Instance.AddCustomBackend("FSM", new FSMView()); Singleton.Instance.Initialize(); Singleton.Instance.FireEvent += InstanceOnOnEvent; //Singleton.Instance.Initialize(); string s1 = System.Diagnostics.FileVersionInfo.GetVersionInfo(Path.Combine(PathManager.GetAppDir(), "VirgoRT.exe")).ProductVersion; LOG.Info($"VirgoRT {s1} succeed to Launch"); } private void InstanceOnOnEvent(EventItem obj) { if (obj.Level != EventLevel.Alarm) { Singleton.Instance.NotifyEvent(obj.EventEnum, obj.DVID, obj.ObjDVID); } else { Singleton.Instance.NotifyAlarm(obj.EventEnum, obj.DVID, obj.ObjDVID, obj.Description); } } public void Terminate() { Singleton.Instance.Terminate(); Singleton.Instance.Terminate(); Singleton.Instance.Terminate(); IoProviderManager.Instance.Terminate(); Singleton.Instance.Terminate(); DataCollectionManager.Instance.Terminate(); Singleton.Instance.Terminate(); Singleton.Instance.Terminate(); Singleton.Instance.Terminate(); Singleton.Instance.Terminate(); } } }