Exemple #1
0
        /// <summary>
        /// 列表
        /// </summary>
        /// <returns></returns>
        public IList <MissionModel> List()
        {
            var result = new List <MissionModel>();
            var source = new Application.Mission().List();

            foreach (var item in Missions)
            {
                MissionModel model = GetModel(source.FirstOrDefault(o => o.Id == item.Key), item.Value);
                result.Add(model);
            }
            return(result);
        }
Exemple #2
0
        /// <summary>
        /// 手动启动
        /// </summary>
        public void ManualStartup()
        {
            var source = new Application.Mission().List();

            foreach (var item in Missions)
            {
                if (GetValue(item.Value, source.FirstOrDefault(o => o.Id == item.Key)).Type == DataDefinition.StartupType.Disabled)
                {
                    continue;
                }
                item.Value.Startup();
            }
        }
Exemple #3
0
        /// <summary>
        /// 系统启动
        /// </summary>
        public void SystemStartup()
        {
            StartupTime = DateTime.UtcNow;
            var source = new Application.Mission().List();

            foreach (var item in Missions)
            {
                if (GetValue(item.Value, source.FirstOrDefault(o => o.Id == item.Key)).Type != DataDefinition.StartupType.Automatic)
                {
                    continue;
                }
                item.Value.Startup();
            }
        }
Exemple #4
0
        private MissionManager()
        {
            Missions = new Dictionary <string, IMission>();

            var source = new Application.Mission().List();
            var types  = System.Reflection.Assembly.GetExecutingAssembly().GetTypes();

            foreach (var type in types)
            {
                if (!type.GetInterfaces().Contains(typeof(IMission)))
                {
                    continue;
                }
                var mission = ClassicDomain.ObjectCreator.CreateInstance(type) as IMission;
                mission.SetSleep(GetValue(mission, source.FirstOrDefault(o => o.Id == type.FullName)).Seconds);
                Missions.Add(type.FullName, mission);
            }
        }