Exemple #1
0
 void _dbw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     if (!DataBaseConnection)
     {
         application.WriteMessage("数据库无法连接!", EventLogEntryType.Information);
         LinkDataBaseTimer.Enabled = true;
     }
 }
Exemple #2
0
        public void Load()
        {
            application.WriteMessage(string.Format("开始加载插件[{0}{1}]!", Name, description), EventLogEntryType.Information);

            //加载所有任务
            ITaskPlugin _t1 = new TaskPlugin_DataBaseSelfCheck();

            application.AddTask(_t1.Name, _t1);

            //加载所有命令处理器
            //application.AddCommandExecuter(pluginName, this);
            application.WriteMessage(string.Format("插件[{0}{1}]加载成功!", Name, description), EventLogEntryType.Information);
        }
        public bool LoadPlugin(string pluginName)
        {
            string  AssemblyFile;
            Boolean result = false;

            config = (PluginConfigurationSection)ConfigurationManager.GetSection("PluginSection");
            PluginConfigurationElement pe = new PluginConfigurationElement();

            String path = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + "";

            try
            {
                for (Int32 i = 0; i < config.PluginCollection.Count; i++)
                {
                    pe = config.PluginCollection[i];
                    if (pe.Name == pluginName)
                    {
                        if (pe.Version == "")
                        {
                            AssemblyFile = path + "\\" + pe.Assembly;
                        }
                        else
                        {
                            AssemblyFile = path + "\\Plugin\\" + pe.Version + "\\" + pe.Assembly;
                            if (!File.Exists(AssemblyFile))
                            {
                                AssemblyFile = path + "\\" + pe.Assembly;
                            }
                        }

                        Assembly      assembly = Assembly.LoadFile(AssemblyFile);
                        Type          type     = assembly.GetType(pe.Type);
                        IServerPlugin instance = (IServerPlugin)Activator.CreateInstance(type);
                        instance.ServerApplication = application;
                        instance.Load();
                        plugins[pluginName] = instance;
                        result = true;

                        AppPluginInfo _apinfo = new AppPluginInfo();
                        _apinfo.Descript        = pe.Description;
                        _apinfo.PluginType      = pe.Type;
                        _apinfo.Name            = pe.Name;
                        _apinfo.FileName        = pe.Assembly;
                        _apinfo.AssemblyVersion = assembly.GetName().Version.ToString();
                        CurrentPluginInfos.Add(_apinfo);
                        break;
                    }
                }
                if (!result)
                {
                    application.WriteMessage(string.Format("未找到插件{0}!", pluginName), EventLogEntryType.Error);
                }
            }
            catch (Exception e)
            {
                application.WriteMessage(string.Format("出现错误:{0}", e.Message), EventLogEntryType.Error);
                result = false;
            }
            return(result);
        }
Exemple #4
0
        /// <summary>
        /// 初始化任务服务
        /// </summary>
        private void InitTask()
        {
            //初始化时钟

            TaskTimer.Interval = 1000 * 60;
            TaskTimer.Elapsed += new System.Timers.ElapsedEventHandler(TaskTimer_Elapsed);
            TaskTimer.Enabled  = true;
            application.WriteMessage("任务运行机制启动完毕!", EventLogEntryType.Information);
        }
Exemple #5
0
        public void Init(IServerApplication app, bool isWinSvc)
        {
            // 发出开始启动服务提示音
            application = app;
            IsWinSvc    = isWinSvc;
            application.WriteMessage("服务开始启动!", EventLogEntryType.Information);
            SessionClass.CurrentSinoUser                    = new SinoUser();
            SessionClass.CurrentSinoUser.CurrentPost        = new SinoPost();
            SessionClass.CurrentSinoUser.CurrentPost.PostID = "0";
            WatchNodeCache.Init();


            // 启动任务服务
            application.WriteMessage("初始化任务服务!", EventLogEntryType.Information);
            InitTask();
            application.WriteMessage("任务服务初始化完成!", EventLogEntryType.Information);
        }
Exemple #6
0
        public void Init(IServerApplication app)
        {
            // 发出开始启动服务提示音
            application = app;

            InitConnectTest();
            TryDataBaseConnect();

            ServiceHost WcfHost = new ServiceHost(typeof(SinoMonitorCommand));

            try
            {
                WcfHost.Open();
                application.WriteMessage("WCF服务接口已启动!", EventLogEntryType.Information);
            }
            catch (Exception ex)
            {
                application.WriteMessage(string.Format("WCF服务接口启动失败!{0}", ex.Message), EventLogEntryType.Error);
            }


            InitTask();
        }
Exemple #7
0
        /// <summary>
        /// 初始化任务服务
        /// </summary>
        private static void InitTask()
        {
            //添加测试任务插件
            Task_Test_Plugin _testPlugin = new Task_Test_Plugin();

            application.AddTask(_testPlugin.Name, _testPlugin as ITaskPlugin);

            //作者:林添喜 2006-02-03  说明:初始化任务
            //将所有未处理完的任务设置为错误
            SQL_TaskCommon.InitAllTaskState();

            //初始化时钟
            if (ConfigFile.RunTask)
            {
                ServerCommon.TaskTimer.Interval = 1000 * 60;
                ServerCommon.TaskTimer.Elapsed += new System.Timers.ElapsedEventHandler(TaskTimer_Elapsed);
                ServerCommon.TaskTimer.Enabled  = true;
                application.WriteMessage("任务运行机制启动完毕!");
            }
            else
            {
                application.WriteMessage("未设置RUNTASK参数为YES! 不启动任务运行机制!");
            }
        }
        public bool LoadPlugin(string pluginName)
        {
            Boolean result = false;

            config = (PluginConfigurationSection)ConfigurationManager.GetSection("PluginSection");
            PluginConfigurationElement pe = new PluginConfigurationElement();

            String path = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + "";

            try
            {
                for (Int32 i = 0; i < config.PluginCollection.Count; i++)
                {
                    pe = config.PluginCollection[i];
                    if (pe.Name == pluginName)
                    {
                        Assembly      assembly = Assembly.LoadFile(path + "\\" + pe.Assembly);
                        Type          type     = assembly.GetType(pe.Type);
                        IServerPlugin instance = (IServerPlugin)Activator.CreateInstance(type);
                        instance.ServerApplication = application;
                        instance.Load();
                        plugins[pluginName] = instance;
                        result = true;
                        break;
                    }
                }
                if (!result)
                {
                    application.WriteMessage(string.Format("未找到插件{0}!", pluginName));
                }
            }
            catch (Exception e)
            {
                application.WriteMessage(string.Format("出现错误:{0}", e.Message));
                result = false;
            }
            return(result);
        }
 public void Load()
 {
     application.WriteMessage(string.Format("{0}加载成功!", description));
     application.AddRemotingService(pluginName, this);
 }
Exemple #10
0
        public static void Init(IServerApplication app, bool isWinSvc)
        {
            // 发出开始启动服务提示音
            ServerCommon.SvcBeep(SvcAction.Starting);
            application   = app;
            IsWinSvc      = isWinSvc;
            WriteTaskInfo = ConfigFile.WriteTaskStartInfo;
            //加载ZHTJ_CSB中的参数

            #region 查看ORACLE服务是否已经成功运行

            int TestTimes = 10;
            int SleepTime = 60000;
#if DEBUG
            SleepTime = 100;
#endif
            while (!OracleHelper.IsReady() && TestTimes-- > 0)
            {
                Thread.Sleep(SleepTime);
            }
            if (TestTimes < 1)
            {
                EventLogSystemLog _event = new EventLogSystemLog("SinoSZJSLog");
                string            _log   = "因数据库无法连接,启动服务失败!";
                _event.WriteLog(_log, EventLogEntryType.Error);
                throw new Exception();
            }
            #endregion

            ConfigFile.Client_ShowPendingAlert = LoadDB_CSB_Bool("Client_ShowPendingAlert");



            //建立系统日志和用户日志的写入器
            SystemLogWriter.ICS_SystemLog = new OraSysLogWriter();
            UserLogWriter.ICS_UserLog     = new OraUserLogWriter();

            application.WriteMessage("服务开始启动!");

            //清除验证票据缓存
            TicketLib.Clear();
            // 加载代码表Cache
            application.WriteMessage("开始加载代码表缓存!");
            InitRefCodeCache();
            application.WriteMessage("代码表缓存加载完毕!");


            // 加载授权信息Cache
            application.WriteMessage("开始加载授权信息缓存!");
            InitPermissionCache();
            application.WriteMessage("授权信息缓存加载完毕!");

            // 初始化Remoting服务
            application.WriteMessage("初始化Remoting服务!");
            //RemotingServerSvc.Init();
            application.WriteMessage("Remoting服务初始化完毕!");

            application.WriteMessage("注册Remoting服务工厂!");
            //RemotingServerSvc.RegisterService(typeof(IServiceFactory), typeof(BizServiceFactory));
            application.WriteMessage("Remoting服务工厂注册完毕!");



            // 启动任务服务
            application.WriteMessage("初始化任务服务!");
            InitTask();
            application.WriteMessage("任务服务初始化完成!");

            // 发出启动成功提示音
            ServerCommon.SvcBeep(SvcAction.Started);
        }