Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8156


Ignore:
Timestamp:
06/28/12 18:49:22 (12 years ago)
Author:
ascheibe
Message:

#1762 Removed IProgressReporter and changed the Hive Job Manager accordingly.

Location:
trunk/sources
Files:
1 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelector.cs

    r8145 r8156  
    6969      imageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.MonitorLarge);
    7070      imageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.NetworkCenterLarge);
    71       progressView = new ProgressView(this);
    7271    }
    7372
     
    7877        currentProgress = new Progress();
    7978        currentProgress.Status = "Downloading resources. Please be patient.";
     79        if (progressView == null) {
     80          progressView = new ProgressView(this);
     81        }
    8082        progressView.Progress = currentProgress;
    8183      }
  • trunk/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs

    r8146 r8156  
    464464        Invoke(new EventHandler(Content_IsProgressingChanged), sender, e);
    465465      } else {
    466         if (Content != null && Content.IsProgressing) {
     466        if (Content != null && Content.Progress != null && Content.IsProgressing) {
    467467          SetProgressView();
    468468        } else {
    469           FinishProgressView();
     469          progressView.Progress = null;
    470470        }
    471471      }
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/HiveClient.cs

    r8109 r8156  
    258258    private void UploadJob(RefreshableJob refreshableJob, CancellationToken cancellationToken) {
    259259      try {
     260        refreshableJob.IsProgressing = true;
    260261        refreshableJob.Progress = new Progress("Connecting to server...");
    261         refreshableJob.IsProgressing = true;
    262 
    263262        IEnumerable<string> resourceNames = ToResourceNameList(refreshableJob.Job.ResourceNames);
    264263        var resourceIds = new List<Guid>();
     
    316315      }
    317316      finally {
     317        refreshableJob.Progress.Finish();
    318318        refreshableJob.IsProgressing = false;
    319319      }
     
    427427    public static void LoadJob(RefreshableJob refreshableJob) {
    428428      var hiveExperiment = refreshableJob.Job;
     429      refreshableJob.IsProgressing = true;
    429430      refreshableJob.Progress = new Progress();
    430431
    431432      try {
    432         refreshableJob.IsProgressing = true;
    433433        int totalJobCount = 0;
    434434        IEnumerable<LightweightTask> allTasks;
     
    471471      }
    472472      finally {
     473        refreshableJob.Progress.Finish();
    473474        refreshableJob.IsProgressing = false;
    474475      }
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/RefreshableJob.cs

    r8090 r8156  
    3131
    3232namespace HeuristicLab.Clients.Hive {
    33   public class RefreshableJob : IHiveItem, IDeepCloneable, IContent, IProgressReporter, IComparable<RefreshableJob> {
     33  public class RefreshableJob : IHiveItem, IDeepCloneable, IContent, IComparable<RefreshableJob> {
    3434    private JobResultPoller jobResultPoller;
    3535    private ConcurrentTaskDownloader<ItemTask> jobDownloader;
    3636    private static object locker = new object();
     37
     38    public bool IsProgressing { get; set; }
    3739
    3840    private Job job;
     
    165167    }
    166168
    167     private bool isProgressing;
    168     public bool IsProgressing {
    169       get { return isProgressing; }
    170       set {
    171         if (isProgressing != value) {
    172           isProgressing = value;
    173           OnIsProgressingChanged();
    174         }
    175       }
    176     }
    177 
    178169    private IProgress progress;
    179170    public IProgress Progress {
    180171      get { return progress; }
    181       set { this.progress = value; }
    182     }
     172      set {
     173        this.progress = value;
     174        OnIsProgressingChanged();
     175      }
     176    }
     177
    183178
    184179    private ThreadSafeLog log;
     
    229224
    230225    #region JobResultPoller Events
    231 
    232226    public void StartResultPolling() {
    233227      if (jobResultPoller == null) {
     
    410404    }
    411405
    412     public event EventHandler IsProgressingChanged;
    413     protected virtual void OnIsProgressingChanged() {
    414       var handler = IsProgressingChanged;
    415       if (handler != null) handler(this, EventArgs.Empty);
    416     }
    417 
    418406    public event EventHandler IsDownloadableChanged;
    419407    private void OnIsDownloadableChanged() {
     
    473461    protected virtual void OnTaskReceived() {
    474462      var handler = TaskReceived;
     463      if (handler != null) handler(this, EventArgs.Empty);
     464    }
     465    public event EventHandler IsProgressingChanged;
     466    private void OnIsProgressingChanged() {
     467      var handler = IsProgressingChanged;
    475468      if (handler != null) handler(this, EventArgs.Empty);
    476469    }
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/Views/ProgressView.cs

    r8145 r8156  
    3232      set {
    3333        if (progress == value) return;
    34         DeregisterProgressEvents();
     34        Finish();
    3535        progress = value;
    3636        RegisterProgressEvents();
     
    5050
    5151    private void ShowProgress() {
    52       this.Left = (parentView.ClientRectangle.Width / 2) - (this.Width / 2);
    53       this.Top = (parentView.ClientRectangle.Height / 2) - (this.Height / 2);
    54       this.Anchor = AnchorStyles.Left | AnchorStyles.Top;
     52      if (progress != null) {
     53        this.Left = (parentView.ClientRectangle.Width / 2) - (this.Width / 2);
     54        this.Top = (parentView.ClientRectangle.Height / 2) - (this.Height / 2);
     55        this.Anchor = AnchorStyles.Left | AnchorStyles.Top;
    5556
    56       LockBackground();
     57        LockBackground();
    5758
    58       if (!parentView.Controls.Contains(this)) {
    59         parentView.Controls.Add(this);
     59        if (!parentView.Controls.Contains(this)) {
     60          parentView.Controls.Add(this);
     61        }
     62
     63        BringToFront();
     64        Visible = true;
    6065      }
    61 
    62       BringToFront();
    63       Visible = true;
    6466    }
    6567
     
    123125      if (InvokeRequired) Invoke((Action)UpdateProgressValue);
    124126      else {
    125         double progressValue = progress.ProgressValue;
    126         if (progressValue < progressBar.Minimum || progressValue > progressBar.Maximum) {
    127           progressBar.Style = ProgressBarStyle.Marquee;
    128           progressBar.Value = progressBar.Minimum;
    129         } else {
    130           progressBar.Style = ProgressBarStyle.Blocks;
    131           progressBar.Value = (int)Math.Round(progressBar.Minimum + progressValue * (progressBar.Maximum - progressBar.Minimum));
     127        if (progress != null) {
     128          double progressValue = progress.ProgressValue;
     129          if (progressValue < progressBar.Minimum || progressValue > progressBar.Maximum) {
     130            progressBar.Style = ProgressBarStyle.Marquee;
     131            progressBar.Value = progressBar.Minimum;
     132          } else {
     133            progressBar.Style = ProgressBarStyle.Blocks;
     134            progressBar.Value = (int)Math.Round(progressBar.Minimum + progressValue * (progressBar.Maximum - progressBar.Minimum));
     135          }
    132136        }
    133137      }
     
    137141      if (InvokeRequired) Invoke((Action)UpdateProgressStatus);
    138142      else {
    139         string status = progress.Status;
    140         statusLabel.Text = progress.Status;
     143        if (progress != null) {
     144          string status = progress.Status;
     145          statusLabel.Text = progress.Status;
     146        }
    141147      }
    142148    }
  • trunk/sources/HeuristicLab.MainForm/3.3/HeuristicLab.MainForm-3.3.csproj

    r7582 r8156  
    117117    <Compile Include="Interfaces\IConfigureableView.cs" />
    118118    <Compile Include="Interfaces\IProgress.cs" />
    119     <Compile Include="Interfaces\IProgressReporter.cs" />
    120119    <Compile Include="Plugin.cs" />
    121120    <Compile Include="Progress.cs" />
  • trunk/sources/HeuristicLab.MainForm/3.3/Interfaces/IProgress.cs

    r8145 r8156  
    3030    void SignalSuccessfulCancelation();
    3131
     32    bool CancelRequested { get; set; }
     33
    3234    event EventHandler Finished;
    3335    event EventHandler StatusChanged;
    3436    event EventHandler ProgressValueChanged;
    35 
    36     bool CancelRequested { get; set; }
    3737    event EventHandler Canceled;
    38 
    39 
    4038  }
    4139}
Note: See TracChangeset for help on using the changeset viewer.