Example #1
0
        private void BTN_AjouterUnite_Click(object sender, EventArgs e)
        {
            int IndexOfList = LBX_GererUniteMesure.SelectedIndex;
            ConfirmationAjout AjouterUniteUI = new ConfirmationAjout(TableauUnite[IndexOfList].Type.ToString());

            if (AjouterUniteUI.ShowDialog() == DialogResult.OK)
            {
            }

            if (AjouterUniteUI.ConfirmationAjoutUnite)
            {
                mUnit = AjouterUniteUI.AjouterUnite();
                CONVERTER.Add(mUnit);
                Refresh(TableauUnite[IndexOfList].Type);

                // Met l'index à la position de l'unité ajouté //
                int Index = TableauUnite.LastIndexOf(mUnit);

                LBX_GererUniteMesure.SelectedIndex = Index;
            }
            else
            {
                LBX_GererUniteMesure.SelectedIndex = IndexOfList;
            }
        }
Example #2
0
        private void TB_Values_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(TB_Values.Text))
                {
                    Resultat_Conversion.Text = "";
                }
                else
                {
                    Resultat_Conversion.Text = CONVERTER.Convert(decimal.Parse(TB_Values.Text), CONVERTER.GetUnitByName(comboBox1.Text), CONVERTER.GetUnitByName(comboBox2.Text));
                }

                if (string.IsNullOrEmpty(TB_Values.Text) == false)
                {
                    btn_conversion.Enabled          = true;
                    btn_conversion.BackgroundImage  = Properties.Resources.convert_Icon_Neutral;
                    btn_effacer_val.Enabled         = true;
                    btn_effacer_val.BackgroundImage = Properties.Resources.ICON_Effacer_Neutral;
                }
                else
                {
                    btn_conversion.Enabled          = false;
                    btn_conversion.BackgroundImage  = Properties.Resources.convert_Icon_Disabled;
                    btn_effacer_val.Enabled         = false;
                    btn_effacer_val.BackgroundImage = Properties.Resources.ICON_Effacer_Disable;
                }
            }
            catch
            {
                MessageBox.Show("Valeur entrer est invalide");
            }
        }
Example #3
0
 /// <summary>
 /// Efface tous les unités de mesure selon le type passé en paramètre
 /// </summary>
 /// <param name="TypeConversion"></param>
 private void EffacerUnitéDeMesure(UnitType TypeConversion)
 {
     foreach (Unit unit in CONVERTER.GetUnitsByType(TypeConversion))
     {
         LBX_GererUniteMesure.Items.Remove(unit);
     }
 }
Example #4
0
 private void Gestion_Enter(object sender, EventArgs e)
 {
     listBox1.Items.Clear();
     foreach (Unit unit in CONVERTER.GetAllUnits())
     {
         listBox1.Items.Add(unit);
     }
 }
Example #5
0
        /// <summary>
        /// Calcule la conversion et l'affiche dans TextBox_Convertie
        /// </summary>
        private void CalculConversion()
        {
            Unit UniteDepart = (Unit)LBX_Start.SelectedItem;
            Unit UniteEnd    = (Unit)LBX_End.SelectedItem;

            ValueToConvert         = decimal.Parse(TextBox_Depart.Text);
            TextBox_Convertie.Text = CONVERTER.Convert(ValueToConvert, UniteDepart, UniteEnd);
        }
Example #6
0
        /// <summary>
        /// Affiche tous les unités de mesure selon le type passé en paramètre
        /// </summary>
        /// <param name="TypeConversion"></param>
        private void AfficherUnitéMesure(UnitType TypeConversion)
        {
            TableauUnite = CONVERTER.GetUnitsByType(TypeConversion);

            foreach (Unit unit in TableauUnite)
            {
                LBX_GererUniteMesure.Items.Add(unit);
            }
        }
Example #7
0
 private void comboBox1_SelectedValueChanged(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(TB_Values.Text))
     {
     }
     else
     {
         Resultat_Conversion.Text = CONVERTER.Convert(decimal.Parse(TB_Values.Text), CONVERTER.GetUnitByName(comboBox1.Text), CONVERTER.GetUnitByName(comboBox2.Text));
     }
 }
Example #8
0
 private void RB_Distance_MouseClick(object sender, MouseEventArgs e)
 {
     if (string.IsNullOrEmpty(TB_Values.Text))
     {
     }
     else
     {
         Resultat_Conversion.Text = CONVERTER.Convert(decimal.Parse(TB_Values.Text), CONVERTER.GetUnitByName(comboBox1.Text), CONVERTER.GetUnitByName(comboBox2.Text));
     }
 }
Example #9
0
 private void BTN_Effacer_Valeur_Click(object sender, EventArgs e)
 {
     // Enlèves tous les unités lorsque le l'utilisateur appuie sur le flash button //
     foreach (Unit unit in CONVERTER.GetAllUnits())
     {
         LBX_Start.Items.Remove(unit);
         LBX_End.Items.Remove(unit);
     }
     InitialiserInterface();
 }
Example #10
0
 private void flashButton2_Click(object sender, EventArgs e)
 {
     Retirer_Unité();
     listBox1.Items.Clear();
     foreach (Unit unit in CONVERTER.GetAllUnits())
     {
         listBox1.Items.Add(unit);
     }
     listBox1.SelectedIndex = 0;
     listBox1.Focus();
 }
Example #11
0
        /// <summary>
        /// Affiche les unités de mesure de la liste selon le type
        /// </summary>
        /// <param name="TypeConversion"></param>
        private void AfficherUnitéMesure(UnitType TypeConversion)
        {
            foreach (Unit unit in CONVERTER.GetUnitsByType(TypeConversion))
            {
                LBX_Start.Items.Add(unit);
                LBX_End.Items.Add(unit);
            }

            LBX_Start.SelectedIndex = 0;
            LBX_End.SelectedIndex   = 0;
        }
Example #12
0
 private void btn_conversion_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(TB_Values.Text) == true)
     {
         Resultat_Conversion.Text = "";
     }
     else
     {
         Resultat_Conversion.Text = CONVERTER.Convert(decimal.Parse(TB_Values.Text), CONVERTER.GetUnitByName(comboBox1.Text), CONVERTER.GetUnitByName(comboBox2.Text));
     }
     btn_conversion.Enabled         = false;
     btn_conversion.BackgroundImage = Properties.Resources.convert_Icon_Disabled;
 }
Example #13
0
 private void RB_Distance_CheckedChanged(object sender, EventArgs e)
 {
     if (RB_Distance.Checked)
     {
         comboBox1.Items.Clear();
         comboBox2.Items.Clear();
         foreach (Unit unit in CONVERTER.GetUnitsByType(UnitType.Distance))
         {
             comboBox1.Items.Add(unit);
             comboBox2.Items.Add(unit);
         }
         comboBox1.SelectedIndex = 1;
         comboBox2.SelectedIndex = 2;
     }
 }
Example #14
0
        private void Gestion_Load(object sender, EventArgs e)
        {
            foreach (Unit unit in CONVERTER.GetAllUnits())
            {
                listBox1.Items.Add(unit);
            }
            listBox1.SelectedIndex = 0;
            ToolTip toolTip1 = new ToolTip();

            toolTip1.SetToolTip(this.flashButton1, "Ajouter une Unité");
            toolTip1.SetToolTip(this.flashButton2, "Retirer une Unité");
            toolTip1.SetToolTip(this.flashButton4, "Modifier une Unité");
            toolTip1.SetToolTip(this.flashButton3, "Retour");
            toolTip1.SetToolTip(this.flashButton5, "Raccourcis de clavier");
        }
Example #15
0
 private void radioButton1_CheckedChanged(object sender, EventArgs e)
 {
     if (RB_Volume.Checked)
     {
         // Volume impérial UK/US
         comboBox1.Items.Clear();
         comboBox2.Items.Clear();
         foreach (Unit unit in CONVERTER.GetUnitsByType(UnitType.Volume))
         {
             comboBox1.Items.Add(unit);
             comboBox2.Items.Add(unit);
         }
         comboBox1.SelectedIndex = 0;
         comboBox2.SelectedIndex = 4;
     }
 }
Example #16
0
        private void BTN_Effacer_Valeur_Click(object sender, EventArgs e)
        {
            int IndexOfList = LBX_GererUniteMesure.SelectedIndex;

            ConfirmationRetraitUI = new ConfirmationRetrait(TableauUnite[IndexOfList].Name, TableauUnite[IndexOfList].MetricValue.ToString(), TableauUnite[IndexOfList].Type.ToString());

            if (ConfirmationRetraitUI.ShowDialog() == DialogResult.OK)
            {
            }

            // Si l'utilisateur appuie sur le bouton qui confirme, l'unité est ajouté //
            if (ConfirmationRetraitUI.ConfirmationRetraitUnite)
            {
                int Index = LBX_GererUniteMesure.SelectedIndex;
                CONVERTER.Delete(TableauUnite[Index]);
                LBX_GererUniteMesure.Items.Remove(LBX_GererUniteMesure.SelectedItem);
                LBX_GererUniteMesure.SelectedIndex = IndexOfList - 1;
            }
            else
            {
                LBX_GererUniteMesure.SelectedIndex = IndexOfList;
            }
        }