Ignore:
Timestamp:
07/04/19 14:45:47 (3 years ago)
Author:
mkommend
Message:

#2845: Merged 16430 into stable.

Location:
stable
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Clients.Hive.JobManager

  • stable/HeuristicLab.Clients.Hive.JobManager/3.3/MenuItems/RunInHiveMenuItem.cs

    r17059 r17062  
    9999          rJob.Job.ResourceIds = hiveResourceSelectorDialog.SelectedResources.Select(x => x.Id).ToList();
    100100
    101           progress = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().AddOperationProgressToContent(this.content, "Uploading to Hive...");
     101          progress = Progress.Show(this.content, "Uploading to Hive...", ProgressMode.Indeterminate);
    102102          rJob.Progress = progress;
    103103          progress.ProgressStateChanged += progress_ProgressStateChanged;
     
    110110    private void progress_ProgressStateChanged(object sender, EventArgs e) {
    111111      if (progress.ProgressState != ProgressState.Started) {
    112         MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromContent(content);
     112        Progress.Hide(content);
    113113        progress.ProgressStateChanged -= progress_ProgressStateChanged;
    114114      }
     
    116116
    117117    private void HandleEx(Exception ex) {
    118       MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromContent(content);
     118      Progress.Hide(content);
    119119      progress.ProgressStateChanged -= progress_ProgressStateChanged;
    120120      ErrorHandling.ShowErrorDialog("Error uploading tasks", ex);
  • stable/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelectorDialog.cs

    r17059 r17062  
    9696      if (InvokeRequired) Invoke((Action<object, EventArgs>)HiveClient_Instance_Refreshing, sender, e);
    9797      else {
    98         var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
    99         mainForm.AddOperationProgressToView(this, "Refreshing ...");
     98        Progress.ShowOnControl(this, "Refreshing", ProgressMode.Indeterminate);
    10099        refreshButton.Enabled = false;
    101100      }
     
    105104      if (InvokeRequired) Invoke((Action<object, EventArgs>)HiveClient_Instance_Refreshed, sender, e);
    106105      else {
    107         var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
    108         mainForm.RemoveOperationProgressFromView(this);
     106        Progress.HideFromControl(this);
    109107        refreshButton.Enabled = true;
    110108      }
     
    140138      okButton.Enabled = hiveResourceSelector.AssignedResources.Any();
    141139
    142       if(!hiveResourceSelector.AssignedResources.Any()) {
     140      if (!hiveResourceSelector.AssignedResources.Any()) {
    143141        errorProvider.SetError(okButton, "Note: currently no resources are assigned");
    144       } else if(hiveResourceSelector.AssignedCores == 0) {
     142      } else if (hiveResourceSelector.AssignedCores == 0) {
    145143        errorProvider.SetError(okButton, "Note: currently no resources with cores are assigned");
    146144      } else {
  • stable/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobListView.cs

    r17059 r17062  
    4747      this.itemsListView.FullRowSelect = true;
    4848
    49       this.itemsListView.ListViewItemSorter = new ListViewItemComparer(new int[] { 2, 0 }, new SortOrder[] { SortOrder.Ascending, SortOrder.Ascending });     
     49      this.itemsListView.ListViewItemSorter = new ListViewItemComparer(new int[] { 2, 0 }, new SortOrder[] { SortOrder.Ascending, SortOrder.Ascending });
    5050
    5151      foreach (ColumnHeader c in this.itemsListView.Columns) {
     
    5353        int w = c.Width;
    5454        c.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
    55         if(w > c.Width) {
     55        if (w > c.Width) {
    5656          c.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
    5757        }
     
    120120
    121121        task.ContinueWith((t) => {
    122           MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this);
     122          Progress.Hide(this);
    123123          ErrorHandling.ShowErrorDialog("An error occured while deleting the job. ", t.Exception);
    124124        }, TaskContinuationOptions.OnlyOnFaulted);
     
    131131
    132132    private void DeleteHiveJobsAsync(object items) {
    133       MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, "Deleting job...");
     133      Progress.Show(this, "Deleting job...", ProgressMode.Indeterminate);
    134134      foreach (RefreshableJob item in (List<RefreshableJob>)items) {
    135135        Content.Remove(item);
    136136      }
    137       MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this);
     137      Progress.Hide(this);
    138138    }
    139139
     
    197197      listViewItem.SubItems.Insert(1, new ListViewItem.ListViewSubItem(listViewItem, item.Job.Name));
    198198      listViewItem.SubItems.Insert(2, new ListViewItem.ListViewSubItem(listViewItem, HiveClient.Instance.GetProjectAncestry(item.Job.ProjectId)));
    199      
     199
    200200      listViewItem.Group = GetListViewGroup(item.Job.OwnerUsername);
    201201      return listViewItem;
  • stable/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs

    r17059 r17062  
    7575      Content.Loaded += new EventHandler(Content_Loaded);
    7676      Content.TaskReceived += new EventHandler(Content_TaskReceived);
    77       MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, Content.Progress);
     77      Progress.Show(this, Content.Progress);
    7878    }
    7979
     
    9090      Content.Loaded -= new EventHandler(Content_Loaded);
    9191      Content.TaskReceived -= new EventHandler(Content_TaskReceived);
    92       MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this, false);
     92      Progress.Hide(this, false);
    9393      DeregisterHiveExperimentEvents();
    9494      DeregisterHiveTasksEvents();
     
    133133          stateLogViewHost.Content = null;
    134134        } else {
    135           if(Content.Job != null
    136             && Content.Job.Id != Guid.Empty 
     135          if (Content.Job != null
     136            && Content.Job.Id != Guid.Empty
    137137            && !originalJobProjectAssignment.ContainsKey(Content.Job.Id)) {
    138138            originalJobProjectAssignment.Add(Content.Job.Id, Content.Job.ProjectId);
     
    159159                projectNameTextBox.Text = HiveClient.Instance.GetProjectAncestry(Content.Job.ProjectId);
    160160                projectNameTextBox.Text += "   (" + (cores.HasValue ? cores.Value.ToString() : "0") + " cores)";
    161               }               
     161              }
    162162            }
    163163          } else if (Content.Job != null && Content.Job.ProjectId != Guid.Empty) {
     
    167167            }
    168168
    169             if(hiveResourceSelectorDialog == null)
     169            if (hiveResourceSelectorDialog == null)
    170170              hiveResourceSelectorDialog = new HiveResourceSelectorDialog(Content.Job.Id, Content.Job.ProjectId);
    171171
     
    203203          executionTimeTextBox.Text = Content.ExecutionTime.ToString();
    204204          refreshAutomaticallyCheckBox.Checked = Content.RefreshAutomatically;
    205          
     205
    206206          logView.Content = Content.Log;
    207207          lock (runCollectionViewLocker) {
     
    408408      if (hiveResourceSelectorDialog == null) {
    409409        hiveResourceSelectorDialog = new HiveResourceSelectorDialog(Content.Job.Id, Content.Job.ProjectId);
    410       } else if(hiveResourceSelectorDialog.JobId != Content.Job.Id) {
     410      } else if (hiveResourceSelectorDialog.JobId != Content.Job.Id) {
    411411        hiveResourceSelectorDialog.JobId = Content.Job.Id;
    412412        hiveResourceSelectorDialog.SelectedProjectId = Content.Job.ProjectId;
     
    418418          hiveResourceSelectorDialog.ProjectId = Guid.Empty;
    419419        }
    420       } else if(hiveResourceSelectorDialog.JobId == Guid.Empty && Content.Job.Id == Guid.Empty) {
     420      } else if (hiveResourceSelectorDialog.JobId == Guid.Empty && Content.Job.Id == Guid.Empty) {
    421421        hiveResourceSelectorDialog.JobId = Content.Job.Id;
    422422        hiveResourceSelectorDialog.ProjectId = Guid.Empty;
     
    430430      if (hiveResourceSelectorDialog.ShowDialog(this) == DialogResult.OK) {
    431431        selectedProject = hiveResourceSelectorDialog.SelectedProject;
    432         if(selectedProject != null) {       
     432        if (selectedProject != null) {
    433433          Content.Job.ProjectId = selectedProject.Id;
    434434          Content.Job.ResourceIds = hiveResourceSelectorDialog.SelectedResources.Select(x => x.Id).ToList();
     
    493493
    494494    private void PauseJobAsync(object job) {
    495       Content.Progress.Start("Pausing job...");
     495      Content.Progress.Start("Pausing job...", ProgressMode.Indeterminate);
    496496      HiveClient.PauseJob((RefreshableJob)job);
    497497      Content.Progress.Finish();
     
    499499
    500500    private void StopJobAsync(object job) {
    501       Content.Progress.Start("Stopping job...");
     501      Content.Progress.Start("Stopping job...", ProgressMode.Indeterminate);
    502502      HiveClient.StopJob((RefreshableJob)job);
    503503      Content.Progress.Finish();
     
    505505
    506506    private void ResumeJobAsync(object job) {
    507       Content.Progress.Start("Resuming job...");
     507      Content.Progress.Start("Resuming job...", ProgressMode.Indeterminate);
    508508      HiveClient.ResumeJob((RefreshableJob)job);
    509509      Content.Progress.Finish();
     
    582582        startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = false;
    583583      } else {
    584         startButton.Enabled = Content.IsControllable && Content.HiveTasks != null && Content.HiveTasks.Count > 0 
    585           && Content.Job.ProjectId != Guid.Empty && Content.Job.ResourceIds != null  && Content.Job.ResourceIds.Any()
     584        startButton.Enabled = Content.IsControllable && Content.HiveTasks != null && Content.HiveTasks.Count > 0
     585          && Content.Job.ProjectId != Guid.Empty && Content.Job.ResourceIds != null && Content.Job.ResourceIds.Any()
    586586          && (Content.ExecutionState == ExecutionState.Prepared || Content.ExecutionState == ExecutionState.Paused) && !Content.IsProgressing;
    587587        pauseButton.Enabled = Content.IsControllable && Content.ExecutionState == ExecutionState.Started && !Content.IsProgressing;
     
    589589      }
    590590    }
    591    
     591
    592592    private Project GetProject(Guid projectId) {
    593593      return HiveServiceLocator.Instance.CallHiveService(s => s.GetProject(projectId));
     
    595595
    596596    private void UpdateSelectorDialog() {
    597       if(hiveResourceSelectorDialog != null) {
     597      if (hiveResourceSelectorDialog != null) {
    598598        hiveResourceSelectorDialog = null;
    599599        //hiveResourceSelectorDialog.JobId = Content.Job.Id;
Note: See TracChangeset for help on using the changeset viewer.