Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15346


Ignore:
Timestamp:
09/04/17 12:46:43 (7 years ago)
Author:
bburlacu
Message:

#2829: List hive jobs when the window is opened.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/HeuristicLab.HiveDrain/HeuristicLab.HiveDrain/HiveDrainMainWindow.cs

    r15342 r15346  
    11using System;
     2using System.Collections.Generic;
    23using System.Threading.Tasks;
    34using System.Windows.Forms;
     5using HeuristicLab.Clients.Hive;
    46using HeuristicLab.Common;
    57using HeuristicLab.Core;
     
    1012      InitializeComponent();
    1113      ContentManager.Initialize(new PersistenceContentManager());
     14      ListHiveJobs();
    1215    }
    1316
    14     private Task task;
     17    private System.Threading.Tasks.Task task;
    1518
    1619    public static ThreadSafeLog Log = new ThreadSafeLog();
     
    3033
    3134      JobDownloader jobDownloader = new JobDownloader(Environment.CurrentDirectory, pattern, Log, oneFileCheckBox.Checked);
    32       task = new Task(jobDownloader.Start);
     35      task = new System.Threading.Tasks.Task(jobDownloader.Start);
    3336      task.ContinueWith(x => { Log.LogMessage("All tasks written, quitting."); EnableButton(); }, TaskContinuationOptions.OnlyOnRanToCompletion);
    3437      task.ContinueWith(x => { Log.LogMessage("Unexpected Exception while draining the Hive: " + x.Exception.ToString()); EnableButton(); }, TaskContinuationOptions.OnlyOnFaulted);
     
    3942      //TODO: implement task cancelation
    4043    }
     44
     45    private void ListHiveJobs() {
     46      if (logView.Content == null)
     47        logView.Content = Log;
     48      Log.Clear();
     49      var jobs = HiveServiceLocator.Instance.CallHiveService<IEnumerable<Job>>(s => s.GetJobs());
     50      foreach (var job in jobs) {
     51        Log.LogMessage(string.Format("{0}\t{1}", job.DateCreated, job.Name));
     52      }
     53    }
    4154  }
    4255}
Note: See TracChangeset for help on using the changeset viewer.