コード例 #1
0
        private void renameGroupButton_Click(object sender, EventArgs e)
        {
            log.Debug("renameGroupButton_Click");
            ColorHighlightGroup item = (ColorHighlightGroup)this.groupsComboBox.SelectedItem;

            using (InputBox dlg = new InputBox("Change group name", "Enter group name:", item.GroupName))
            {
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    item.GroupName = dlg.Value;
                    this.groupsComboBox.Items[this.groupsComboBox.SelectedIndex] = item;
                }
            }
        }
コード例 #2
0
 private void removeGroupButton_Click(object sender, EventArgs e)
 {
     log.Debug("removeGroupButton_Click");
     if (this.colorHighlightManager.HighlightGroups.Count == 1)
     {
         MessageBox.Show("You can't delete last group.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         ColorHighlightGroup item = (ColorHighlightGroup)this.groupsComboBox.SelectedItem;
         int prevIdx = this.groupsComboBox.SelectedIndex;
         this.colorHighlightManager.HighlightGroups.Remove(item);
         this.groupsComboBox.Items.Remove(item);
         this.groupsComboBox.SelectedItem = groupsComboBox.Items[prevIdx - 1];
     }
 }
コード例 #3
0
        public LogListViewItem(LogEntry logItem, ColorHighlightGroup colorHighlights, bool highlightSearchResults)
        {
            this.LogItem = logItem;
            if (LogItem.Bookmark > 0)                  //0
            {
                this.Text = "(" + LogItem.Bookmark.ToString() + ") " + logItem.DateText;
            }
            else
            {
                this.Text = logItem.DateText;
            }

            if (LogItem.Thread != null)
            {
                this.SubItems.Add(LogItem.Thread);      //1
            }
            if (LogItem.Type != null)
            {
                this.SubItems.Add(LogItem.Type);        //2
            }
            if (LogItem.Class != null)
            {
                this.SubItems.Add(LogItem.Class);       //3
            }
            this.SubItems.Add(logItem.Message);
            //this.SubItems.Add(logItem.Message.Substring(0, Math.Min(logItem.Message.Length, maxLengthOfMessage)));     //4

            this.ImageIndex = (int)logItem.LogType;

            if (colorHighlights != null && !(highlightSearchResults && logItem.FoundOnLine == -1))
            {
                Color color;
                Color textColor;
                if (colorHighlights.TryHighlightLogItem(logItem, out color, out textColor))
                {
                    this.BackColor = color;
                    this.ForeColor = textColor;
                }
            }
            this.HighlightSearchResult = highlightSearchResults && logItem.FoundOnLine > -1;

            if (HighlightSearchResult)
            {
                this.BackColor = Color.Yellow;
                this.ForeColor = Color.Red;
            }
        }
コード例 #4
0
 private void addGroupButton_Click(object sender, EventArgs e)
 {
     log.Debug("addGroupButton_Click");
     using (InputBox dlg = new InputBox("Change group name", "Enter group name:"))
     {
         ColorHighlightGroup item = new ColorHighlightGroup();
         item.InitDefaultValues();
         dlg.Value = item.GroupName;
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             item.GroupName = dlg.Value;
             this.colorHighlightManager.HighlightGroups.Add(item);
             this.groupsComboBox.Items.Add(item);
             this.groupsComboBox.SelectedItem = item;
             this.groupsComboBox.Focus();
         }
     }
 }