aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Logging/SimpleStringLogger.cs
blob: 5d9b12d816f76e48e0610fa82d94b9ad6124d177 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tango.Logging
{
    public class SimpleStringLogger : ILogger
    {
        private bool _enabled;

        public bool Enabled { get => _enabled; set => _enabled = value; }

        public List<LogCategory> Categories { get; set; }

        public event EventHandler<LogItemBase> LogReceived;

        public SimpleStringLogger()
        {
            Categories = new List<LogCategory>();
            Categories.Add(LogCategory.Critical);
            Categories.Add(LogCategory.Debug);
            Categories.Add(LogCategory.Error);
            Categories.Add(LogCategory.Info);
            Categories.Add(LogCategory.Warning);
            Enabled = true;
        }

        public SimpleStringLogger(params LogCategory[] categories) : this()
        {
            Categories = categories.ToList();
        }

        public void OnLog(LogItemBase log)
        {
            if (Categories.Contains(log.Category))
            {
                LogReceived?.Invoke(this, log);
            }
        }
    }
}
class="w"> override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.panel1 = new System.Windows.Forms.Panel(); this.progressBar1 = new System.Windows.Forms.ProgressBar(); this.label3 = new System.Windows.Forms.Label(); this.listServices = new System.Windows.Forms.ListBox(); this.txtProjectName = new System.Windows.Forms.Label(); this.btnCancel = new System.Windows.Forms.Button(); this.btnOK = new System.Windows.Forms.Button(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.label1 = new System.Windows.Forms.Label(); this.panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // // panel1 // this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.panel1.Controls.Add(this.progressBar1); this.panel1.Controls.Add(this.label3); this.panel1.Controls.Add(this.listServices); this.panel1.Controls.Add(this.txtProjectName); this.panel1.Controls.Add(this.btnCancel); this.panel1.Controls.Add(this.btnOK); this.panel1.Controls.Add(this.pictureBox1); this.panel1.Controls.Add(this.label1); this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(561, 353); this.panel1.TabIndex = 2; // // progressBar1 // this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.progressBar1.Location = new System.Drawing.Point(101, 277); this.progressBar1.Name = "progressBar1"; this.progressBar1.Size = new System.Drawing.Size(447, 5); this.progressBar1.Style = System.Windows.Forms.ProgressBarStyle.Marquee; this.progressBar1.TabIndex = 16; // // label3 // this.label3.AutoSize = true; this.label3.Cursor = System.Windows.Forms.Cursors.Arrow; this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label3.Location = new System.Drawing.Point(98, 112); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(172, 15); this.label3.TabIndex = 15; this.label3.Text = "Scanning for remote runners..."; // // listServices // this.listServices.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.listServices.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30))))); this.listServices.BorderStyle = System.Windows.Forms.BorderStyle.None; this.listServices.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.listServices.ForeColor = System.Drawing.Color.Gainsboro; this.listServices.FormattingEnabled = true; this.listServices.ItemHeight = 18; this.listServices.Location = new System.Drawing.Point(101, 135); this.listServices.Name = "listServices"; this.listServices.Size = new System.Drawing.Size(447, 144); this.listServices.TabIndex = 14; // // txtProjectName // this.txtProjectName.AutoSize = true; this.txtProjectName.Cursor = System.Windows.Forms.Cursors.Arrow; this.txtProjectName.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txtProjectName.ForeColor = System.Drawing.Color.DodgerBlue; this.txtProjectName.Location = new System.Drawing.Point(98, 45); this.txtProjectName.Name = "txtProjectName"; this.txtProjectName.Size = new System.Drawing.Size(87, 16); this.txtProjectName.TabIndex = 13; this.txtProjectName.Text = "Project name"; // // btnCancel // this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnCancel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40))))); this.btnCancel.Cursor = System.Windows.Forms.Cursors.Arrow; this.btnCancel.FlatAppearance.BorderSize = 0; this.btnCancel.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(15)))), ((int)(((byte)(15))))); this.btnCancel.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60))))); this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnCancel.Location = new System.Drawing.Point(314, 298); this.btnCancel.Name = "btnCancel"; this.btnCancel.Size = new System.Drawing.Size(114, 42); this.btnCancel.TabIndex = 11; this.btnCancel.Text = "CANCEL"; this.btnCancel.UseVisualStyleBackColor = false; // // btnOK // this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnOK.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40))))); this.btnOK.Cursor = System.Windows.Forms.Cursors.Arrow; this.btnOK.FlatAppearance.BorderSize = 0; this.btnOK.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(15)))), ((int)(((byte)(15))))); this.btnOK.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60))))); this.btnOK.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnOK.ForeColor = System.Drawing.Color.DodgerBlue; this.btnOK.Location = new System.Drawing.Point(434, 298); this.btnOK.Name = "btnOK"; this.btnOK.Size = new System.Drawing.Size(114, 42); this.btnOK.TabIndex = 10; this.btnOK.Text = "START"; this.btnOK.UseVisualStyleBackColor = false; // // pictureBox1 // this.pictureBox1.Cursor = System.Windows.Forms.Cursors.Arrow; this.pictureBox1.Image = global::Tango.BuildExtensions.Properties.Resources.play_arrow_big; this.pictureBox1.Location = new System.Drawing.Point(20, 45); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(63, 68); this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox1.TabIndex = 4; this.pictureBox1.TabStop = false; // // label1 // this.label1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40))))); this.label1.Cursor = System.Windows.Forms.Cursors.Arrow; this.label1.Dock = System.Windows.Forms.DockStyle.Top; this.label1.Location = new System.Drawing.Point(0, 0); this.label1.Margin = new System.Windows.Forms.Padding(0); this.label1.Name = "label1"; this.label1.Padding = new System.Windows.Forms.Padding(5, 0, 0, 0); this.label1.Size = new System.Drawing.Size(559, 29); this.label1.TabIndex = 0; this.label1.Text = "Remote Debug"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // RemoteDebugForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); this.ClientSize = new System.Drawing.Size(561, 353); this.ControlBox = false; this.Controls.Add(this.panel1); this.ForeColor = System.Drawing.Color.Gainsboro; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "RemoteDebugForm"; this.ShowIcon = false; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Tango Initializer"; this.TopMost = true; this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); } #endregion private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Label label1; private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.Button btnOK; private System.Windows.Forms.Button btnCancel; private System.Windows.Forms.Label txtProjectName; private System.Windows.Forms.ListBox listServices; private System.Windows.Forms.Label label3; private System.Windows.Forms.ProgressBar progressBar1; } }