Ignore:
Timestamp:
01/16/13 11:13:18 (9 years ago)
Author:
ascheibe
Message:

#2005

  • renamed some events and methods
  • fixed some memory leaks
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/UnloadJobs/HeuristicLab.Clients.Hive/3.3/HiveClient.cs

    r9107 r9169  
    5252        if (value != jobs) {
    5353          jobs = value;
    54           OnHiveExperimentsChanged();
     54          OnHiveJobsChanged();
    5555        }
    5656      }
     
    7777
    7878    private HiveClient() { }
     79
     80    public void ClearHiveClient() {
     81      foreach (var j in Jobs) {
     82        if (j.RefreshAutomatically) {
     83          j.RefreshAutomatically = false; // stop result polling
     84          j.Dispose();
     85        }
     86      }
     87      Jobs = null;
     88      if (onlinePlugins != null)
     89        onlinePlugins.Clear();
     90      if (alreadyUploadedPlugins != null)
     91        alreadyUploadedPlugins.Clear();
     92    }
    7993
    8094    #region Refresh
     
    205219      if (handler != null) handler(this, EventArgs.Empty);
    206220    }
    207     public event EventHandler HiveExperimentsChanged;
    208     private void OnHiveExperimentsChanged() {
    209       var handler = HiveExperimentsChanged;
     221    public event EventHandler HiveJobsChanged;
     222    private void OnHiveJobsChanged() {
     223      var handler = HiveJobsChanged;
    210224      if (handler != null) handler(this, EventArgs.Empty);
    211225    }
     
    308322      }
    309323      finally {
    310         refreshableJob.RefreshAutomatically = true;
    311         refreshableJob.StartResultPolling();
     324        //refreshableJob.RefreshAutomatically = true;       
    312325        refreshableJob.Job.Modified = false;
    313326        refreshableJob.IsProgressing = false;
     
    421434      refreshableJob.IsProgressing = true;
    422435      refreshableJob.Progress = new Progress();
     436      TaskDownloader downloader = null;
    423437
    424438      try {
     
    433447
    434448        refreshableJob.Progress.Status = "Downloading tasks...";
    435         TaskDownloader downloader = new TaskDownloader(allTasks.Select(x => x.Id));
     449        downloader = new TaskDownloader(allTasks.Select(x => x.Id));
    436450        downloader.StartAsync();
    437451
     
    465479        refreshableJob.IsProgressing = false;
    466480        refreshableJob.Progress.Finish();
     481        if (downloader != null) {
     482          downloader.Dispose();
     483        }
    467484      }
    468485    }
Note: See TracChangeset for help on using the changeset viewer.