00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 using System;
00020 using System.Drawing;
00021 using System.Collections;
00022 using System.ComponentModel;
00023 using System.Windows.Forms;
00024
00025 namespace SimImmuno
00026 {
00027 public class frmLog : System.Windows.Forms.Form
00028 {
00029 #region Déclaration et initialisation
00030 private System.Windows.Forms.ListBox lbEvent;
00031 private System.ComponentModel.Container components = null;
00032 private string last_msg = "";
00033 private int counter_tmp = 0;
00034 public frmLog()
00035 {
00036 InitializeComponent();
00037 clear();
00038 }
00039 #endregion
00040
00041 #region Fct Log
00042 public void NewEvent(string txt_event)
00043 {
00044
00045 if(frmMain.log_limit)
00046 {
00047 if(lbEvent.Items.Count == frmMain.log_limit_size)
00048 lbEvent.Items.Clear();
00049 }
00050
00051
00052 bool msgCycleNew = txt_event.StartsWith("-----");
00053 bool msgCycleLast = last_msg.StartsWith("-----");
00054
00055 if(txt_event == last_msg)
00056 {
00057 counter_tmp++;
00058 }
00059 else if(msgCycleNew == msgCycleLast && msgCycleNew == true)
00060 {
00061
00062 }
00063 else if(txt_event != last_msg)
00064 {
00065 if(counter_tmp != 0)
00066 {
00067
00068 int real_counter = (counter_tmp + 1);
00069 lbEvent.Items.Add(" répété " + real_counter.ToString() + " fois");
00070 last_msg = "";
00071 counter_tmp = 0;
00072 }
00073 else
00074 {
00075
00076 lbEvent.Items.Add(txt_event.ToString());
00077
00078 last_msg = txt_event.ToString();
00079 }
00080 }
00081
00082 lbEvent.SelectedIndex = lbEvent.Items.Count - 1;
00083 }
00084
00085 public void clear()
00086 {
00087 lbEvent.Items.Clear();
00088 }
00089 #endregion
00090
00091 #region Fonctions de base .NET
00092 protected override void Dispose( bool disposing )
00093 {
00094 if( disposing )
00095 {
00096 if(components != null)
00097 {
00098 components.Dispose();
00099 }
00100 }
00101 base.Dispose( disposing );
00102 }
00103
00104 #region Windows Form Designer generated code
00109 private void InitializeComponent()
00110 {
00111 System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmLog));
00112 this.lbEvent = new System.Windows.Forms.ListBox();
00113 this.SuspendLayout();
00114
00115
00116
00117 this.lbEvent.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
00118 | System.Windows.Forms.AnchorStyles.Left)
00119 | System.Windows.Forms.AnchorStyles.Right)));
00120 this.lbEvent.Location = new System.Drawing.Point(0, 0);
00121 this.lbEvent.Name = "lbEvent";
00122 this.lbEvent.Size = new System.Drawing.Size(240, 303);
00123 this.lbEvent.TabIndex = 0;
00124
00125
00126
00127 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
00128 this.ClientSize = new System.Drawing.Size(240, 285);
00129 this.ControlBox = false;
00130 this.Controls.Add(this.lbEvent);
00131 this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
00132 this.Location = new System.Drawing.Point(780, 400);
00133 this.MaximizeBox = false;
00134 this.MinimizeBox = false;
00135 this.Name = "frmLog";
00136 this.ShowInTaskbar = false;
00137 this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
00138 this.Text = "Fenetre d\'événements";
00139 this.TopMost = true;
00140 this.ResumeLayout(false);
00141
00142 }
00143 #endregion
00144 #endregion
00145 }
00146 }