Пример #1
0
        protected override void InitializeModuleData()
        {
            base.InitializeModuleData();
            CurrentThread = new WorkerThread(delegate
            {
                while (!CurrentThread.AbortRequest)
                {
                    try
                    {
                        using (var ctrlSA = new SAController())
                        {
                            DataContainer alertContainer;
                            ctrlSA.ExecuteAlert(out alertContainer, ModuleInfo.ModuleID, ModuleInfo.SubModule);

                            var rows = alertContainer.DataTable.Rows;

                            if (rows.Count > 0)
                            {
                                m_LastResultRow = alertContainer.DataTable.Rows[0];
                            }
                        }
                    }
                    catch (FaultException ex)
                    {
                        m_LastException = ex;
                    }
                    catch (Exception ex)
                    {
                        m_LastException = ErrorUtils.CreateErrorWithSubMessage(ERR_SYSTEM.ERR_SYSTEM_UNKNOWN, ex.Message);
                    }

                    CurrentThread.ExecuteUpdateGUI();
                    Thread.Sleep(AlertInfo.SleepTime);
                }
            }, MainProcess.GetMainForm());
            CurrentThread.DoUpdateGUI += CurrentThread_DoUpdateGUI;
            CurrentThread.Start();
        }