Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members

frmLog.cs

Go to the documentation of this file.
00001 /*
00002 SimImmuno version 1.0
00003 Copyright (C) 2005 sebeuh.ajsinfo.net
00004 
00005 SimImmuno est libre, vous pouvez le redistribuer et/ou le modifier
00006 selon les termes de la Licence Publique Générale GNU publiée par la
00007 Free Software Foundation (version 2).
00008 
00009 SimImmuno est distribué car potentiellement utile, mais SANS AUCUNE GARANTIE,
00010 ni explicite ni implicite, y compris les garanties de commercialisation
00011 ou d'adaptation dans un but spécifique. Reportez-vous à la
00012 Licence Publique Générale GNU pour plus de détails.
00013 
00014 Texte de la license officielle (anglais) :
00015 http://simimmuno.ajsinfo.net/text.aspx?code=no&txt_file=GPL.txt
00016 Traduction francaise (non-officielle) :
00017 http://simimmuno.ajsinfo.net/text.aspx?code=no&txt_file=GPL-fr.txt
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                         // log options
00045                         if(frmMain.log_limit)
00046                         {
00047                                 if(lbEvent.Items.Count == frmMain.log_limit_size)
00048                                         lbEvent.Items.Clear();
00049                         }
00050                         // ---- GESTION DES EVENEMENTS
00051                         // Message de style : ---- Cycle N°XX ----
00052                         bool msgCycleNew = txt_event.StartsWith("-----");
00053                         bool msgCycleLast = last_msg.StartsWith("-----");
00054                         //Compteur de meme message
00055                         if(txt_event == last_msg)
00056                         {
00057                                 counter_tmp++;
00058                         }
00059                         else if(msgCycleNew == msgCycleLast && msgCycleNew == true)
00060                         {
00061                                 // ne rien faire
00062                         }
00063                         else if(txt_event != last_msg)
00064                         {
00065                                 if(counter_tmp != 0)
00066                                 {
00067                                         //Répétition des message
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                                         //Affichage !
00076                                         lbEvent.Items.Add(txt_event.ToString());
00077                                         //dernier message
00078                                         last_msg = txt_event.ToString();
00079                                 }
00080                         }
00081                         // selection
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                         // lbEvent
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                         // frmLog
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 }

Generated on Sat Jun 4 15:03:41 2005 for SimImmuno by  doxygen 1.4.2