From 62fff838f34e12d255224a92720e359cae99365b Mon Sep 17 00:00:00 2001
From: Antoine Tritschberger <antoine.tritschberger@etu.unistra.fr>
Date: Wed, 1 Apr 2020 12:27:35 +0200
Subject: [PATCH] =?UTF-8?q?Ajout=20d'un=20userControl=20pour=20voir=20les?=
 =?UTF-8?q?=20=C3=A9l=C3=A8ves=20et=20modification=20de=20bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 psychorientation/psychorientation/Form1.cs    |  32 ++++
 .../InterfaceInfoEleve.Designer.cs            | 157 ++++++++++++++++++
 .../psychorientation/InterfaceInfoEleve.cs    |  47 ++++++
 .../psychorientation/InterfaceInfoEleve.resx  | 120 +++++++++++++
 psychorientation/psychorientation/eleve.cs    |  14 +-
 .../psychorientation/psychorientation.csproj  |  11 +-
 6 files changed, 376 insertions(+), 5 deletions(-)
 create mode 100644 psychorientation/psychorientation/InterfaceInfoEleve.Designer.cs
 create mode 100644 psychorientation/psychorientation/InterfaceInfoEleve.cs
 create mode 100644 psychorientation/psychorientation/InterfaceInfoEleve.resx

diff --git a/psychorientation/psychorientation/Form1.cs b/psychorientation/psychorientation/Form1.cs
index e202b6b..b32de50 100644
--- a/psychorientation/psychorientation/Form1.cs
+++ b/psychorientation/psychorientation/Form1.cs
@@ -12,15 +12,47 @@ namespace psychorientation
 {
     public partial class Form1 : Form
     {
+        List<string> listClasse = new List<string>();
+        List<Eleve> listEleve = new List<Eleve>();
+
+        int nombreEleve = 5;
+
+
         public Form1()
         {
             InitializeComponent();
         }
 
+        private void InitialiserTableau()
+        {
+            listClasse.Add("Seconde");
+            listClasse.Add("Premiere");
+            listClasse.Add("Terminale");
+        }
+
+        private void CreerEleve(int nbEleve)
+        {
+            for(int i = 0; i < nbEleve; i++)
+            {
+                Eleve elev = new Eleve(i);
+                listEleve.Add(elev);
+            }
+        }
+
+
         private void Form1_Load(object sender, EventArgs e)
         {
+            InitialiserTableau();
             Message m = new Message(-1,"Bonjour apprenti prof, vous allez apprendre à éduquer des joueurs !! ","Début");
             m.ShowDialog();
+            
+            CreerEleve(nombreEleve);
+            InterfaceInfoEleve ii = new InterfaceInfoEleve();
+            ii.setParam(listEleve[0],listClasse);
+            ii.Left = 0;
+            ii.Top = 0;
+            ii.BorderStyle = BorderStyle.Fixed3D;
+            this.Controls.Add(ii);
         }
     }
 }
diff --git a/psychorientation/psychorientation/InterfaceInfoEleve.Designer.cs b/psychorientation/psychorientation/InterfaceInfoEleve.Designer.cs
new file mode 100644
index 0000000..ce15611
--- /dev/null
+++ b/psychorientation/psychorientation/InterfaceInfoEleve.Designer.cs
@@ -0,0 +1,157 @@
+namespace psychorientation
+{
+    partial class InterfaceInfoEleve
+    {
+        /// <summary> 
+        /// Variable nécessaire au concepteur.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary> 
+        /// Nettoyage des ressources utilisées.
+        /// </summary>
+        /// <param name="disposing">true si les ressources managées doivent être supprimées ; sinon, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Code généré par le Concepteur de composants
+
+        /// <summary> 
+        /// Méthode requise pour la prise en charge du concepteur - ne modifiez pas 
+        /// le contenu de cette méthode avec l'éditeur de code.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.lblEleve = new System.Windows.Forms.Label();
+            this.label1 = new System.Windows.Forms.Label();
+            this.label2 = new System.Windows.Forms.Label();
+            this.label3 = new System.Windows.Forms.Label();
+            this.lblClasse = new System.Windows.Forms.Label();
+            this.panel1 = new System.Windows.Forms.Panel();
+            this.panel2 = new System.Windows.Forms.Panel();
+            this.pnlEffort = new System.Windows.Forms.Panel();
+            this.pnlCompetence = new System.Windows.Forms.Panel();
+            this.panel1.SuspendLayout();
+            this.panel2.SuspendLayout();
+            this.SuspendLayout();
+            // 
+            // lblEleve
+            // 
+            this.lblEleve.AutoSize = true;
+            this.lblEleve.Font = new System.Drawing.Font("Microsoft Sans Serif", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+            this.lblEleve.Location = new System.Drawing.Point(107, 18);
+            this.lblEleve.Name = "lblEleve";
+            this.lblEleve.Size = new System.Drawing.Size(99, 33);
+            this.lblEleve.TabIndex = 0;
+            this.lblEleve.Text = "label1";
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Location = new System.Drawing.Point(43, 105);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(50, 13);
+            this.label1.TabIndex = 1;
+            this.label1.Text = "Classe  : ";
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Location = new System.Drawing.Point(52, 145);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(41, 13);
+            this.label2.TabIndex = 2;
+            this.label2.Text = "Effort : ";
+            // 
+            // label3
+            // 
+            this.label3.AutoSize = true;
+            this.label3.Location = new System.Drawing.Point(17, 186);
+            this.label3.Name = "label3";
+            this.label3.Size = new System.Drawing.Size(76, 13);
+            this.label3.TabIndex = 3;
+            this.label3.Text = "Compétence : ";
+            // 
+            // lblClasse
+            // 
+            this.lblClasse.AutoSize = true;
+            this.lblClasse.Location = new System.Drawing.Point(99, 105);
+            this.lblClasse.Name = "lblClasse";
+            this.lblClasse.Size = new System.Drawing.Size(35, 13);
+            this.lblClasse.TabIndex = 4;
+            this.lblClasse.Text = "label4";
+            // 
+            // panel1
+            // 
+            this.panel1.BackColor = System.Drawing.Color.Silver;
+            this.panel1.Controls.Add(this.pnlEffort);
+            this.panel1.Location = new System.Drawing.Point(99, 140);
+            this.panel1.Name = "panel1";
+            this.panel1.Size = new System.Drawing.Size(139, 26);
+            this.panel1.TabIndex = 5;
+            // 
+            // panel2
+            // 
+            this.panel2.BackColor = System.Drawing.Color.Silver;
+            this.panel2.Controls.Add(this.pnlCompetence);
+            this.panel2.Location = new System.Drawing.Point(99, 182);
+            this.panel2.Name = "panel2";
+            this.panel2.Size = new System.Drawing.Size(139, 26);
+            this.panel2.TabIndex = 6;
+            // 
+            // pnlEffort
+            // 
+            this.pnlEffort.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0)))));
+            this.pnlEffort.Location = new System.Drawing.Point(3, 4);
+            this.pnlEffort.Name = "pnlEffort";
+            this.pnlEffort.Size = new System.Drawing.Size(133, 18);
+            this.pnlEffort.TabIndex = 6;
+            // 
+            // pnlCompetence
+            // 
+            this.pnlCompetence.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0)))));
+            this.pnlCompetence.Location = new System.Drawing.Point(3, 4);
+            this.pnlCompetence.Name = "pnlCompetence";
+            this.pnlCompetence.Size = new System.Drawing.Size(125, 18);
+            this.pnlCompetence.TabIndex = 7;
+            // 
+            // InterfaceInfoEleve
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.Controls.Add(this.panel2);
+            this.Controls.Add(this.panel1);
+            this.Controls.Add(this.lblClasse);
+            this.Controls.Add(this.label3);
+            this.Controls.Add(this.label2);
+            this.Controls.Add(this.label1);
+            this.Controls.Add(this.lblEleve);
+            this.Name = "InterfaceInfoEleve";
+            this.Size = new System.Drawing.Size(479, 247);
+            this.Load += new System.EventHandler(this.InterfaceInfoEleve_Load);
+            this.panel1.ResumeLayout(false);
+            this.panel2.ResumeLayout(false);
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Label lblEleve;
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.Label label2;
+        private System.Windows.Forms.Label label3;
+        private System.Windows.Forms.Label lblClasse;
+        private System.Windows.Forms.Panel panel1;
+        private System.Windows.Forms.Panel pnlEffort;
+        private System.Windows.Forms.Panel panel2;
+        private System.Windows.Forms.Panel pnlCompetence;
+    }
+}
diff --git a/psychorientation/psychorientation/InterfaceInfoEleve.cs b/psychorientation/psychorientation/InterfaceInfoEleve.cs
new file mode 100644
index 0000000..8fb3e72
--- /dev/null
+++ b/psychorientation/psychorientation/InterfaceInfoEleve.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace psychorientation
+{
+    public partial class InterfaceInfoEleve : UserControl
+    {
+        Eleve eleve;
+        List<string> listClasse;
+        public InterfaceInfoEleve()
+        {
+            InitializeComponent();
+        }
+
+        private void InterfaceInfoEleve_Load(object sender, EventArgs e)
+        {
+
+        }
+
+        public void setParam(Eleve el, List<string> listClasse)
+        {
+            this.eleve = el;
+            this.listClasse = listClasse;
+            actualiser();
+        }
+
+        private void actualiser()
+        {
+            lblEleve.Text = "Eleve n°"+eleve.getId();
+            lblClasse.Text = listClasse[eleve.getClasse()];
+            MajPanel(pnlCompetence,eleve.getCompetence());
+            MajPanel(pnlEffort, eleve.getEffort());
+        }
+        private void MajPanel(Panel p, double valeur)
+        {
+            int val = (int)valeur;
+            p.Size = new Size(val * 133 / 100, p.Height);
+        }
+    }
+}
diff --git a/psychorientation/psychorientation/InterfaceInfoEleve.resx b/psychorientation/psychorientation/InterfaceInfoEleve.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/psychorientation/psychorientation/InterfaceInfoEleve.resx
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>
\ No newline at end of file
diff --git a/psychorientation/psychorientation/eleve.cs b/psychorientation/psychorientation/eleve.cs
index 02bc5cd..0a027cb 100644
--- a/psychorientation/psychorientation/eleve.cs
+++ b/psychorientation/psychorientation/eleve.cs
@@ -6,24 +6,27 @@ using System.Threading.Tasks;
 
 namespace psychorientation
 {
-    class eleve
+    public class Eleve
     {
         private int classe = 0;
         private double competence = 0;
         private double effort = 0;
         private int orientation = 0;
+        private int id;
 
 
-        public eleve()
+        public Eleve(int id)
         {
+            this.id = id;
             this.classe = 0;
             this.competence = 10;
             this.effort = 10;
             this.orientation = 0;
         }
 
-        public eleve(int classe, double competence, double effort, int orientation)
+        public Eleve(int id,int classe, double competence, double effort, int orientation)
         {
+            this.id = id;
             this.classe = classe;
             this.competence = competence;
             this.effort = effort;
@@ -50,11 +53,14 @@ namespace psychorientation
             this.competence = competence;
         }
 
-
         public double getCompetence()
         {
             return this.competence;
         }
+        public int getId()
+        {
+            return this.id;
+        }
         public int getClasse()
         {
             return this.classe;
diff --git a/psychorientation/psychorientation/psychorientation.csproj b/psychorientation/psychorientation/psychorientation.csproj
index 63252d0..19cb37f 100644
--- a/psychorientation/psychorientation/psychorientation.csproj
+++ b/psychorientation/psychorientation/psychorientation.csproj
@@ -46,13 +46,19 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="eleve.cs" />
+    <Compile Include="Eleve.cs" />
     <Compile Include="Form1.cs">
       <SubType>Form</SubType>
     </Compile>
     <Compile Include="Form1.Designer.cs">
       <DependentUpon>Form1.cs</DependentUpon>
     </Compile>
+    <Compile Include="InterfaceInfoEleve.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="InterfaceInfoEleve.Designer.cs">
+      <DependentUpon>InterfaceInfoEleve.cs</DependentUpon>
+    </Compile>
     <Compile Include="Message.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -64,6 +70,9 @@
     <EmbeddedResource Include="Form1.resx">
       <DependentUpon>Form1.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="InterfaceInfoEleve.resx">
+      <DependentUpon>InterfaceInfoEleve.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="Message.resx">
       <DependentUpon>Message.cs</DependentUpon>
     </EmbeddedResource>
-- 
GitLab