public void SetIdaTableEntry(IdaJob idajob)
 {
     if (IdaTable.InvokeRequired == false)
     {
         var rowList = IdaTable.Rows.Cast <DataGridViewRow>().Where(
             ro => ((string)ro.Cells["Model"].Value == idajob.Model) &&
             ((string)ro.Cells["Record"].Value == idajob.Record) &&
             ((string)ro.Cells["Folder"].Value == idajob.ModelFolder)
             ).ToList();
         DataGridViewRow row;
         if (rowList.Count > 0)
         {
             row = rowList[0];
         }
         else
         {
             row = new DataGridViewRow();
             row.Cells["Model"].Value  = idajob.Model;
             row.Cells["Record"].Value = idajob.Record;
             row.Cells["Folder"].Value = idajob.ModelFolder;
             IdaGraphDic[idajob]       = idajob.Graph;
         }
         row.Cells["Status"].Value        = idajob.Status.ToString();
         row.Cells["RunningJobs"].Value   = idajob.Status.NRunningJobs;
         row.Cells["CompletedJobs"].Value = idajob.Status.NCompleteJobs;
     }
     else
     {
         var dlgt = new SetIdaTableEntryDelegate(SetIdaTableEntry);
         try
         {
             Invoke(dlgt, idajob);
         }
         catch
         {
             Thread.Sleep(1000);
             Invoke(dlgt, idajob);
         }
     }
 }
 public void SetClientTableEntry(IdaClient client)
 {
     if (ClientsTable.InvokeRequired == false)
     {
         var rowList = ClientsTable.Rows.Cast <DataGridViewRow>().Where(
             ro => (string)ro.Cells["IP"].Value == client.Ip.ToString()).ToList();
         DataGridViewRow row;
         if (rowList.Count > 0)
         {
             row = rowList[0];
         }
         else
         {
             row = new DataGridViewRow();
             row.Cells["Name"].Value     = client.Name;
             row.Cells["IP"].Value       = client.Ip.ToString();
             row.Cells["NumCores"].Value = client.NCores;
             ClientJobDic[client]        = client.JobList;
             ClientActivityDic[client]   = client.ActivityLogList;
         }
         row.Cells["Connection"].Value   = client.Connected? "Online" : "Offline";
         row.Cells["WorkingCores"].Value = client.NWorkingCores;
     }
     else
     {
         var dlgt = new SetIdaTableEntryDelegate(SetIdaTableEntry);
         try
         {
             Invoke(dlgt, client);
         }
         catch
         {
             Thread.Sleep(1000);
             Invoke(dlgt, client);
         }
     }
 }