예제 #1
0
 private void AddLogLine(Utility.Logger.LogData data)
 {
     if (ContextMenuLog_Inverted.Checked)
     {
         LogTextBox.ReadOnly = false;
         if (LogTextBox.Lines.Length > 299)
         {
             SuspendDrawLog();
             LogTextBox.Select(LogTextBox.GetFirstCharIndexFromLine(200), LogTextBox.TextLength);
             LogTextBox.SelectedText = "";
             SuspendDrawLog(false);
         }
         LogTextBox.SelectionStart  = 0;
         LogTextBox.SelectionLength = 0;
         LogTextBox.SelectionFont   = Utility.Configuration.Config.UI.JapFont;
         if (ContextMenuLog_CompactMode.Checked)
         {
             LogTextBox.SelectedText = string.Format("[{0:HH:mm:ss}] {1}", data.Time, data.Message);
         }
         else
         {
             LogTextBox.SelectedText = string.Format("[{0}][{1}] : {2}", Utility.Mathematics.DateTimeHelper.TimeToCSVString(data.Time), data.Priority, data.Message);
         }
         LogTextBox.SelectionFont = Utility.Configuration.Config.UI.MainFont;
         LogTextBox.SelectedText  = data.MsgChs1;
         LogTextBox.SelectionFont = Utility.Configuration.Config.UI.JapFont;
         LogTextBox.SelectedText  = data.MsgJap2;
         LogTextBox.SelectionFont = Utility.Configuration.Config.UI.MainFont;
         LogTextBox.SelectedText  = data.MsgChs2;
         LogTextBox.SelectionFont = Utility.Configuration.Config.UI.JapFont;
         LogTextBox.SelectedText  = data.MsgJap3;
         LogTextBox.SelectionFont = Utility.Configuration.Config.UI.MainFont;
         LogTextBox.SelectedText  = data.MsgChs3;
         LogTextBox.SelectedText  = "\r\n";
         LogTextBox.ReadOnly      = true;
         ScrollLog(SB_PAGETOP);
     }
     else
     {
         if (LogTextBox.Lines.Length > 0)
         {
             if (LogTextBox.Lines.Length > 299)                       // Delete first 100 lines once Log reaches 300 lines
             {
                 SuspendDrawLog();
                 LogTextBox.ReadOnly = false;
                 LogTextBox.Select(0, LogTextBox.GetFirstCharIndexFromLine(100));
                 LogTextBox.SelectedText = "";
                 LogTextBox.ReadOnly     = true;
                 SuspendDrawLog(false);
             }
             LogTextBox.AppendText("\r\n");
         }
         LogTextBox.SelectionFont = Utility.Configuration.Config.UI.JapFont;
         if (ContextMenuLog_CompactMode.Checked)
         {
             LogTextBox.AppendText(string.Format("[{0:HH:mm:ss}] {1}", data.Time, data.Message));
         }
         else
         {
             LogTextBox.AppendText(string.Format("[{0}][{1}] : {2}", Utility.Mathematics.DateTimeHelper.TimeToCSVString(data.Time), data.Priority, data.Message));
         }
         LogTextBox.SelectionFont = Utility.Configuration.Config.UI.MainFont;
         LogTextBox.AppendText(data.MsgChs1);
         LogTextBox.SelectionFont = Utility.Configuration.Config.UI.JapFont;
         LogTextBox.AppendText(data.MsgJap2);
         LogTextBox.SelectionFont = Utility.Configuration.Config.UI.MainFont;
         LogTextBox.AppendText(data.MsgChs2);
         LogTextBox.SelectionFont = Utility.Configuration.Config.UI.JapFont;
         LogTextBox.AppendText(data.MsgJap3);
         LogTextBox.SelectionFont = Utility.Configuration.Config.UI.MainFont;
         LogTextBox.AppendText(data.MsgChs3);
         ScrollLog(SB_PAGEBOTTOM);
     }
 }