예제 #1
0
        //Обновление списка потоков
        internal void ReloadThreads(ThreadHistory errThread) //Поток с последней ошибкой, или null - если нет ошибок
        {
            ErrorTablo.Visible = errThread != null;
            if (errThread != null)
            {
                ErrorTablo.Text = "Поток " + errThread.Id + ", Ошибка в " + errThread.LastTime;
            }

            var tab = DataSet1.Tables["ThreadsTable"];

            tab.Rows.Clear();
            foreach (var thread in Program.Threads.Values)
            {
                var row = tab.NewRow();
                row["ThreadId"] = thread.Id;
                row["LastTime"] = thread.LastTime;
                row["LastText"] = thread.LastText;
                tab.Rows.Add(row);
            }
            Threads.Update();
        }
예제 #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);
            }
        }
예제 #3
0
        //Загрузка списка событий из базы SQL
        internal void LoadErrors(ThreadHistory thread)
        {
            _thread = thread;
            Text    = "Поток" + _thread.Id + " : " + _thread.Description + " (" + thread.Projects + ")";
            var tab = DataSet1.Tables["ErrorsTable"];

            tab.Rows.Clear();
            using (var rec = new ReaderAdo(Program.MonitorHistory.SqlProps,
                                           "SELECT * FROM ErrorsList" + thread.Id + " ORDER BY ErrorsList" + thread.Id + ".Time DESC"))
                while (rec.Read())
                {
                    var row = tab.NewRow();
                    row["Time"]        = rec.GetTime("Time");
                    row["Description"] = rec.GetString("Description");
                    row["PeriodBegin"] = rec.GetTime("PeriodBegin");
                    row["PeriodEnd"]   = rec.GetTime("PeriodEnd");
                    row["Params"]      = rec.GetString("Params");
                    row["Command"]     = rec.GetString("Command");
                    row["Context"]     = rec.GetString("Context");
                    row["ThreadId"]    = rec.GetString("ThreadId");
                    tab.Rows.Add(row);
                }
            Errors.Update();
        }