Beispiel #1
0
        static void Main()
        {
            ControllerDataFile = Different.GetInfoTaskDir() + @"Controller\ControllerData.accdb";
            using (var sys = new SysTabl(ControllerDataFile))
            {
                MonitorHistory = new MonitorHistory
                {
                    Inf = sys.Value("MonitorHistoryProps")
                };
                CheckTime = sys.Value("MonitorHistoryCheckTime").ToDateTime();
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(ThreadsForm = new ThreadsForm());
        }
Beispiel #2
0
        //Загрузка списка потоков
        internal static void LoadThreads()
        {
            ThreadHistory errThread = null;

            Threads.Clear();
            try
            {
                foreach (var table in SqlDb.SqlTablesList(MonitorHistory.SqlProps).Where(x => x.StartsWith("ErrorsList") && x != "ErrorsListTemplate"))
                {
                    var t = new ThreadHistory(table.Substring(10).ToInt());
                    t.LoadFromDb();
                    Threads.Add(t.Id, t);
                    if (t.LastTime > CheckTime && (errThread == null || t.LastTime > errThread.LastTime))
                    {
                        errThread = t;
                    }
                }
            }
            catch (Exception ex)
            {
                ex.MessageError("Ошибка соединения с базой данных истории монитора");
            }

            if (!ThreadsForm.Visible)
            {
                if (errThread != null && errThread.LastTime > BallonTime)
                {
                    ThreadsForm.NotifyIcon.BalloonTipText = errThread.LastText;
                    ThreadsForm.NotifyIcon.ShowBalloonTip(10000);
                    BallonTime = errThread.LastTime;
                }
            }
            else
            {
                ThreadsForm.ReloadThreads(errThread);
            }
        }