Exemple #1
0
        /// <summary>
        /// выслать новое сообщение об ошибке
        /// </summary>
        private static void SetNewErrorMessage(LogMessage message)
        {
            if (!MainWindow.GetDispatcher.CheckAccess())
            {
                MainWindow.GetDispatcher.Invoke(new Action <LogMessage>(SetNewErrorMessage), message);
                return;
            }

            DataGridViewRow row = new DataGridViewRow();

            row.Cells.Add(new DataGridViewTextBoxCell());
            row.Cells[0].Value = DateTime.Now;

            row.Cells.Add(new DataGridViewTextBoxCell());
            row.Cells[1].Value = LogMessageType.Error;

            row.Cells.Add(new DataGridViewTextBoxCell());
            row.Cells[2].Value = message.Message;
            _gridErrorLog.Rows.Insert(0, row);

            if (_logErrorUi == null)
            {
                _logErrorUi          = new LogErrorUi(_gridErrorLog);
                _logErrorUi.Closing += _logErrorUi_Closing;
                _logErrorUi.Show();
            }

            SystemSounds.Beep.Play();
        }
Exemple #2
0
        /// <summary>
        /// выслать новое сообщение об ошибке
        /// </summary>
        private static void SetNewErrorMessage(string message)
        {
            if (_gridErrorLog.InvokeRequired)
            {
                _gridErrorLog.Invoke(new Action <string>(SetNewErrorMessage), message);
                return;
            }

            DataGridViewRow row = new DataGridViewRow();

            row.Cells.Add(new DataGridViewTextBoxCell());
            row.Cells[0].Value = DateTime.Now;

            row.Cells.Add(new DataGridViewTextBoxCell());
            row.Cells[1].Value = LogMessageType.Error;

            row.Cells.Add(new DataGridViewTextBoxCell());
            row.Cells[2].Value = message;
            _gridErrorLog.Rows.Insert(0, row);

            if (_logErrorUi == null)
            {
                _logErrorUi          = new LogErrorUi(_gridErrorLog);
                _logErrorUi.Closing += _logErrorUi_Closing;
                _logErrorUi.Show();
            }

            SystemSounds.Beep.Play();
        }
Exemple #3
0
        /// <summary>
        /// send new error message
        /// выслать новое сообщение об ошибке
        /// </summary>
        private static void SetNewErrorMessage(LogMessage message)
        {
            if (!MainWindow.GetDispatcher.CheckAccess())
            {
                MainWindow.GetDispatcher.Invoke(new Action <LogMessage>(SetNewErrorMessage), message);
                return;
            }

            if (_gridErrorLog.Rows.Count == 500)
            {
                DataGridViewRow row1 = new DataGridViewRow();
                row1.Cells.Add(new DataGridViewTextBoxCell());
                row1.Cells[0].Value = DateTime.Now;

                row1.Cells.Add(new DataGridViewTextBoxCell());
                row1.Cells[1].Value = LogMessageType.Error;

                row1.Cells.Add(new DataGridViewTextBoxCell());
                row1.Cells[2].Value = "To much ERRORS. Error log shut down.";
                _gridErrorLog.Rows.Insert(0, row1);
                return;
            }
            else if (_gridErrorLog.Rows.Count > 500)
            {
                return;
            }


            DataGridViewRow row = new DataGridViewRow();

            row.Cells.Add(new DataGridViewTextBoxCell());
            row.Cells[0].Value = DateTime.Now;

            row.Cells.Add(new DataGridViewTextBoxCell());
            row.Cells[1].Value = LogMessageType.Error;

            row.Cells.Add(new DataGridViewTextBoxCell());
            row.Cells[2].Value = message.Message;
            _gridErrorLog.Rows.Insert(0, row);

            if (PrimeSettingsMaster.ErrorLogMessageBoxIsActiv)
            {
                if (_logErrorUi == null)
                {
                    _logErrorUi          = new LogErrorUi(_gridErrorLog);
                    _logErrorUi.Closing += delegate(object sender, CancelEventArgs args)
                    {
                        _logErrorUi = null;
                    };
                    _logErrorUi.Show();
                }
            }

            if (PrimeSettingsMaster.ErrorLogBeepIsActiv)
            {
                SystemSounds.Beep.Play();
            }
        }
Exemple #4
0
 /// <summary>
 /// окно лога закрылось
 /// </summary>
 static void _logErrorUi_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     _logErrorUi = null;
 }