예제 #1
0
        private void LoggerEvent_Update(string Args)
        {
            try
            {
                if (Main_Logger.InvokeRequired)
                {
                    BeginInvoke(new LoggerEvent_Safe(LoggerEvent_Update), Args);
                }
                else
                {
                    if (ScrollTextBox)
                    {
                        Main_Logger.AppendText(Args + Environment.NewLine);

                        if (Main_Logger.Lines.Count() > 1000)
                        {
                            Main_Logger.Text.Remove(0, Main_Logger.Lines[0].Count());
                        }
                    }
                    else
                    {
                        LoggerLog.Add(Args);
                    }
                }
            }
            catch (Exception ex)
            {
                ex.CatchError();
            }
        }
예제 #2
0
        private void LogMessage(object sender, LoggerEventArgs e)
        {
            if (ScrollTextBox)
            {
                if (!string.IsNullOrWhiteSpace(Main_Logger.Text))
                {
                    Main_Logger.AppendText(Environment.NewLine);
                }

                Main_Logger.AppendText(e.Message);

                if (Main_Logger.Lines.Length > 1000)
                {
                    Main_Logger.Lines = Main_Logger.Lines.Skip(Main_Logger.Lines.Length - 1000).ToArray();
                }
            }
            else
            {
                if (LoggerLog.Count > 1000)
                {
                    LoggerLog.RemoveRange(0, 1000 - LoggerLog.Count);
                }

                LoggerLog.Add(e.Message);
            }
        }
예제 #3
0
        private void Main_Logger_Leave(object sender, EventArgs e)
        {
            ScrollTextBox = true;

            if (LoggerLog.Count > 0)
            {
                for (int i = 0; i < LoggerLog.Count; i++)
                {
                    Main_Logger.AppendText(LoggerLog[i] + Environment.NewLine);
                }
                LoggerLog.RemoveRange(0, LoggerLog.Count);
            }

            Main_Logger.SelectionStart = Main_Logger.TextLength;
            Main_Logger.ScrollToCaret();
        }