Beispiel #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();
            }
        }
Beispiel #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);
            }
        }
Beispiel #3
0
 private void Main_Logger_TextChanged(object sender, EventArgs e)
 {
     if (ScrollTextBox)
     {
         Main_Logger.SelectionStart = Main_Logger.TextLength;
         Main_Logger.ScrollToCaret();
     }
 }
Beispiel #4
0
        private void Main_Load(object sender, EventArgs e)
        {
            Core.Logger.OnLogMessageReceived   += (sender2, e2) => Main_Logger.BeginInvoke(new EventHandler <LoggerEventArgs>(LogMessage), sender2, e2);
            Core.PlayerList.OnPlayerListUpdate += (sender2, e2) => Main_PlayerList.BeginInvoke(new EventHandler <PlayerListEventArgs>(UpdatePlayerList), sender2, e2);
            Core.Start();

            Main_PlayerList.DataSource    = PlayerList;
            Main_PlayerList.DisplayMember = "Data";
            Main_PlayerList.ValueMember   = "Id";
        }
Beispiel #5
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();
        }
Beispiel #6
0
 private void selectAllToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Main_Logger.SelectAll();
 }
Beispiel #7
0
 private void copyToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Main_Logger.Copy();
 }