Changeset 16312


Ignore:
Timestamp:
11/20/18 16:01:34 (2 years ago)
Author:
pfleck
Message:

#2845 Adapted new Hive-Project-Management and RegressionSolutionVariableImpactsView to Progress updates.

Location:
branches/2845_EnhancedProgress
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/2845_EnhancedProgress/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectJobsView.cs

    r16311 r16312  
    8181      base.RegisterContentEvents();
    8282      matrixView.DataGridView.SelectionChanged += DataGridView_SelectionChanged;
    83       MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, progress);
     83      MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddProgressToView(this, progress);
    8484    }
    8585
    8686    protected override void DeregisterContentEvents() {
    8787      matrixView.DataGridView.SelectionChanged -= DataGridView_SelectionChanged;
    88       MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this, false);
     88      MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveProgressFromView(this, false);
    8989      base.DeregisterContentEvents();
    9090    }
     
    139139
    140140    private void refreshButton_Click(object sender, EventArgs e) {
    141       progress.Start("Refreshing jobs...");
     141      progress.StartMarquee("Refreshing jobs...");
    142142      SetEnabledStateOfControls();
    143143      var task = System.Threading.Tasks.Task.Factory.StartNew(RefreshJobsAsync);
     
    160160
    161161        if (result == DialogResult.Yes) {
    162           progress.Start("Removing job(s)...");
     162          progress.StartMarquee("Removing job(s)...");
    163163          SetEnabledStateOfControls();
    164164          var task = System.Threading.Tasks.Task.Factory.StartNew(RemoveJobsAsync, jobs);
     
    253253
    254254        if (result == DialogResult.Yes) {
    255           progress.Start("Stopping job(s)...");
     255          progress.StartMarquee("Stopping job(s)...");
    256256          SetEnabledStateOfControls();
    257257          var task = System.Threading.Tasks.Task.Factory.StartNew(StopJobsAsync, jobs);
     
    367367      var jobList = (IEnumerable<RefreshableJob>)jobs;
    368368      foreach (var job in jobList) {
    369         progress.Status = "Resuming job \"" + job.Job.Name + "\"...";
     369        progress.Message = "Resuming job \"" + job.Job.Name + "\"...";
    370370        HiveAdminClient.ResumeJob(job);
    371371      }
     
    375375      var jobList = (IEnumerable<RefreshableJob>)jobs;
    376376      foreach (var job in jobList) {
    377         progress.Status = "Pausing job \"" + job.Job.Name + "\"...";
     377        progress.Message = "Pausing job \"" + job.Job.Name + "\"...";
    378378        HiveAdminClient.PauseJob(job);
    379379      }
     
    383383      var jobList = (IEnumerable<RefreshableJob>)jobs;
    384384      foreach (var job in jobList) {
    385         progress.Status = "Stopping job \"" + job.Job.Name + "\"...";
     385        progress.Message = "Stopping job \"" + job.Job.Name + "\"...";
    386386        HiveAdminClient.StopJob(job);
    387387      }
     
    390390    private void RemoveJobsAsync(object jobs) {
    391391      var jobList = (IEnumerable<RefreshableJob>)jobs;
    392       progress.Start();
     392      progress.StartMarquee("");
    393393      foreach (var job in jobList) {
    394         progress.Status = "Removing job \"" + job.Job.Name + "\"...";
     394        progress.Message = "Removing job \"" + job.Job.Name + "\"...";
    395395        HiveAdminClient.RemoveJob(job);
    396396      }
  • branches/2845_EnhancedProgress/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectView.cs

    r16311 r16312  
    161161      if (InvokeRequired) Invoke((Action<object, EventArgs>)AccessClient_Instance_Refreshing, sender, e);
    162162      else {
    163         var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
    164         mainForm.AddOperationProgressToView(this, "Refreshing ...");
     163        Progress.ShowMarquee(this, "Refreshing ...");
    165164        SetEnabledStateOfControls();
    166165      }
     
    170169      if (InvokeRequired) Invoke((Action<object, EventArgs>)AccessClient_Instance_Refreshed, sender, e);
    171170      else {
    172         var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
    173         mainForm.RemoveOperationProgressFromView(this);
     171        Progress.Hide(this);
    174172        SetEnabledStateOfControls();
    175173      }
  • branches/2845_EnhancedProgress/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectsView.cs

    r16311 r16312  
    4343    private const string NOT_STORED_TAG = "*"; // " [not stored]";
    4444    private const string CHANGES_NOT_STORED_TAG = "*"; // " [changes not stored]";
    45     private const string INACTIVE_TAG = " [inactive]"; 
     45    private const string INACTIVE_TAG = " [inactive]";
    4646
    4747    private readonly Color selectedBackColor = Color.DodgerBlue;
     
    111111
    112112    protected override void SetEnabledStateOfControls() {
    113       base.SetEnabledStateOfControls();     
    114 
    115       bool locked = Content == null || Locked || ReadOnly;     
     113      base.SetEnabledStateOfControls();
     114
     115      bool locked = Content == null || Locked || ReadOnly;
    116116      bool parentOwner = selectedProject != null && HiveAdminClient.Instance.CheckOwnershipOfParentProject(selectedProject, UserInformation.Instance.User.Id);
    117       bool selectedProjectDisabled = selectedProject == null 
     117      bool selectedProjectDisabled = selectedProject == null
    118118                                     || selectedProject != null && selectedProject.Id == Guid.Empty;
    119119
     
    183183      if (InvokeRequired) Invoke((Action<object, EventArgs>)HiveAdminClient_Instance_Refreshing, sender, e);
    184184      else {
    185         var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
    186         mainForm.AddOperationProgressToView(this, "Refreshing ...");
     185        Progress.ShowMarquee(this, "Refreshing ...");
    187186        SetEnabledStateOfControls();
    188187      }
     
    192191      if (InvokeRequired) Invoke((Action<object, EventArgs>)HiveAdminClient_Instance_Refreshed, sender, e);
    193192      else {
    194         var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
    195         mainForm.RemoveOperationProgressFromView(this);
     193        Progress.Hide(this);
    196194        SetEnabledStateOfControls();
    197195      }
     
    201199      if (InvokeRequired) Invoke((Action<object, EventArgs>)AccessClient_Instance_Refreshing, sender, e);
    202200      else {
    203         var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
    204         mainForm.AddOperationProgressToView(this, "Refreshing ...");
     201        Progress.ShowMarquee(this, "Refreshing ...");
    205202        SetEnabledStateOfControls();
    206203      }
     
    210207      if (InvokeRequired) Invoke((Action<object, EventArgs>)AccessClient_Instance_Refreshed, sender, e);
    211208      else {
    212         var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
    213         mainForm.RemoveOperationProgressFromView(this);
     209        Progress.Hide(this);
    214210        SetEnabledStateOfControls();
    215211      }
     
    234230    }
    235231
    236     private void addButton_Click(object sender, EventArgs e) {     
     232    private void addButton_Click(object sender, EventArgs e) {
    237233
    238234      if (selectedProject == null && !IsAdmin()) {
     
    244240        return;
    245241      }
    246      
     242
    247243      if (selectedProject != null && selectedProject.Id == Guid.Empty) {
    248244        MessageBox.Show(
     
    256252      var project = new Project {
    257253        Name = "New Project",
    258         OwnerUserId = UserInformation.Instance.User.Id,       
     254        OwnerUserId = UserInformation.Instance.User.Id,
    259255      };
    260       if(selectedProject != null) {
     256      if (selectedProject != null) {
    261257        project.ParentProjectId = selectedProject.Id;
    262258        project.EndDate = selectedProject.EndDate;
     
    285281        await SecurityExceptionUtil.TryAsyncAndReportSecurityExceptions(
    286282          action: () => {
    287             RemoveProject(selectedProject); 
     283            RemoveProject(selectedProject);
    288284          });
    289285      }
     
    304300          foreach (var project in projectsToSave)
    305301            project.Store();
    306          
     302
    307303          UpdateProjects();
    308304        },
     
    316312      if (node == null) return;
    317313      var p = (Project)node.Tag;
    318       if(!HiveAdminClient.Instance.DisabledParentProjects.Contains(p)) ChangeSelectedProjectNode(node);
     314      if (!HiveAdminClient.Instance.DisabledParentProjects.Contains(p)) ChangeSelectedProjectNode(node);
    319315    }
    320316
     
    357353      if (targetNode == null) {
    358354        treeView.Nodes.Add(sourceNode);
    359       } else if(targetProject.Id != Guid.Empty) {
     355      } else if (targetProject.Id != Guid.Empty) {
    360356        targetNode.Nodes.Add(sourceNode);
    361357        sourceProject.ParentProjectId = targetProject.Id;
     
    422418        var newNode = new TreeNode(newProject.Name) { Tag = newProject };
    423419        StyleTreeNode(newNode, newProject);
    424      
     420
    425421        if (selectedProject == null && !disabledParentProjects.Contains(newProject)) {
    426422          SelectedProject = newProject;
     
    533529        if (project.Id != Guid.Empty) {
    534530          SelectedProject = HiveAdminClient.Instance.GetAvailableProjectAncestors(project.Id).LastOrDefault();
    535           HiveAdminClient.Delete(project);         
     531          HiveAdminClient.Delete(project);
    536532          UpdateProjects();
    537         } else {         
     533        } else {
    538534          SelectedProject = Content.FirstOrDefault(x => x.Id == project.ParentProjectId);
    539535          Content.Remove(project);
  • branches/2845_EnhancedProgress/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.cs

    r16311 r16312  
    185185      if (InvokeRequired) Invoke((Action<object, EventArgs>)HiveAdminClient_Instance_Refreshing, sender, e);
    186186      else {
    187         var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
    188         mainForm.AddOperationProgressToView(this, "Refreshing ...");
     187        Progress.ShowMarquee(this, "Refreshing ...");
    189188        SetEnabledStateOfControls();
    190189      }
     
    194193      if (InvokeRequired) Invoke((Action<object, EventArgs>)HiveAdminClient_Instance_Refreshed, sender, e);
    195194      else {
    196         var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
    197         mainForm.RemoveOperationProgressFromView(this);
     195        Progress.Hide(this);
    198196        SetEnabledStateOfControls();
    199197      }
     
    203201      if (InvokeRequired) Invoke((Action<object, EventArgs>)AccessClient_Instance_Refreshing, sender, e);
    204202      else {
    205         var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
    206         mainForm.AddOperationProgressToView(this, "Refreshing ...");
     203        Progress.ShowMarquee(this, "Refreshing ...");
    207204        SetEnabledStateOfControls();
    208205      }
     
    212209      if (InvokeRequired) Invoke((Action<object, EventArgs>)AccessClient_Instance_Refreshed, sender, e);
    213210      else {
    214         var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
    215         mainForm.RemoveOperationProgressFromView(this);
     211        Progress.Hide(this);
    216212        SetEnabledStateOfControls();
    217213      }
     
    247243    }
    248244
    249     private async void btnRemoveGroup_Click(object sender, EventArgs e) {     
     245    private async void btnRemoveGroup_Click(object sender, EventArgs e) {
    250246      var nodes = GetCheckedNodes(treeView.Nodes).ToList();
    251247      var checkedResources = nodes.Select(x => x.Tag).OfType<Resource>().ToList();
     
    574570          foreach (var nr in newResources) Content.Remove(nr);
    575571
    576           HiveAdminClient.Delete(resource);         
     572          HiveAdminClient.Delete(resource);
    577573          UpdateResources();
    578574        } else {
     
    588584      if (resources == null || !resources.Any()) return;
    589585
    590       var ids = resources.Select(x => x.Id).ToList();     
     586      var ids = resources.Select(x => x.Id).ToList();
    591587      try {
    592588        bool update = false;
    593         foreach (var r in resources) {         
    594           if (r.Id != Guid.Empty)  {
    595             if(r.Id == SelectedResource.Id)
     589        foreach (var r in resources) {
     590          if (r.Id != Guid.Empty) {
     591            if (r.Id == SelectedResource.Id)
    596592              SelectedResource = HiveAdminClient.Instance.GetAvailableResourceAncestors(r.Id).LastOrDefault();
    597593
     
    751747
    752748      foreach (var r in resources) {
    753         if(!resourceDescendants.ContainsKey(r.Id))
     749        if (!resourceDescendants.ContainsKey(r.Id))
    754750          resourceDescendants.Add(r.Id, new HashSet<Resource>());
    755751      }
  • branches/2845_EnhancedProgress/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelectorDialog.cs

    r16311 r16312  
    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.ShowMarquee(this, "Refreshing");
    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.Hide(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 {
  • branches/2845_EnhancedProgress/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobListView.cs

    r16311 r16312  
    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        }
     
    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;
  • branches/2845_EnhancedProgress/HeuristicLab.Clients.Hive/3.3/HiveClient.cs

    r16311 r16312  
    469469
    470470      try {
    471         refreshableJob.Progress.Start("Saving Job...");
     471        refreshableJob.Progress.StartMarquee("Saving Job...");
    472472        HiveClient.StoreAsync(new Action<Exception>((Exception ex) => {
    473473          throw new Exception("Update failed.", ex);
  • branches/2845_EnhancedProgress/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionVariableImpactsView.cs

    r16311 r16312  
    128128
    129129      variableImactsArrayView.Caption = Content.Name + " Variable Impacts";
    130       var progress = Progress.ShowMarquee(this, "Calculating variable impacts for " + Content.Name);
     130      var progress = Progress.Show(this, "Calculating variable impacts for " + Content.Name);
    131131      cancellationToken = new CancellationTokenSource();
    132132      //Remember the original ordering of the variables
Note: See TracChangeset for help on using the changeset viewer.