コード例 #1
0
        private void SaveCurrent()
        {
            string       fileName = Chemins.CheminBackupServeur() + DateTime.Now.ToString("dd-MM-yyyy") + ".csv";
            bool         deja     = File.Exists(fileName);
            ObjectThread o_       = new ObjectThread(Constantes.PBAR_WAIT);

            o_.UpdateMaxBar(lIO.Count);

            foreach (IOEMDevice o in lIO)
            {
                Logs.WriteCsv(fileName, o);
                Constantes.LoadPatience(false);
            }
            if (!deja)
            {
                FileInfo     file = new FileInfo(fileName);
                ObjectThread o1   = new ObjectThread(dgv_backup);
                o1.WriteDataGridView(new object[] { file.Name });
            }
            File.Delete(Chemins.CheminDatabase() + "LogRecord.csv");
            File.Create(Chemins.CheminDatabase() + "LogRecord.csv");

            ObjectThread o2 = new ObjectThread(dgv_log);

            o2.ClearDataGridView(true);
            Utils.WriteLog("-- Sauvegarde du fichier courant effectuée");
            Constantes.LoadPatience(true);
        }
コード例 #2
0
        private void btn_current_Click(object sender, EventArgs e)
        {
            lIO         = new List <IOEMDevice>();
            currentFile = "LogRecord.csv";
            current     = false;
            string fileName = Chemins.CheminDatabase() + currentFile;

            if (File.Exists(fileName))
            {
                current              = true;
                pbar_statut.Value    = 0;
                Constantes.PBAR_WAIT = pbar_statut;
                Thread t = new Thread(new ThreadStart(LoadCurrentLog));
                t.Start();
            }
            else
            {
                Utils.WriteLog("Le fichier courant n'existe pas");
            }
        }