Exemple #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            timerHHmm.Start();

            string curFile = @"C:\SkillProject\Preferences_SkillProject.txt";

            if (File.Exists(curFile))
            {
                string[] lines = Fonction.lireFichier();

                test    = lines[0].ToString();
                Opacity = Convert.ToDouble(test);
            }
            else
            {
                Fonction.creationFichier();
            }

            para = 0;
            accesRapide();

            Fonction.policeTexte(this); // Gestion police

            LangueElement = Fonction.LangageAppli();
            affichageToolStripMenuItem.Text       = LangueElement[2];
            listeToolStripMenuItem.Text           = LangueElement[3];
            miniaturesToolStripMenuItem.Text      = LangueElement[4];
            ArborescenceToolStripMenuItem.Text    = LangueElement[5];
            suggestionToolStripMenuItem.Text      = LangueElement[6];
            QuiSommesNousToolStripMenuItem.Text   = LangueElement[7];
            commentÇaMarcheToolStripMenuItem.Text = LangueElement[8];
            AfficToolStripMenuItem.Text           = LangueElement[9];
            paramètreToolStripMenuItem.Text       = LangueElement[10];
            QuitterToolStripMenuItem.Text         = LangueElement[11];
            lblAccesRapide.Text = LangueElement[15];

            if (quitterToolStripMenuItem.Text == "Exit ➬")
            {
                quitterToolStripMenuItem.Margin         = new System.Windows.Forms.Padding(20, 0, 2, 0);
                paramètreToolStripMenuItem.Margin       = new System.Windows.Forms.Padding(20, 0, 2, 0);
                AfficToolStripMenuItem.Margin           = new System.Windows.Forms.Padding(20, 0, 2, 0);
                commentÇaMarcheToolStripMenuItem.Margin = new System.Windows.Forms.Padding(20, 0, 2, 0);
                QuiSommesNousToolStripMenuItem.Margin   = new System.Windows.Forms.Padding(20, 0, 2, 0);
                suggestionToolStripMenuItem.Margin      = new System.Windows.Forms.Padding(20, 0, 2, 0);
            }
        }
        private void ecrireFichier()
        {
            if (cbBoiteMessagesOui.Checked == true)
            {
                BM = true;
            }
            else
            {
                BM = false;
            }

            if (cbInfoDefilantesOui.Checked == true)
            {
                ID = true;
            }
            else
            {
                ID = false;
            }

            if (cbTutorielOui.Checked == true)
            {
                Tuto = true;
            }
            else
            {
                Tuto = false;
            }

            if (combobLangue.Text == "Francais" || combobLangue.Text == "French")
            {
                langueApres = "Francais";
            }
            else if (combobLangue.Text == "Anglais" || combobLangue.Text == "English")
            {
                langueApres = "Anglais";
            }

            string[] lines = Fonction.lireFichier();


            Fonction.ecrireFichier(opa.ToString(), BM.ToString(), lblPolice.Text, ID.ToString(), langueApres, Tuto.ToString(), "", "");

            if (lines[0].ToString() != opa.ToString() || lines[1].ToString() != BM.ToString() || lines[2].ToString() != lblPolice.Text || lines[3].ToString() != ID.ToString() ||
                lines[4].ToString() != langueApres || lines[5].ToString() != Tuto.ToString())
            {
                DialogResult DR = MessageBox.Show(LangueElement[124], LangueElement[125], MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (DR == DialogResult.Yes)
                {
                    if (lines[4].ToString() != langueApres)
                    {
                        // Changement de langue --> On réinitialise les vues récemments

                        // On récupère tout
                        StreamReader reader = File.OpenText(@"C:\SkillProject\Preferences_SkillProject.txt");
                        string       ligne;

                        List <string> listeElement = new List <string>();
                        while (!reader.EndOfStream)
                        {
                            ligne = reader.ReadLine();
                            listeElement.Add(ligne);
                        }
                        reader.Close();

                        //// Debut MAJ \\\\

                        listeElement[6]  = "Aucun";
                        listeElement[7]  = "jj/mm/aaaa";
                        listeElement[8]  = "Aucun";
                        listeElement[9]  = "jj/mm/aaaa";
                        listeElement[10] = "Aucun";
                        listeElement[11] = "jj/mm/aaaa";

                        //// Fin MAJ \\\\

                        // on renvoie tout

                        StreamWriter writer = new StreamWriter(@"C:\SkillProject\Preferences_SkillProject.txt");

                        foreach (var item in listeElement)
                        {
                            writer.WriteLine(item);
                        }
                        writer.Close();
                    }

                    Application.Restart();
                }
            }
        }
        private void FormParametre_Load(object sender, EventArgs e)
        {
            LangueElement            = Fonction.LangageAppli();
            this.Text                = LangueElement[108];
            lblTitreSuggestion.Text  = LangueElement[108];
            lblTransparence.Text     = LangueElement[109];
            label3.Text              = LangueElement[110];
            lblMessageBox.Text       = LangueElement[111];
            cbBoiteMessagesOui.Text  = LangueElement[112];
            cbBoiteMessagesNon.Text  = LangueElement[113];
            lblInfoPolice.Text       = LangueElement[114];
            lblRedemRequis3.Text     = LangueElement[115];
            label4.Text              = LangueElement[116];
            label5.Text              = LangueElement[117];
            label2.Text              = LangueElement[118];
            label1.Text              = LangueElement[119];
            cbTutorielOui.Text       = LangueElement[112];
            cbTutorielNon.Text       = LangueElement[113];
            cbInfoDefilantesOui.Text = LangueElement[112];
            cbInfoDefilantesNon.Text = LangueElement[113];


            string[] lines = Fonction.lireFichier();

            test           = lines[0].ToString();
            test1          = lines[1].ToString();
            lblPolice.Text = lines[2].ToString();
            test2          = lines[3].ToString();
            test4          = lines[4].ToString();
            test3          = lines[5].ToString();

            combobLangue.Items.Clear();

            if (test4 == "Francais")
            {
                combobLangue.Items.Add("Francais");
                combobLangue.Items.Add("Anglais");

                combobLangue.Text = test4;
            }
            else
            {
                combobLangue.Items.Add("French");
                combobLangue.Items.Add("English");

                combobLangue.Text = "English";
            }

            Opacity           = Convert.ToDouble(test);
            hScrollBar1.Value = Convert.ToInt32(Opacity * 100);

            if (test1.ToString() == "True")
            {
                cbBoiteMessagesNon.Checked = false;
                cbBoiteMessagesOui.Checked = true;
            }
            else
            {
                cbBoiteMessagesOui.Checked = false;
                cbBoiteMessagesNon.Checked = true;
            }

            if (test2.ToString() == "True")
            {
                cbInfoDefilantesNon.Checked = false;
                cbInfoDefilantesOui.Checked = true;
            }
            else
            {
                cbInfoDefilantesOui.Checked = false;
                cbInfoDefilantesNon.Checked = true;
            }

            if (test3.ToString() == "True")
            {
                CbTutorielNon.Checked = false;
                CbTutorielOui.Checked = true;
            }
            else
            {
                CbTutorielOui.Checked = false;
                CbTutorielNon.Checked = true;
            }

            Fonction.policeTexte(this); // Gestion police
        }