Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/03/13 15:55:36 (11 years ago)
Author:
ascheibe
Message:

#1042 merged r9849, r9851, r9865, r9867, r9868, r9893, r9894, r9895, r9896, r9900, r9901, r9905, r9907 into stable branch

Location:
stable
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelector.cs

    r9456 r9933  
    4242    private ISet<TreeNode> filteredTreeNodes;
    4343    private ISet<TreeNode> nodeStore;
    44     private Progress progress;
    45     private ProgressView progressView;
    46 
     44   
    4745    private ISet<Resource> selectedResources;
    4846    public ISet<Resource> SelectedResources {
     
    6462      imageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.MonitorLarge);
    6563      imageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.NetworkCenterLarge);
    66       progress = new Progress() {
    67         CanBeCanceled = false,
    68         ProgressState = ProgressState.Finished
    69       };
    70     }
    71 
    72     protected override void DeregisterContentEvents() {
    73       if (progressView != null) {
    74         progressView.Content = null;
    75         progressView.Dispose();
    76         progressView = null;
    77       }
    78       base.DeregisterContentEvents();
    79     }
    80 
    81     protected override void RegisterContentEvents() {
    82       base.RegisterContentEvents();
    83       progressView = new ProgressView(this, progress);
    84     }
    85 
     64    }
     65 
    8666    public void StartProgressView() {
    8767      if (InvokeRequired) {
    8868        Invoke(new Action(StartProgressView));
    8969      } else {
    90         progress.Status = "Downloading resources. Please be patient.";
    91         progress.ProgressState = ProgressState.Started;
     70        var message = "Downloading resources. Please be patient.";
     71        MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, message);
    9272      }
    9373    }
     
    9777        Invoke(new Action(FinishProgressView));
    9878      } else {
    99         progress.Finish();
     79        MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this);
    10080      }
    10181    }
  • stable/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobListView.cs

    r9559 r9933  
    3434  [Content(typeof(ItemCollection<RefreshableJob>), false)]
    3535  public partial class RefreshableHiveJobListView : HeuristicLab.Core.Views.ItemCollectionView<RefreshableJob> {
    36     private Progress progress;
    37     private ProgressView progressView;
    38 
    3936    public RefreshableHiveJobListView() {
    4037      InitializeComponent();
     
    4946
    5047      this.itemsListView.ListViewItemSorter = new ListViewItemDateComparer(0, SortOrder.Ascending);
    51 
    52       progress = new Progress() {
    53         CanBeCanceled = false,
    54         ProgressState = ProgressState.Finished
    55       };
    56       progressView = new ProgressView(this, progress);
    5748    }
    5849
     
    118109
    119110        task.ContinueWith((t) => {
    120           progress.Finish();
     111          MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this);
    121112          ErrorHandling.ShowErrorDialog("An error occured while deleting the job. ", t.Exception);
    122113        }, TaskContinuationOptions.OnlyOnFaulted);
     
    129120
    130121    private void DeleteHiveJobsAsync(object items) {
    131       progress.Status = "Deleting job...";
    132       progress.ProgressState = ProgressState.Started;
    133       progress.ProgressValue = 0.0;
     122      MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, "Deleting job...");
    134123      foreach (RefreshableJob item in (List<RefreshableJob>)items) {
    135124        Content.Remove(item);
    136125      }
    137       progress.Finish();
     126      MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this);
    138127    }
    139128
     
    227216      if (disposing) {
    228217        if (components != null) components.Dispose();
    229         progressView.Content = null;
    230         progressView.Dispose();
    231218      }
    232219      base.Dispose(disposing);
  • stable/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs

    r9722 r9933  
    4242  [Content(typeof(RefreshableJob), true)]
    4343  public partial class RefreshableHiveJobView : HeuristicLab.Core.Views.ItemView {
    44     private Progress progress;
    45     private ProgressView progressView;
    4644    private HiveResourceSelectorDialog hiveResourceSelectorDialog;
    4745    private bool SuppressEvents { get; set; }
     
    5856    public RefreshableHiveJobView() {
    5957      InitializeComponent();
    60       progress = new Progress() {
    61         CanBeCanceled = false,
    62         ProgressState = ProgressState.Finished
    63       };
    6458    }
    6559
     
    7266      Content.ExceptionOccured += new EventHandler<EventArgs<Exception>>(Content_ExceptionOccured);
    7367      Content.StateLogListChanged += new EventHandler(Content_StateLogListChanged);
    74       Content.IsProgressingChanged += new EventHandler(Content_IsProgressingChanged);
    7568      Content.HiveTasksChanged += new EventHandler(Content_HiveTasksChanged);
    7669      Content.ExecutionStateChanged += new EventHandler(Content_ExecutionStateChanged);
     
    7871      Content.Loaded += new EventHandler(Content_Loaded);
    7972      Content.TaskReceived += new EventHandler(Content_TaskReceived);
    80       progressView = new ProgressView(this, progress);
     73      MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, Content.Progress);
    8174    }
    8275
     
    8881      Content.ExceptionOccured -= new EventHandler<EventArgs<Exception>>(Content_ExceptionOccured);
    8982      Content.StateLogListChanged -= new EventHandler(Content_StateLogListChanged);
    90       Content.IsProgressingChanged -= new EventHandler(Content_IsProgressingChanged);
    9183      Content.HiveTasksChanged -= new EventHandler(Content_HiveTasksChanged);
    9284      Content.ExecutionStateChanged -= new EventHandler(Content_ExecutionStateChanged);
     
    9486      Content.Loaded -= new EventHandler(Content_Loaded);
    9587      Content.TaskReceived -= new EventHandler(Content_TaskReceived);
    96       if (progressView != null) {
    97         progressView.Content = null;
    98         progressView.Dispose();
    99         progressView = null;
    100       }
     88      MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this, false);
    10189      DeregisterHiveExperimentEvents();
    10290      DeregisterHiveTasksEvents();
     
    159147      Content_HiveExperimentChanged(this, EventArgs.Empty);
    160148      Content_HiveTasksChanged(this, EventArgs.Empty);
    161       Content_IsProgressingChanged(this, EventArgs.Empty);
    162149      Content_StateLogListChanged(this, EventArgs.Empty);
    163150      HiveExperiment_PropertyChanged(this, new PropertyChangedEventArgs("Id"));
     
    260247        SetEnabledStateOfControls();
    261248    }
    262     private void Content_Prepared(object sender, EventArgs e) {
    263       if (InvokeRequired)
    264         Invoke(new EventHandler(Content_Prepared), sender, e);
    265       else {
    266         nameTextBox.Enabled = true;
    267         Locked = false;
    268         SetEnabledStateOfControls();
    269       }
    270     }
    271     private void Content_Started(object sender, EventArgs e) {
    272       if (InvokeRequired)
    273         Invoke(new EventHandler(Content_Started), sender, e);
    274       else {
    275         nameTextBox.Enabled = false;
    276         SetEnabledStateOfControls();
    277       }
    278     }
    279     private void Content_Paused(object sender, EventArgs e) {
    280       if (InvokeRequired)
    281         Invoke(new EventHandler(Content_Paused), sender, e);
    282       else {
    283         nameTextBox.Enabled = true;
    284         SetEnabledStateOfControls();
    285       }
    286     }
    287     private void Content_Stopped(object sender, EventArgs e) {
    288       if (InvokeRequired)
    289         Invoke(new EventHandler(Content_Stopped), sender, e);
    290       else {
    291         nameTextBox.Enabled = true;
    292         Locked = false;
    293         SetEnabledStateOfControls();
    294       }
    295     }
     249
    296250    private void Content_ExecutionTimeChanged(object sender, EventArgs e) {
    297251      if (InvokeRequired)
     
    336290      if (Content != null && Content.Job != null) {
    337291        RegisterHiveExperimentEvents();
    338         Content_IsProgressingChanged(sender, e);
    339292      }
    340293    }
     
    410363        var task = System.Threading.Tasks.Task.Factory.StartNew(ResumeJobAsync, Content);
    411364        task.ContinueWith((t) => {
    412           progress.Finish();
     365          Content.Progress.Finish();
    413366          MessageBox.Show("An error occured resuming the job. See the log for more information.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error);
    414367          Content.Log.LogException(t.Exception);
     
    422375      var task = System.Threading.Tasks.Task.Factory.StartNew(PauseJobAsync, Content);
    423376      task.ContinueWith((t) => {
    424         progress.Finish();
     377        Content.Progress.Finish();
    425378        MessageBox.Show("An error occured pausing the job. See the log for more information.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error);
    426379        Content.Log.LogException(t.Exception);
     
    431384      var task = System.Threading.Tasks.Task.Factory.StartNew(StopJobAsync, Content);
    432385      task.ContinueWith((t) => {
    433         progress.Finish();
     386        Content.Progress.Finish();
    434387        MessageBox.Show("An error occured stopping the job. See the log for more information.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error);
    435388        Content.Log.LogException(t.Exception);
     
    439392
    440393    private void PauseJobAsync(object job) {
    441       progress.Status = "Pausing job...";
    442       progress.ProgressState = ProgressState.Started;
     394      Content.Progress.Start("Pausing job...");
    443395      HiveClient.PauseJob((RefreshableJob)job);
    444       progress.Finish();
     396      Content.Progress.Finish();
    445397    }
    446398
    447399    private void StopJobAsync(object job) {
    448       progress.Status = "Stopping job...";
    449       progress.ProgressState = ProgressState.Started;
     400      Content.Progress.Start("Stopping job...");
    450401      HiveClient.StopJob((RefreshableJob)job);
    451       progress.Finish();
     402      Content.Progress.Finish();
    452403    }
    453404
    454405    private void ResumeJobAsync(object job) {
    455       progress.Status = "Resuming job...";
    456       progress.ProgressState = ProgressState.Started;
     406      Content.Progress.Start("Resuming job...");
    457407      HiveClient.ResumeJob((RefreshableJob)job);
    458       progress.Finish();
     408      Content.Progress.Finish();
    459409    }
    460410
     
    507457        stopButton.Enabled = Content.IsControllable && Content.ExecutionState == ExecutionState.Started && !Content.IsProgressing;
    508458        resetButton.Enabled = false;
    509       }
    510     }
    511     #endregion
    512 
    513     #region Progress reporting
    514     private void Content_IsProgressingChanged(object sender, EventArgs e) {
    515       if (this.InvokeRequired) {
    516         Invoke(new EventHandler(Content_IsProgressingChanged), sender, e);
    517       } else {
    518         if (Content != null && Content.Progress != null && Content.IsProgressing) {
    519           progressView.Content = Content.Progress;
    520         } else if (Content != null) {
    521           progressView.Content = progress;
    522         }
    523459      }
    524460    }
Note: See TracChangeset for help on using the changeset viewer.