source: trunk/sources/HeuristicLab.Hive.Server.Console/3.2/HiveServerManagementConsole.cs @ 1581

Last change on this file since 1581 was 1581, checked in by aleitner, 12 years ago

added last snapshotdetails (#569)

File size: 23.8 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Collections.Generic;
24using System.ComponentModel;
25using System.Data;
26using System.Drawing;
27using System.Linq;
28using System.Text;
29using System.Windows.Forms;
30using HeuristicLab.Hive.Contracts.Interfaces;
31using HeuristicLab.Hive.Contracts.BusinessObjects;
32using HeuristicLab.Hive.Contracts;
33
34namespace HeuristicLab.Hive.Server.ServerConsole {
35
36  public delegate void closeForm(bool cf, bool error);
37
38  public partial class HiveServerManagementConsole : Form {
39
40    public event closeForm closeFormEvent;
41
42    #region private variables
43    private ResponseList<ClientGroup> clients = null;
44    private ResponseList<ClientInfo> clientInfo = null;
45    private ResponseList<Job> jobs = null;
46
47    private Dictionary<Guid, ListViewGroup> clientObjects;
48    private Dictionary<Guid, ListViewItem> clientInfoObjects;
49    private Dictionary<Guid, ListViewItem> jobObjects;
50
51    private Job currentJob = null;
52    private ClientInfo currentClient = null;
53    private string nameCurrentJob = "";
54    private string nameCurrentClient = "";
55    private bool flagJob = false;
56    private bool flagClient = false;
57
58    private List<Changes> changes = new List<Changes>();
59
60    private ToolTip tt = new ToolTip();
61    #endregion
62
63    public HiveServerManagementConsole() {
64      InitializeComponent();
65      AddClients();
66      AddJobs();
67      timerSyncronize.Start();
68    }
69
70    /// <summary>
71    /// event on Ticker
72    /// </summary>
73    /// <param name="obj"></param>
74    /// <param name="e"></param>
75    private void TickSync(object obj, EventArgs e) {
76      if (!updaterWoker.IsBusy) {
77        updaterWoker.RunWorkerAsync();
78      }
79    }
80
81    private void updaterWoker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {
82      Refresh();
83    }
84
85    private int CapacityRam(int noCores, int freeCores) {
86      return (((noCores - freeCores) / noCores) * 100);
87    }
88
89    /// <summary>
90    /// Adds clients to ListView and TreeView
91    /// </summary>
92    private void AddClients() {
93      try {
94        clientObjects = new Dictionary<Guid, ListViewGroup>();
95        clientInfoObjects = new Dictionary<Guid, ListViewItem>();
96        IClientManager clientManager =
97          ServiceLocator.GetClientManager();
98
99        clients = clientManager.GetAllClientGroups();
100        lvClientControl.Items.Clear();
101        List<Guid> inGroup = new List<Guid>();
102        foreach (ClientGroup cg in clients.List) {
103          ListViewGroup lvg = new ListViewGroup(cg.Name, HorizontalAlignment.Left);
104          foreach (ClientInfo ci in cg.Resources) {
105            ListViewItem item = null;
106            if ((ci.State == State.offline) || (ci.State == State.nullState)) {
107              item = new ListViewItem(ci.Name, 3, lvg);
108            } else {
109                            int percentageUsage = CapacityRam(ci.NrOfCores, ci.NrOfFreeCores);
110              int usage = 0;
111              if ((percentageUsage >= 0) && (percentageUsage <= 25)) {
112                usage = 0;
113              } else if ((percentageUsage > 25) && (percentageUsage <= 75)) {
114                usage = 1;
115              } else if ((percentageUsage > 75) && (percentageUsage <= 100)) {
116                usage = 2;
117              }
118
119              item = new ListViewItem(ci.Name, usage, lvg);
120            }
121            item.Tag = ci.Id;
122            lvClientControl.Items.Add(item);
123            clientInfoObjects.Add(ci.Id, item);
124            inGroup.Add(ci.Id);
125
126          }
127          lvClientControl.BeginUpdate();
128          lvClientControl.Groups.Add(lvg);
129          lvClientControl.EndUpdate();
130          clientObjects.Add(cg.Id, lvg);
131        } // Groups
132
133        clientInfo = clientManager.GetAllClients();
134        ListViewGroup lvunsorted = new ListViewGroup("no group", HorizontalAlignment.Left);
135        foreach (ClientInfo ci in clientInfo.List) {
136          bool help = false;
137          foreach (Guid client in inGroup) {
138            if (client == ci.Id) {
139              help = true;
140              break;
141            }
142          }
143          if (!help) {
144            ListViewItem item = null;
145            if ((ci.State == State.offline) || (ci.State == State.nullState)) {
146              item = new ListViewItem(ci.Name, 3, lvunsorted);
147            } else {
148              int percentageUsage = CapacityRam(ci.NrOfCores, ci.NrOfFreeCores);
149              int usage = 0;
150              if ((percentageUsage >= 0) && (percentageUsage <= 25)) {
151                usage = 0;
152              } else if ((percentageUsage > 25) && (percentageUsage <= 75)) {
153                usage = 1;
154              } else if ((percentageUsage > 75) && (percentageUsage <= 100)) {
155                usage = 2;
156              }
157              item = new ListViewItem(ci.Name, usage, lvunsorted);
158            }
159            item.Tag = ci.Id;
160            lvClientControl.Items.Add(item);
161          }
162        }
163        lvClientControl.BeginUpdate();
164        lvClientControl.Groups.Add(lvunsorted);
165        lvClientControl.EndUpdate();
166        if (flagClient) {
167          ClientClicked();
168        }
169      }
170      catch (Exception ex) {
171        closeFormEvent(true, true);
172        this.Close();
173      }
174    }
175
176
177    List<ListViewGroup> jobGroup;
178    /// <summary>
179    /// Adds jobs to ListView and TreeView
180    /// </summary>
181    private void AddJobs() {
182      try {
183        jobObjects = new Dictionary<Guid, ListViewItem>();
184        IJobManager jobManager =
185          ServiceLocator.GetJobManager();
186        jobs = jobManager.GetAllJobs();
187
188        lvJobControl.Items.Clear();
189
190        ListViewGroup lvJobCalculating = new ListViewGroup("calculating", HorizontalAlignment.Left);
191        ListViewGroup lvJobFinished = new ListViewGroup("finished", HorizontalAlignment.Left);
192        ListViewGroup lvJobPending = new ListViewGroup("pending", HorizontalAlignment.Left);
193
194        jobGroup = new List<ListViewGroup>();
195        jobGroup.Add(lvJobCalculating);
196        jobGroup.Add(lvJobFinished);
197        jobGroup.Add(lvJobPending);
198
199        foreach (Job job in jobs.List) {
200          if (job.State == State.calculating) {
201            ListViewItem lvi = new ListViewItem(job.Id.ToString(), 0, lvJobCalculating);
202            jobObjects.Add(job.Id, lvi);
203
204            //lvJobControl.Items.Add(lvi);
205
206            lvi.ToolTipText = (job.Percentage * 100) + "% of job calculated";
207          } else if (job.State == State.finished) {
208            ListViewItem lvi = new ListViewItem(job.Id.ToString(), 0, lvJobFinished);
209            jobObjects.Add(job.Id, lvi);
210            //lvJobControl.Items.Add(lvi);
211          } else if (job.State == State.offline) {
212            ListViewItem lvi = new ListViewItem(job.Id.ToString(), 0, lvJobPending);
213            jobObjects.Add(job.Id, lvi);
214            //lvJobControl.Items.Add(lvi);
215          }
216        } // Jobs
217        lvJobControl.BeginUpdate();
218        foreach (ListViewItem lvi in jobObjects.Values) {
219          lvJobControl.Items.Add(lvi);
220        }
221        lvJobControl.Groups.Add(lvJobCalculating);
222        lvJobControl.Groups.Add(lvJobFinished);
223        lvJobControl.Groups.Add(lvJobPending);
224        lvJobControl.EndUpdate();
225        if (flagJob) {
226          JobClicked();
227        }
228      }
229      catch (Exception ex) {
230        closeFormEvent(true, true);
231        this.Close();
232      }
233    }
234
235    /// <summary>
236    /// if one client is clicked, the details for the clicked client are shown
237    /// in the second panel
238    /// </summary>
239    private void ClientClicked() {
240      plClientDetails.Visible = true;
241      int i = 0;
242      while (clientInfo.List[i].Id.ToString() != nameCurrentClient) {
243        i++;
244      }
245      currentClient = clientInfo.List[i];
246      int percentageUsage = CapacityRam(currentClient.NrOfCores, currentClient.NrOfFreeCores);
247      int usage = 3;
248      if ((currentClient.State != State.offline) && (currentClient.State != State.nullState)) {
249        if ((percentageUsage >= 0) && (percentageUsage <= 25)) {
250          usage = 0;
251        } else if ((percentageUsage > 25) && (percentageUsage <= 75)) {
252          usage = 1;
253        } else if ((percentageUsage > 75) && (percentageUsage <= 100)) {
254          usage = 2;
255        }
256      }
257      pbClientControl.Image = ilClientControl.Images[usage];
258      lblClientName.Text = currentClient.Name;
259      lblLogin.Text = currentClient.Login.ToString();
260      lblState.Text = currentClient.State.ToString();
261    }
262
263    /// <summary>
264    /// if one job is clicked, the details for the clicked job are shown
265    /// in the second panel
266    /// </summary>
267    private void JobClicked() {
268      plJobDetails.Visible = true;
269      int i = 0;
270      while (jobs.List[i].Id.ToString() != nameCurrentJob) {
271        i++;
272      }
273      lvSnapshots.Enabled = true;
274      currentJob = jobs.List[i];
275      pbJobControl.Image = ilJobControl.Images[0];
276      lblJobName.Text = currentJob.Id.ToString();
277      progressJob.Value = (int)(currentJob.Percentage * 100);
278      lblProgress.Text = (int)(currentJob.Percentage * 100) + "% calculated";
279      lblUserCreatedJob.Text = currentJob.UserId.ToString() + /* currentJob.User.Name + */ " created Job";
280      lblJobCreated.Text = "Created at " + currentJob.DateCreated;
281      if (currentJob.ParentJob != null) {
282        lblParentJob.Text = currentJob.ParentJob.Id + " is parent job";
283      } else {
284        lblParentJob.Text = "";
285      }
286      lblPriorityJob.Text = "Priority of job is " + currentJob.Priority;
287      if (currentJob.Client != null) {
288        lblClientCalculating.Text = currentJob.Client.Name + " calculated Job";
289        lblJobCalculationBegin.Text = "Startet calculation at " + currentJob.DateCalculated;
290
291        if (currentJob.State == State.finished) {
292          IJobManager jobManager =
293            ServiceLocator.GetJobManager();
294          ResponseObject<JobResult> jobRes = jobManager.GetLastJobResultOf(currentJob.Id, false);
295          lblJobCalculationEnd.Text = "Calculation ended at " + jobRes.Obj.DateFinished;
296        }
297      } else {
298        lblClientCalculating.Text = "";
299        lblJobCalculationBegin.Text = "";
300        lblJobCalculationEnd.Text = "";
301      }
302      if (currentJob.State != State.offline) {
303        GetSnapshotList();
304        lvSnapshots.Visible = true;
305      } else {
306        lvSnapshots.Visible = false;
307      }
308    }
309
310    private void Refresh() {
311      foreach (Changes change in changes) {
312        if (change.Types == Type.Job) {
313          RefreshJob(change);
314        } else if (change.Types == Type.Client) {
315         RefreshClient(change);
316        } else if (change.Types == Type.ClientGroup) {
317          RefreshClientGroup(change);
318        }
319      }
320    }
321
322    private void RefreshJob(Changes change) {
323      if (change.ChangeType == Change.Update) {
324        for (int i = 0; i < lvJobControl.Items.Count; i++) {
325          if (lvJobControl.Items[i].Text == change.ID.ToString()) {
326            if (nameCurrentJob == change.ID.ToString()) {
327              JobClicked();
328            }
329            State state = jobs.List[change.Position].State;
330            System.Diagnostics.Debug.WriteLine(lvJobControl.Items[i].Text.ToString());
331            if (state == State.finished) {
332              lvJobControl.Items[i].Group = jobGroup[1];
333              System.Diagnostics.Debug.WriteLine("finished");
334            } else if (state == State.calculating) {
335              lvJobControl.Items[i].Group = jobGroup[0];
336              System.Diagnostics.Debug.WriteLine("calculating");
337            } else if (state == State.offline) {
338              lvJobControl.Items[i].Group = jobGroup[2];
339              System.Diagnostics.Debug.WriteLine("offline");
340
341            }
342            lvJobControl.Refresh();
343          }
344        }
345      } else if (change.ChangeType == Change.Create) {
346        ListViewItem lvi = new ListViewItem(
347          change.ID.ToString(), 0, jobGroup[2]);
348        jobObjects.Add(change.ID, lvi);
349        lvJobControl.Items.Add(lvi);
350
351      } else if (change.ChangeType == Change.Delete) {
352        jobObjects.Remove(change.ID);
353        for (int i = 0; i < lvJobControl.Items.Count; i++) {
354          if (change.ID.ToString() == lvJobControl.Items[i].Text.ToString()) {
355            lvJobControl.Items[i].Remove();
356            break;
357          }
358        }
359      }
360    }
361
362    private void RefreshClient(Changes change) {
363      if (change.ChangeType == Change.Update) {
364        for (int i = 0; i < lvClientControl.Items.Count; i++) {
365          if (lvClientControl.Items[i].Tag.ToString() == change.ID.ToString()) {
366            if (nameCurrentClient == change.ID.ToString()) {
367              ClientClicked();
368            }
369            State state = clientInfo.List[change.Position].State;
370            System.Diagnostics.Debug.WriteLine(lvClientControl.Items[i].Text.ToString());
371            int percentageUsage = CapacityRam(currentClient.NrOfCores, currentClient.NrOfFreeCores);
372            if ((state == State.offline) || (state == State.nullState)) {
373              lvClientControl.Items[i].ImageIndex = 3;
374            } else {
375              if ((percentageUsage >= 0) && (percentageUsage <= 25)) {
376                lvClientControl.Items[i].ImageIndex = 0;
377              } else if ((percentageUsage > 25) && (percentageUsage <= 75)) {
378                lvClientControl.Items[i].ImageIndex = 1;
379              } else if ((percentageUsage > 75) && (percentageUsage <= 100)) {
380                lvClientControl.Items[i].ImageIndex = 2;
381              }
382
383            }
384            lvClientControl.Refresh();
385          }
386        }
387
388
389      } else if (change.ChangeType == Change.Create) {
390
391      } else if (change.ChangeType == Change.Delete) {
392        clientInfoObjects.Remove(change.ID);
393        for (int i = 0; i < lvClientControl.Items.Count; i++) {
394          if (change.ID.ToString() == lvClientControl.Items[i].Text.ToString()) {
395            lvClientControl.Items[i].Remove();
396            break;
397          }
398        }
399
400      }
401    }
402
403    private void RefreshClientGroup(Changes change) {
404
405    }
406
407    #region Eventhandlers
408    /// <summary>
409    /// Send event to Login-GUI when closing
410    /// </summary>
411    /// <param name="sender"></param>
412    /// <param name="e"></param>
413    private void Close_Click(object sender, EventArgs e) {
414      if (closeFormEvent != null) {
415        closeFormEvent(true, false);
416      }
417      this.Close();
418    }
419
420    /// <summary>
421    /// Send evnt to Login-GUI when closing
422    /// </summary>
423    /// <param name="sender"></param>
424    /// <param name="e"></param>
425    private void HiveServerConsoleInformation_FormClosing(object sender, FormClosingEventArgs e) {
426      if (closeFormEvent != null) {
427        closeFormEvent(true, false);
428      }
429    }
430
431    private void AddJob_Click(object sender, EventArgs e) {
432      AddJobForm newForm = new AddJobForm();
433      newForm.Show();
434      newForm.addJobEvent += new addDelegate(updaterWoker.RunWorkerAsync);
435    }
436
437    private void OnLVClientClicked(object sender, EventArgs e) {
438      nameCurrentClient = lvClientControl.SelectedItems[0].Tag.ToString();
439      flagClient = true;
440      ClientClicked();
441    }
442
443    private void OnLVJobControlClicked(object sender, EventArgs e) {
444      nameCurrentJob = lvJobControl.SelectedItems[0].Text;
445      flagJob = true;
446      JobClicked();
447    }
448
449    private void lvJobControl_MouseMove(object sender, MouseEventArgs e) {
450      if ((lvJobControl.GetItemAt(e.X, e.Y) != null) &&
451        (lvJobControl.GetItemAt(e.X, e.Y).ToolTipText != null)) {
452        tt.SetToolTip(lvJobControl, lvJobControl.GetItemAt(e.X, e.Y).ToolTipText);
453      }
454    }
455
456    private void updaterWoker_DoWork(object sender, DoWorkEventArgs e) {
457
458      changes.Clear();
459      IClientManager clientManager =
460          ServiceLocator.GetClientManager();
461
462      #region ClientInfo
463      ResponseList<ClientInfo> clientInfoOld = clientInfo;
464      clientInfo = clientManager.GetAllClients();
465
466      IDictionary<int, ClientInfo> clientInfoOldHelp;
467
468      CloneList(clientInfoOld, out clientInfoOldHelp);
469
470      GetDelta(clientInfoOld.List, clientInfoOldHelp);
471      #endregion
472
473      #region Clients
474      ResponseList<ClientGroup> clientsOld = clients;
475
476      clients = clientManager.GetAllClientGroups();
477
478      IDictionary<int, ClientGroup> clientsOldHelp;
479
480      CloneList(clientsOld, out clientsOldHelp);
481
482      GetDelta(clientsOld.List, clientsOldHelp);
483      #endregion
484
485      #region Job
486      ResponseList<Job> jobsOld = jobs;
487      IJobManager jobManager =
488          ServiceLocator.GetJobManager();
489
490      jobs = jobManager.GetAllJobs();
491
492      IDictionary<int, Job> jobsOldHelp;
493      CloneList(jobsOld, out jobsOldHelp);
494
495      GetDelta(jobsOld.List, jobsOldHelp);
496
497      #endregion
498
499      foreach (Changes change in changes) {
500        System.Diagnostics.Debug.WriteLine(change.ID + " " + change.ChangeType);
501      }
502
503    }
504    #endregion
505
506    #region Helper methods
507
508    private void CloneList(ResponseList<Job> oldList, out IDictionary<int, Job> newList) {
509      newList = new Dictionary<int, Job>();
510      for (int i = 0; i < oldList.List.Count; i++) {
511        newList.Add(i, oldList.List[i]);
512      }
513    }
514
515    private void CloneList(ResponseList<ClientInfo> oldList, out IDictionary<int, ClientInfo> newList) {
516      newList = new Dictionary<int, ClientInfo>();
517      for (int i = 0; i < oldList.List.Count; i++) {
518        newList.Add(i, oldList.List[i]);
519      }
520    }
521
522    private void CloneList(ResponseList<ClientGroup> oldList, out IDictionary<int, ClientGroup> newList) {
523      newList = new Dictionary<int, ClientGroup>();
524      for (int i = 0; i < oldList.List.Count; i++) {
525        newList.Add(i, oldList.List[i]);
526      }
527    }
528
529    private bool IsEqual(ClientInfo ci1, ClientInfo ci2) {
530      if (ci2 == null) {
531        return false;
532      }
533      if (ci1.Id.Equals(ci2.Id)) {
534        return true;
535      } else return false;
536    }
537
538    private void GetDelta(IList<ClientInfo> oldClient, IDictionary<int, ClientInfo> helpClients) {
539      bool found = false;
540
541      for (int i = 0; i < clientInfo.List.Count; i++) {
542        ClientInfo ci = clientInfo.List[i];
543        for (int j = 0; j < oldClient.Count; j++) {
544          ClientInfo cio = oldClient[j];
545          if (ci.Id.Equals(cio.Id)) {
546            found = true;
547            if ((ci.State != cio.State) || (ci.NrOfFreeCores != ci.NrOfFreeCores)) {
548              changes.Add(new Changes { Types = Type.Client, ID = ci.Id, ChangeType = Change.Update, Position = i });
549            }
550            int removeAt = -1;
551            foreach (KeyValuePair<int, ClientInfo> kvp in helpClients) {
552              if (cio.Id.Equals(kvp.Value.Id)) {
553                removeAt = kvp.Key;
554                break;
555              }
556            }
557            if (removeAt >= 0) {
558              helpClients.Remove(removeAt);
559            }
560            break;
561          }
562        }
563        if (found == false) {
564          changes.Add(new Changes { Types = Type.Client, ID = ci.Id, ChangeType = Change.Create });
565        }
566        found = false;
567      }
568      foreach (KeyValuePair<int, ClientInfo> kvp in helpClients) {
569        changes.Add(new Changes { Types = Type.Client, ID = kvp.Value.Id, ChangeType = Change.Delete, Position = kvp.Key });
570      }
571
572    }
573
574    private void GetDelta(IList<ClientGroup> oldClient, IDictionary<int, ClientGroup> helpClients) {
575
576      bool found = false;
577      for (int i = 0; i < clients.List.Count; i++) {
578        ClientGroup cg = clients.List[i];
579        for (int j = 0; j < oldClient.Count; i++) {
580          ClientGroup cgo = oldClient[j];
581          if (cg.Id.Equals(cgo.Id)) {
582            found = true;
583            foreach (Resource resource in cg.Resources) {
584              foreach (Resource resourceold in cgo.Resources) {
585                if (resource.Id.Equals(resourceold.Id)) {
586                  if (resourceold.Name != resource.Name) {
587                    changes.Add(new Changes { Types = Type.Client, ID = cg.Id, ChangeType = Change.Update, Position = i });
588                  }
589                }
590              }
591            }
592            for (int k = 0; k < helpClients.Count; k++) {
593              if (cgo.Id.Equals(helpClients[k].Id)) {
594                helpClients.Remove(k);
595                break;
596              }
597            }
598            break;
599          }
600        }
601        if (found == false) {
602          changes.Add(new Changes { Types = Type.ClientGroup, ID = cg.Id, ChangeType = Change.Create });
603        }
604        found = false;
605      }
606      foreach (KeyValuePair<int, ClientGroup> kvp in helpClients) {
607        changes.Add(new Changes { Types = Type.ClientGroup, ID = kvp.Value.Id, ChangeType = Change.Delete, Position = kvp.Key });
608      }
609    }
610
611    private void GetDelta(IList<Job> oldJobs, IDictionary<int, Job> helpJobs) {
612      bool found = false;
613      for (int i = 0; i < jobs.List.Count; i++) {
614        Job job = jobs.List[i];
615        for (int j = 0; j < oldJobs.Count; j++) {
616
617          Job jobold = oldJobs[j];
618
619          if (job.Id.Equals(jobold.Id)) {
620
621            found = true;
622            if (job.State != State.offline) {
623              if ((!IsEqual(job.Client, jobold.Client)) || (job.State != jobold.State)
624                   || (job.Percentage != jobold.Percentage)) {
625                changes.Add(new Changes { Types = Type.Job, ID = job.Id, ChangeType = Change.Update, Position = i });
626              }
627            } else if (job.DateCalculated != jobold.DateCalculated) {
628              changes.Add(new Changes { Types = Type.Job, ID = job.Id, ChangeType = Change.Update, Position = i });
629            }
630
631            int removeAt = -1;
632            foreach (KeyValuePair<int, Job> kvp in helpJobs) {
633              if (job.Id.Equals(kvp.Value.Id)) {
634                removeAt = kvp.Key;
635                break;
636              }
637            }
638            if (removeAt >= 0) {
639              helpJobs.Remove(removeAt);
640            }
641            break;
642          }
643
644        }
645        if (found == false) {
646          changes.Add(new Changes { Types = Type.Job, ID = job.Id, ChangeType = Change.Create });
647          System.Diagnostics.Debug.WriteLine("new Job: " + job.Id);
648        }
649        found = false;
650      }
651      foreach (KeyValuePair<int, Job> kvp in helpJobs) {
652        changes.Add(new Changes { Types = Type.Job, ID = kvp.Value.Id, ChangeType = Change.Delete, Position = kvp.Key });
653        System.Diagnostics.Debug.WriteLine("delete Job: " + kvp.Value.Id);
654      }
655    }
656
657    private void GetSnapshotList() {
658
659      lvSnapshots.Items.Clear();
660      IJobManager jobManager =
661        ServiceLocator.GetJobManager();
662      ResponseObject<JobResult> jobRes = jobManager.GetLastJobResultOf(currentJob.Id, false);
663      ListViewItem curSnapshot = new ListViewItem(jobRes.Obj.Client.Name);
664      double percentage = jobRes.Obj.Percentage * 100;
665      curSnapshot.SubItems.Add(percentage.ToString() + " %");
666      curSnapshot.SubItems.Add(jobRes.Obj.timestamp.ToString());
667      lvSnapshots.Items.Add(curSnapshot);
668
669
670    }
671
672    #endregion
673
674
675
676  }
677}
Note: See TracBrowser for help on using the repository browser.