public async Task <int> Invoke(EnvironmentVar enVar)
        {
            Task monitor = Task.Run(() =>
            {
                LocalFileAccess lfa = new LocalFileAccess();
                while (!_enVars.All(x => x.finishIndicate == true))
                {
                    for (int i = 0; i < _enVars.Length; i++)
                    {
                        if (_record.updateIndicate[i] == true)
                        {
                            /** update fitRecord to File **/
                            lfa.StoreListToLinesAppend(Directory.GetCurrentDirectory() + @"\OUT\MOGA\" + _enVars[i].pmProblem["Name"] + @"\CEOutput_" + i.ToString(), _record.currentGen[i]);
                            lfa.StoreListToLinesAppend(Directory.GetCurrentDirectory() + @"\OUT\MOGA\" + _enVars[i].pmProblem["Name"] + @"\CEOutput_" + i.ToString(), _record.currentCElist[i]);

                            List <string> tmpStr = new List <string>();
                            for (int j = 0; j < _record.currentFitnessList[i].Count; j++)
                            {
                                tmpStr.Add(_record.currentFitnessList[i][j].Item1 + " " + _record.currentFitnessList[i][j].Item2);
                            }
                            lfa.StoreListToLinesAppend(Directory.GetCurrentDirectory() + @"\OUT\MOGA\" + _enVars[i].pmProblem["Name"] + @"\CEOutput_" + i.ToString(), tmpStr);

                            for (int k = 0; k < _record.currentBestSolution[i].Length; k++)
                            {
                                if (_record.currentBestSolution[i][k] != null)
                                {
                                    lfa.StoreListToLinesAppend(Directory.GetCurrentDirectory() + @"\OUT\MOGA\" + _enVars[i].pmProblem["Name"] + @"\CEOutput_" + i.ToString(), _record.currentBestSolution[i][k]);
                                }
                            }
                            _record.updateDisplay[i] = true;
                            while (_record.updateDisplay[i] == true)
                            {
                                ;
                            }
                            _record.updateIndicate[i] = false;
                        }
                    }
                }
                for (int i = 0; i < _enVars.Length; i++)
                {
                    string timeElaspe = @"Total Time: " + Math.Round(_record.Watch[i].ElapsedMilliseconds * 1.0 / (1000 * 60), 3).ToString();
                    lfa.StoreListToLinesAppend(Directory.GetCurrentDirectory() + @"\OUT\MOGA\" + _enVars[i].pmProblem["Name"] + @"\CEOutput_" + i.ToString(), new List <string>()
                    {
                        timeElaspe
                    });
                }
            });
            await monitor;

            Console.WriteLine("Mointor Closed.");
            return(0);
        }
 private void timer2_Tick(object sender, EventArgs e)
 {
     lfa.StoreListToLinesAppend(
         rootPath + @"\" + Environment.MachineName,
         new List <string>()
     {
         "I am alive #" + DateTime.Now.ToString()
     });
 }