private void timerWorkingSet_Tick(object sender, EventArgs e)
{
long memByte = Environment.WorkingSet;
long memKByte = memByte / 1024;
int memMByte = (int)(memKByte / 1024);
lblWorkingSet.Text =
string.Format("Amount of physical memory mapped to the process context: ({0} Byte) ({1} KB) ({2} MB)",
memByte.ToString(), memKByte.ToString(), memMByte.ToString());
lblGeneration.Text = "Generation: " + Algorithm.Algorithm.GetInstance().GetCurrentGeneration().ToString();
if (state == ThreadState.Running || state == ThreadState.WaitSleepJoin || state == ThreadState.Suspended)
{
int timeLenght = (Environment.TickCount - StartedTick) / 1000; // Convert to Second
string S = (timeLenght % 60).ToString();
string M = ((timeLenght / 60) % 60).ToString();
string H = (timeLenght / 3600).ToString();
S = (S.Length > 1) ? S : S.Insert(0, "0");
M = (M.Length > 1) ? M : M.Insert(0, "0");
H = (H.Length > 1) ? H : H.Insert(0, "0");
this.Text = string.Format("Result Working Time ({0}:{1}:{2})", H, M, S);
}
Monitor.Enter(TimerControler);
if (PCF != null)
if (!PCF.IsDisposed)
PCF.PC_ActivityMonitor.RefreshData();
Monitor.Exit(TimerControler);
//
// check end of solving
//
if (Algorithm.Algorithm._state == AlgorithmState.AS_CRITERIA_STOPPED)
{
btnStop_Click(sender, e);
Algorithm.Algorithm._state = AlgorithmState.AS_USER_STOPPED;
MessageBox.Show("This Program could successfully solve the problem.", "Finishing the GA",
MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
}
}