Changeset 17062


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

#2845: Merged 16430 into stable.

Location:
stable
Files:
1 deleted
118 edited
1 copied

Legend:

Unmodified
Added
Removed
  • stable

  • stable/.editorconfig

  • stable/HeuristicLab.Algorithms.ALPS

  • stable/HeuristicLab.Algorithms.Benchmarks/3.3/BenchmarkAlgorithm.cs

    r15584 r17062  
    3939  [Creatable(CreatableAttribute.Categories.TestingAndAnalysis, Priority = 130)]
    4040  [StorableClass]
    41   public sealed class BenchmarkAlgorithm : IAlgorithm {
     41  public sealed class BenchmarkAlgorithm : IAlgorithm, IStorableContent {
    4242    private CancellationTokenSource cancellationTokenSource;
     43
     44    public string Filename { get; set; }
    4345
    4446    public string ItemName {
  • stable/HeuristicLab.Algorithms.DataAnalysis

  • stable/HeuristicLab.Algorithms.DataAnalysis.Views

  • stable/HeuristicLab.Algorithms.DataAnalysis/3.4

  • stable/HeuristicLab.Algorithms.MOCMAEvolutionStrategy

  • stable/HeuristicLab.Analysis

  • stable/HeuristicLab.Analysis.Statistics.Views/3.3/ChartAnalysisView.cs

    r15584 r17062  
    173173
    174174    private void addLineToChart_Click(object sender, EventArgs e) {
    175       MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, "Adding fitted lines to charts...");
     175      Progress.Show(this, "Adding fitted lines to charts...", ProgressMode.Indeterminate);
    176176
    177177      string resultName = (string)dataTableComboBox.SelectedItem;
     
    181181
    182182      task.ContinueWith((t) => {
    183         MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this);
     183        Progress.Hide(this);
    184184        ErrorHandling.ShowErrorDialog("An error occured while adding lines to charts. ", t.Exception);
    185185      }, TaskContinuationOptions.OnlyOnFaulted);
    186186
    187187      task.ContinueWith((t) => {
    188         MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this);
     188        Progress.Hide(this);
    189189      }, TaskContinuationOptions.OnlyOnRanToCompletion);
    190190    }
     
    273273      var task = Task.Factory.StartNew(() => {
    274274        sem.Wait();
    275         progress = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, "Calculating values...");
     275        progress = Progress.Show(this, "Calculating values...");
    276276        RebuildDataTable(resultName, rowName);
    277277      });
    278278
    279279      task.ContinueWith((t) => {
    280         MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this);
     280        Progress.Hide(this);
    281281        ErrorHandling.ShowErrorDialog("An error occured while calculating values. ", t.Exception);
    282282        sem.Release();
     
    284284
    285285      task.ContinueWith((t) => {
    286         MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this);
     286        Progress.Hide(this);
    287287        sem.Release();
    288288      }, TaskContinuationOptions.OnlyOnRanToCompletion);
  • stable/HeuristicLab.Analysis.Statistics.Views/3.3/StatisticalTestsView.cs

    r15584 r17062  
    356356
    357357      if (data != null && data.All(x => x != null)) {
    358         MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>()
    359           .AddOperationProgressToView(this, "Calculating...");
     358        Progress.Show(this, "Calculating...", ProgressMode.Indeterminate);
    360359
    361360        string curItem = (string)groupCompComboBox.SelectedItem;
     
    369368      CalculatePairwiseTest(groupName);
    370369
    371       MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this);
     370      Progress.Hide(this);
    372371    }
    373372
     
    377376        return;
    378377
    379       MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().AddOperationProgressToView(pairwiseTestGroupBox, "Calculating...");
     378      Progress.ShowOnControl(pairwiseTestGroupBox, "Calculating...", ProgressMode.Indeterminate);
    380379      Task.Factory.StartNew(() => CalculatePairwiseAsync(groupName));
    381380    }
     
    384383      CalculatePairwiseTest(groupName);
    385384
    386       MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(pairwiseTestGroupBox);
     385      Progress.HideFromControl(pairwiseTestGroupBox);
    387386    }
    388387
  • stable/HeuristicLab.Analysis.Views

  • stable/HeuristicLab.Clients.Access

  • stable/HeuristicLab.Clients.Access.Administration

  • stable/HeuristicLab.Clients.Access.Views

  • stable/HeuristicLab.Clients.Access.Views/3.3/ClientViews/ClientView.cs

    r15584 r17062  
    7777    public void StartProgressView() {
    7878      var message = "Downloading client information. Please be patient.";
    79       MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, message);
     79      Progress.Show(this, message, ProgressMode.Indeterminate);
    8080    }
    8181
    8282    public void FinishProgressView() {
    83       MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this);
     83      Progress.Hide(this);
    8484    }
    8585  }
  • stable/HeuristicLab.Clients.Common

  • stable/HeuristicLab.Clients.Hive

  • stable/HeuristicLab.Clients.Hive.Administrator

  • stable/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectJobsView.cs

    r17059 r17062  
    7575      progress = new Progress();
    7676
    77       removeButton.Enabled = false;     
     77      removeButton.Enabled = false;
    7878    }
    7979
     
    8181      base.RegisterContentEvents();
    8282      matrixView.DataGridView.SelectionChanged += DataGridView_SelectionChanged;
    83       MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, progress);
     83      MainForm.Progress.Show(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      MainForm.Progress.Hide(this, false);
    8989      base.DeregisterContentEvents();
    9090    }
     
    114114        var jobs = GetSelectedJobs().ToList();
    115115        if (jobs.Any()) {
    116                    
     116
    117117          startButton.Enabled = jobs.All(x =>
    118118            !x.IsProgressing && HiveAdminClient.Instance.Tasks.ContainsKey(x.Id) && HiveAdminClient.Instance.Tasks[x.Id].Count > 0
     
    135135    #region Event Handlers
    136136    private void ProjectJobsView_Load(object sender, EventArgs e) {
    137      
     137
    138138    }
    139139
    140140    private void refreshButton_Click(object sender, EventArgs e) {
    141       progress.Start("Refreshing jobs...");
     141      progress.Start("Refreshing jobs...", ProgressMode.Indeterminate);
    142142      SetEnabledStateOfControls();
    143143      var task = System.Threading.Tasks.Task.Factory.StartNew(RefreshJobsAsync);
    144144
    145145      task.ContinueWith((t) => {
    146         progress.Finish();       
     146        progress.Finish();
    147147        SetEnabledStateOfControls();
    148148      });
     
    160160
    161161        if (result == DialogResult.Yes) {
    162           progress.Start("Removing job(s)...");
     162          progress.Start("Removing job(s)...", ProgressMode.Indeterminate);
    163163          SetEnabledStateOfControls();
    164164          var task = System.Threading.Tasks.Task.Factory.StartNew(RemoveJobsAsync, jobs);
     
    191191
    192192        if (result == DialogResult.Yes) {
    193           progress.Start("Resuming job(s)...");
     193          progress.Start("Resuming job(s)...", ProgressMode.Indeterminate);
    194194          SetEnabledStateOfControls();
    195195          var task = System.Threading.Tasks.Task.Factory.StartNew(ResumeJobsAsync, jobs);
    196196
    197197          task.ContinueWith((t) => {
    198             RefreshJobs();           
     198            RefreshJobs();
    199199            progress.Finish();
    200200            SetEnabledStateOfControls();
     
    227227
    228228          task.ContinueWith((t) => {
    229             RefreshJobs();           
     229            RefreshJobs();
    230230            progress.Finish();
    231231            SetEnabledStateOfControls();
     
    253253
    254254        if (result == DialogResult.Yes) {
    255           progress.Start("Stopping job(s)...");
     255          progress.Start("Stopping job(s)...", ProgressMode.Indeterminate);
    256256          SetEnabledStateOfControls();
    257257          var task = System.Threading.Tasks.Task.Factory.StartNew(StopJobsAsync, jobs);
     
    267267            progress.Finish();
    268268            SetEnabledStateOfControls();
    269             MessageBox.Show("An error occured stopping the job(s).", "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error);           
     269            MessageBox.Show("An error occured stopping the job(s).", "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error);
    270270          }, TaskContinuationOptions.OnlyOnFaulted);
    271271        }
     
    284284    private IEnumerable<RefreshableJob> GetSelectedJobs() {
    285285      if (Content == null || matrixView.DataGridView.SelectedRows == null || matrixView.DataGridView.SelectedRows.Count == 0)
    286         return Enumerable.Empty<RefreshableJob>() ;
     286        return Enumerable.Empty<RefreshableJob>();
    287287
    288288      var jobs = new List<RefreshableJob>();
    289289      foreach (DataGridViewRow r in matrixView.DataGridView.SelectedRows) {
    290290        if (((string)r.Cells[0].Value) == JobState.Online.ToString()) {
    291           jobs.Add(HiveAdminClient.Instance.Jobs[Content.Id].FirstOrDefault(x => x.Id == Guid.Parse((string) r.Cells[11].Value)));
     291          jobs.Add(HiveAdminClient.Instance.Jobs[Content.Id].FirstOrDefault(x => x.Id == Guid.Parse((string)r.Cells[11].Value)));
    292292        }
    293293      }
     
    310310      string[,] values = new string[jobs.Count, 13];
    311311
    312       for(int i = 0; i < jobs.Count; i++) {
    313         var job = jobs.ElementAt(i);       
     312      for (int i = 0; i < jobs.Count; i++) {
     313        var job = jobs.ElementAt(i);
    314314        values[i, 0] = job.Job.State.ToString();
    315315        values[i, 1] = job.ExecutionState.ToString();
     
    322322        values[i, 8] = job.Job.CalculatingCount.ToString();
    323323        values[i, 9] = job.Job.FinishedCount.ToString();
    324         values[i, 10] = job.Job.Description;       
     324        values[i, 10] = job.Job.Description;
    325325        values[i, 11] = job.Job.Id.ToString();
    326326        values[i, 12] = job.Job.OwnerUserId.ToString();
    327327      }
    328      
     328
    329329      var matrix = new StringMatrix(values);
    330330      matrix.ColumnNames = new string[] { JOB_STATE, JOB_EXECUTIONSTATE, JOB_EXECUTIONTIME, JOB_DATECREATED, JOB_OWNER, JOB_NAME, JOB_TASKCOUNT, JOB_WAITINGTASKCOUNT, JOB_CALCULATINGTASKCOUNT, JOB_FINISHEDTASKCOUNT, JOB_DESCRIPTION, JOB_ID, JOB_OWNERID };
     
    332332      return matrix;
    333333    }
    334    
     334
    335335    private void UpdateJobs() {
    336336      if (InvokeRequired) Invoke((Action)UpdateJobs);
    337337      else {
    338         if(Content != null && Content.Id != null && Content.Id != Guid.Empty) {
     338        if (Content != null && Content.Id != null && Content.Id != Guid.Empty) {
    339339          var matrix = CreateValueMatrix();
    340340          matrixView.Content = matrix;
    341           if(matrix != null) {
     341          if (matrix != null) {
    342342            foreach (DataGridViewRow row in matrixView.DataGridView.Rows) {
    343343              string val = ((string)row.Cells[0].Value);
     
    355355            matrixView.DataGridView.Columns[1].MinimumWidth = 108;
    356356          }
    357         } 
     357        }
    358358      }
    359359    }
     
    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      }
     
    381381
    382382    private void StopJobsAsync(object jobs) {
    383       var jobList = (IEnumerable<RefreshableJob>) jobs;
    384       foreach (var job in jobList) {       
    385         progress.Status = "Stopping job \"" + job.Job.Name + "\"...";
     383      var jobList = (IEnumerable<RefreshableJob>)jobs;
     384      foreach (var job in jobList) {
     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.Start("", ProgressMode.Indeterminate);
    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      }
  • stable/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectView.cs

    r17060 r17062  
    126126      bool enabled = Content != null && !Locked && !ReadOnly;
    127127      nameTextBox.Enabled = enabled;
    128       descriptionTextBox.Enabled = enabled;     
     128      descriptionTextBox.Enabled = enabled;
    129129      ownerComboBox.Enabled = enabled;
    130130      createdTextBox.Enabled = enabled;
     
    160160      if (InvokeRequired) Invoke((Action<object, EventArgs>)AccessClient_Instance_Refreshing, sender, e);
    161161      else {
    162         var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
    163         mainForm.AddOperationProgressToView(this, "Refreshing ...");
     162        Progress.Show(this, "Refreshing ...", ProgressMode.Indeterminate);
    164163        SetEnabledStateOfControls();
    165164      }
     
    169168      if (InvokeRequired) Invoke((Action<object, EventArgs>)AccessClient_Instance_Refreshed, sender, e);
    170169      else {
    171         var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
    172         mainForm.RemoveOperationProgressFromView(this);
     170        Progress.Hide(this);
    173171        SetEnabledStateOfControls();
    174172      }
  • stable/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectsView.cs

    r17059 r17062  
    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.Show(this, "Refreshing ...", ProgressMode.Indeterminate);
    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.Show(this, "Refreshing ...", ProgressMode.Indeterminate);
    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);
  • stable/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.cs

    r17059 r17062  
    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.Show(this, "Refreshing ...", ProgressMode.Indeterminate);
    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.Show(this, "Refreshing ...", ProgressMode.Indeterminate);
    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      }
  • 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;
  • stable/HeuristicLab.Clients.Hive.Slave

  • stable/HeuristicLab.Clients.Hive.Slave.WindowsService

  • stable/HeuristicLab.Clients.Hive.Views

  • stable/HeuristicLab.Clients.Hive.Views/3.3/HiveTasks/OptimizerHiveTaskView.cs

    r15584 r17062  
    4646    protected override void Job_ItemChanged(object sender, EventArgs e) {
    4747      if (Content != null && Content.Task != null && Content.ItemTask.Item != null) {
    48         Content.ExecuteReadActionOnItemTask(new Action(delegate() {
     48        Content.ExecuteReadActionOnItemTask(new Action(delegate () {
    4949          runCollectionViewHost.Content = Content.ItemTask.Item.Runs;
    5050        }));
     
    5858      base.RegisterContentEvents();
    5959      Content.IsControllableChanged += new EventHandler(Content_IsControllableChanged);
    60       MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, Content.Progress);
     60      Progress.Show(this, Content.Progress);
    6161    }
    6262
    6363    protected override void DeregisterContentEvents() {
    6464      Content.IsControllableChanged -= new EventHandler(Content_IsControllableChanged);
    65       MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this, false);
     65      Progress.Hide(this, false);
    6666      base.DeregisterContentEvents();
    6767    }
     
    9999
    100100    private void PauseTaskAsync() {
    101       Content.Progress.Start("Pausing task. Please be patient for the command to take effect.");
     101      Content.Progress.Start("Pausing task. Please be patient for the command to take effect.", ProgressMode.Indeterminate);
    102102      Content.Pause();
    103103      Content.Progress.Finish();
     
    105105
    106106    private void StopTaskAsync() {
    107       Content.Progress.Start("Stopping task. Please be patient for the command to take effect.");
     107      Content.Progress.Start("Stopping task. Please be patient for the command to take effect.", ProgressMode.Indeterminate);
    108108      Content.Stop();
    109109      Content.Progress.Finish();
     
    111111
    112112    private void ResumeTaskAsync() {
    113       Content.Progress.Start("Resuming task. Please be patient for the command to take effect.");
     113      Content.Progress.Start("Resuming task. Please be patient for the command to take effect.", ProgressMode.Indeterminate);
    114114      Content.Restart();
    115115      Content.Progress.Finish();
  • stable/HeuristicLab.Clients.Hive/3.3/HeuristicLab.Clients.Hive-3.3.csproj

    r17059 r17062  
    236236      <Private>False</Private>
    237237    </ProjectReference>
     238    <ProjectReference Include="..\..\HeuristicLab.MainForm.WindowsForms\3.3\HeuristicLab.MainForm.WindowsForms-3.3.csproj">
     239      <Project>{AB687BBE-1BFE-476B-906D-44237135431D}</Project>
     240      <Name>HeuristicLab.MainForm.WindowsForms-3.3</Name>
     241      <Private>False</Private>
     242    </ProjectReference>
    238243    <ProjectReference Include="..\..\HeuristicLab.MainForm\3.3\HeuristicLab.MainForm-3.3.csproj">
    239244      <Project>{3BD61258-31DA-4B09-89C0-4F71FEF5F05A}</Project>
  • stable/HeuristicLab.Clients.Hive/3.3/HiveClient.cs

    r17059 r17062  
    167167        RefreshDisabledParentProjects();
    168168        RefreshDisabledParentResources();
    169       }
    170       catch {
     169      } catch {
    171170        jobs = null;
    172171        projects = null;
    173172        resources = null;
    174173        throw;
    175       }
    176       finally {
     174      } finally {
    177175        OnRefreshed();
    178176      }
     
    215213
    216214    public void RefreshAsync(Action<Exception> exceptionCallback) {
    217       var call = new Func<Exception>(delegate() {
     215      var call = new Func<Exception>(delegate () {
    218216        try {
    219217          Refresh();
    220         }
    221         catch (Exception ex) {
     218        } catch (Exception ex) {
    222219          return ex;
    223220        }
    224221        return null;
    225222      });
    226       call.BeginInvoke(delegate(IAsyncResult result) {
     223      call.BeginInvoke(delegate (IAsyncResult result) {
    227224        Exception ex = call.EndInvoke(result);
    228225        if (ex != null) exceptionCallback(ex);
     
    244241      resourceAncestors.Keys.ToList().ForEach(k => resourceDescendants.Add(k, new HashSet<Guid>()));
    245242      foreach (var ra in resourceAncestors) {
    246         foreach(var ancestor in ra.Value) {
     243        foreach (var ancestor in ra.Value) {
    247244          resourceDescendants[ancestor].Add(ra.Key);
    248245        }
     
    263260      // build project descendant list
    264261      projectAncestors.Keys.ToList().ForEach(k => projectDescendants.Add(k, new HashSet<Guid>()));
    265       foreach(var pa in projectAncestors) {
    266         foreach(var ancestor in pa.Value) {
     262      foreach (var pa in projectAncestors) {
     263        foreach (var ancestor in pa.Value) {
    267264          projectDescendants[ancestor].Add(pa.Key);
    268265        }
     
    362359    }
    363360    public static void StoreAsync(Action<Exception> exceptionCallback, IHiveItem item, CancellationToken cancellationToken) {
    364       var call = new Func<Exception>(delegate() {
     361      var call = new Func<Exception>(delegate () {
    365362        try {
    366363          Store(item, cancellationToken);
    367         }
    368         catch (Exception ex) {
     364        } catch (Exception ex) {
    369365          return ex;
    370366        }
    371367        return null;
    372368      });
    373       call.BeginInvoke(delegate(IAsyncResult result) {
     369      call.BeginInvoke(delegate (IAsyncResult result) {
    374370        Exception ex = call.EndInvoke(result);
    375371        if (ex != null) exceptionCallback(ex);
     
    460456    public static void UpdateJob(Action<Exception> exceptionCallback, RefreshableJob refreshableJob, CancellationToken cancellationToken) {
    461457      refreshableJob.IsProgressing = true;
    462       refreshableJob.Progress.Status = "Saving Job...";
     458      refreshableJob.Progress.Message = "Saving Job...";
    463459      HiveClient.StoreAsync(
    464460        new Action<Exception>((Exception ex) => {
     
    473469
    474470      try {
    475         refreshableJob.Progress.Start("Saving Job...");
     471        refreshableJob.Progress.Start("Saving Job...", ProgressMode.Indeterminate);
    476472        HiveClient.StoreAsync(new Action<Exception>((Exception ex) => {
    477473          throw new Exception("Update failed.", ex);
     
    492488      try {
    493489        refreshableJob.IsProgressing = true;
    494         refreshableJob.Progress.Start("Connecting to server...");
     490        refreshableJob.Progress.Start("Connecting to server...", ProgressMode.Indeterminate);
    495491
    496492        foreach (OptimizerHiveTask hiveJob in refreshableJob.HiveTasks.OfType<OptimizerHiveTask>()) {
     
    499495
    500496        // upload Job
    501         refreshableJob.Progress.Status = "Uploading Job...";
     497        refreshableJob.Progress.Message = "Uploading Job...";
    502498        refreshableJob.Job.Id = HiveServiceLocator.Instance.CallHiveService((s) => s.AddJob(refreshableJob.Job, refreshableJob.Job.ResourceIds));
    503499        refreshableJob.Job = HiveServiceLocator.Instance.CallHiveService((s) => s.GetJob(refreshableJob.Job.Id)); // update owner and permissions
     
    509505
    510506        // upload plugins
    511         refreshableJob.Progress.Status = "Uploading plugins...";
     507        refreshableJob.Progress.Message = "Uploading plugins...";
    512508        this.OnlinePlugins = HiveServiceLocator.Instance.CallHiveService((s) => s.GetPlugins());
    513509        this.AlreadyUploadedPlugins = new List<Plugin>();
     
    517513
    518514        // upload tasks
    519         refreshableJob.Progress.Status = "Uploading tasks...";
     515        refreshableJob.Progress.Message = "Uploading tasks...";
     516        refreshableJob.Progress.ProgressMode = ProgressMode.Determinate;
     517        refreshableJob.Progress.ProgressValue = 0;
    520518
    521519        var tasks = new List<TS.Task>();
     
    528526        }
    529527        TS.Task.WaitAll(tasks.ToArray());
    530       }
    531       finally {
     528      } finally {
    532529        refreshableJob.Job.Modified = false;
    533530        refreshableJob.IsProgressing = false;
     
    615612        lock (jobCountLocker) {
    616613          progress.ProgressValue = (double)taskCount[0] / totalJobCount;
    617           progress.Status = string.Format("Uploaded task ({0} of {1})", taskCount[0], totalJobCount);
     614          progress.Message = string.Format("Uploaded task ({0} of {1})", taskCount[0], totalJobCount);
    618615        }
    619616
     
    646643
    647644        // fetch all task objects to create the full tree of tree of HiveTask objects
    648         refreshableJob.Progress.Start("Downloading list of tasks...");
     645        refreshableJob.Progress.Start("Downloading list of tasks...", ProgressMode.Indeterminate);
    649646        allTasks = HiveServiceLocator.Instance.CallHiveService(s => s.GetLightweightJobTasksWithoutStateLog(hiveExperiment.Id));
    650647        totalJobCount = allTasks.Count();
    651648
    652         refreshableJob.Progress.Status = "Downloading tasks...";
     649        refreshableJob.Progress.Message = "Downloading tasks...";
     650        refreshableJob.Progress.ProgressMode = ProgressMode.Determinate;
     651        refreshableJob.Progress.ProgressValue = 0.0;
    653652        downloader = new TaskDownloader(allTasks.Select(x => x.Id));
    654653        downloader.StartAsync();
     
    656655        while (!downloader.IsFinished) {
    657656          refreshableJob.Progress.ProgressValue = downloader.FinishedCount / (double)totalJobCount;
    658           refreshableJob.Progress.Status = string.Format("Downloading/deserializing tasks... ({0}/{1} finished)", downloader.FinishedCount, totalJobCount);
     657          refreshableJob.Progress.Message = string.Format("Downloading/deserializing tasks... ({0}/{1} finished)", downloader.FinishedCount, totalJobCount);
    659658          Thread.Sleep(500);
    660659
     
    666665        var parents = allHiveTasks.Values.Where(x => !x.Task.ParentTaskId.HasValue);
    667666
    668         refreshableJob.Progress.Status = "Downloading/deserializing complete. Displaying tasks...";
     667        refreshableJob.Progress.Message = "Downloading/deserializing complete. Displaying tasks...";
     668        refreshableJob.Progress.ProgressMode = ProgressMode.Indeterminate;
     669
    669670        // build child-task tree
    670671        foreach (HiveTask hiveTask in parents) {
     
    677678        } else if (refreshableJob.IsPaused()) {
    678679          refreshableJob.ExecutionState = Core.ExecutionState.Paused;
    679         } else { 
     680        } else {
    680681          refreshableJob.ExecutionState = Core.ExecutionState.Started;
    681682        }
    682683        refreshableJob.OnLoaded();
    683       }
    684       finally {
     684      } finally {
    685685        refreshableJob.IsProgressing = false;
    686686        refreshableJob.Progress.Finish();
     
    719719      try {
    720720        return PersistenceUtil.Deserialize<ItemTask>(taskData.Data);
    721       }
    722       catch {
     721      } catch {
    723722        return null;
    724723      }
     
    731730    public static void TryAndRepeat(Action action, int repetitions, string errorMessage, ILog log = null) {
    732731      while (true) {
    733         try { action(); return; }
    734         catch (Exception e) {
     732        try { action(); return; } catch (Exception e) {
    735733          if (repetitions == 0) throw new HiveException(errorMessage, e);
    736734          if (log != null) log.LogMessage(string.Format("{0}: {1} - will try again!", errorMessage, e.ToString()));
  • stable/HeuristicLab.Clients.Hive/3.3/Plugin.cs.frame

    r17059 r17062  
    3737  [PluginDependency("HeuristicLab.Hive", "3.3")] 
    3838  [PluginDependency("HeuristicLab.MainForm", "3.3")]
     39  [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")]
    3940  [PluginDependency("HeuristicLab.Optimization", "3.3")]
    4041  [PluginDependency("HeuristicLab.Persistence", "3.3")]
  • stable/HeuristicLab.Clients.OKB.Views

  • stable/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views/OKBExperimentUploadView.cs

    r15584 r17062  
    188188      if (InvokeRequired) { Invoke((Action<object, EventArgs>)RunCreationClient_Refreshing, sender, e); return; }
    189189      var message = "Refreshing algorithms and problems...";
    190       MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, message);
     190      Progress.Show(this, message, ProgressMode.Indeterminate);
    191191      refreshing = true;
    192192      SetEnabledStateOfControls();
     
    195195    private void RunCreationClient_Refreshed(object sender, EventArgs e) {
    196196      if (InvokeRequired) { Invoke((Action<object, EventArgs>)RunCreationClient_Refreshed, sender, e); return; }
    197       MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this);
     197      Progress.Hide(this);
    198198      refreshing = false;
    199199      SetEnabledStateOfControls();
     
    203203      var task = System.Threading.Tasks.Task.Factory.StartNew(UploadAsync);
    204204      task.ContinueWith((t) => {
    205         MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this);
     205        Progress.Hide(this);
    206206        PluginInfrastructure.ErrorHandling.ShowErrorDialog("An exception occured while uploading the runs to the OKB.", t.Exception);
    207207      }, TaskContinuationOptions.OnlyOnFaulted);
     
    210210    private void UploadAsync() {
    211211      var message = "Uploading runs to OKB...";
    212       IProgress progress = MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, message);
     212      IProgress progress = Progress.Show(this, message);
    213213      double count = dataGridView.Rows.Count;
    214214      int i = 0;
     
    226226        progress.ProgressValue = ((double)i) / count;
    227227      }
    228       MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this);
     228      Progress.Hide(this);
    229229      ClearRuns();
    230230    }
  • stable/HeuristicLab.Core

  • stable/HeuristicLab.Core.Views

  • stable/HeuristicLab.Core.Views/3.3/TypeSelector.cs

  • stable/HeuristicLab.Data

  • stable/HeuristicLab.Data.Views

  • stable/HeuristicLab.Data.Views/3.3

  • stable/HeuristicLab.Data/3.3

  • stable/HeuristicLab.DataPreprocessing

  • stable/HeuristicLab.DataPreprocessing.Views

  • stable/HeuristicLab.DataPreprocessing.Views/3.4/DataPreprocessingView.cs

    r15584 r17062  
    165165        await Task.Run(() => {
    166166          TProblemData instance;
    167           var mainForm = (MainForm.WindowsForms.MainForm)MainFormManager.MainForm;
    168167          // lock active view and show progress bar
    169           var activeView = (IContentView)MainFormManager.MainForm.ActiveView;
    170168
    171169          try {
    172             var progress = mainForm.AddOperationProgressToContent(activeView.Content, "Loading problem instance.");
    173 
     170            var progress = Progress.Show(Content, "Loading problem instance.");
    174171            instanceProvider.ProgressChanged += (o, args) => { progress.ProgressValue = args.ProgressPercentage / 100.0; };
    175172
     
    177174          } catch (IOException ex) {
    178175            MessageBox.Show(string.Format("There was an error parsing the file: {0}", Environment.NewLine + ex.Message), "Error while parsing", MessageBoxButtons.OK, MessageBoxIcon.Error);
    179             mainForm.RemoveOperationProgressFromContent(activeView.Content);
     176            Progress.Hide(Content);
    180177            return;
    181178          }
     
    185182            MessageBox.Show(string.Format("This problem does not support loading the instance {0}: {1}", Path.GetFileName(importDialog.Path), Environment.NewLine + ex.Message), "Cannot load instance");
    186183          } finally {
    187             mainForm.RemoveOperationProgressFromContent(activeView.Content);
     184            Progress.Hide(Content);
    188185          }
    189186        });
     
    222219          var storable = itemCreator() as IStorableContent;
    223220          if (storable != null) {
    224             var mainForm = (MainForm.WindowsForms.MainForm)MainFormManager.MainForm;
    225             var activeView = (IContentView)MainFormManager.MainForm.ActiveView;
    226221            try {
    227               mainForm.AddOperationProgressToContent(activeView.Content, "Exporting data.");
     222              Progress.Show(Content, "Exporting data.", ProgressMode.Indeterminate);
    228223              ContentManager.Save(storable, saveFileDialog.FileName, compressed);
    229224            } finally {
    230               mainForm.RemoveOperationProgressFromContent(activeView.Content);
     225              Progress.Hide(Content);
    231226            }
    232227          }
     
    244239      if (saveFileDialog.ShowDialog() == DialogResult.OK) {
    245240        Task.Run(() => {
    246           var mainForm = (MainForm.WindowsForms.MainForm)MainFormManager.MainForm;
    247           var activeView = (IContentView)MainFormManager.MainForm.ActiveView;
    248241          try {
    249242            var problemData = Content.CreateNewProblemData();
    250             mainForm.AddOperationProgressToContent(activeView.Content, "Exporting data.");
     243            Progress.Show(Content, "Exporting data.", ProgressMode.Indeterminate);
    251244            if (problemData is TimeSeriesPrognosisProblemData)
    252245              Export(new TimeSeriesPrognosisCSVInstanceProvider(), problemData, saveFileDialog.FileName);
     
    256249              Export(new ClassificationCSVInstanceProvider(), problemData, saveFileDialog.FileName);
    257250          } finally {
    258             mainForm.RemoveOperationProgressFromContent(activeView.Content);
     251            Progress.Hide(Content);
    259252          }
    260253        });
  • stable/HeuristicLab.DataPreprocessing/3.4

  • stable/HeuristicLab.Encodings.BinaryVectorEncoding

  • stable/HeuristicLab.Encodings.IntegerVectorEncoding

  • stable/HeuristicLab.Encodings.PermutationEncoding

  • stable/HeuristicLab.Encodings.RealVectorEncoding

  • stable/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding

  • stable/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views

  • stable/HeuristicLab.ExtLibs

  • stable/HeuristicLab.MainForm.WindowsForms/3.3/Controls/ProgressView.cs

    r15584 r17062  
    2525namespace HeuristicLab.MainForm.WindowsForms {
    2626  internal sealed partial class ProgressView : UserControl {
    27     private const int defaultControlHeight = 88;
    28     private const int collapsedControlHeight = 55;
    29 
    3027    private readonly Control control;
    3128    public Control Control {
     
    4037    public ProgressView(Control control, IProgress content)
    4138      : base() {
    42       if (control == null) throw new ArgumentNullException("control", "The control is null.");
    43       if (content == null) throw new ArgumentNullException("content", "The passed progress is null.");
     39      if (control == null) throw new ArgumentNullException("control");
     40      if (content == null) throw new ArgumentNullException("content");
    4441      InitializeComponent();
    4542
    4643      this.control = control;
    4744      this.content = content;
    48       if (content.ProgressState == ProgressState.Started)
     45
     46      if (content.ProgressState != ProgressState.Finished)
    4947        ShowProgress();
    5048      RegisterContentEvents();
    5149    }
    5250
    53     /// <summary>
    54     /// Clean up any resources being used.
    55     /// </summary>
    56     /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    5751    protected override void Dispose(bool disposing) {
    5852      DeregisterContentEvents();
     
    6660
    6761    private void RegisterContentEvents() {
    68       content.StatusChanged += new EventHandler(progress_StatusChanged);
    69       content.ProgressValueChanged += new EventHandler(progress_ProgressValueChanged);
    70       content.ProgressStateChanged += new EventHandler(Content_ProgressStateChanged);
    71       content.CanBeCanceledChanged += new EventHandler(Content_CanBeCanceledChanged);
     62      Content.ProgressStateChanged += new EventHandler(Content_ProgressStateChanged);
     63      Content.MessageChanged += new EventHandler(Content_MessageChanged);
     64      Content.ProgressBarModeChanged += new EventHandler(Content_ProgressBarModeChanged);
     65      Content.ProgressValueChanged += new EventHandler(Content_ProgressValueChanged);
     66      Content.CanBeStoppedChanged += new EventHandler(Content_CanBeStoppedChanged);
     67      Content.CanBeCanceledChanged += new EventHandler(Content_CanBeCanceledChanged);
    7268    }
    7369    private void DeregisterContentEvents() {
    74       content.StatusChanged -= new EventHandler(progress_StatusChanged);
    75       content.ProgressValueChanged -= new EventHandler(progress_ProgressValueChanged);
    76       content.ProgressStateChanged -= new EventHandler(Content_ProgressStateChanged);
    77       content.CanBeCanceledChanged -= new EventHandler(Content_CanBeCanceledChanged);
     70      Content.ProgressStateChanged -= new EventHandler(Content_ProgressStateChanged);
     71      Content.MessageChanged -= new EventHandler(Content_MessageChanged);
     72      Content.ProgressBarModeChanged -= new EventHandler(Content_ProgressBarModeChanged);
     73      Content.ProgressValueChanged -= new EventHandler(Content_ProgressValueChanged);
     74      Content.CanBeStoppedChanged -= new EventHandler(Content_CanBeStoppedChanged);
     75      Content.CanBeCanceledChanged -= new EventHandler(Content_CanBeCanceledChanged);
     76    }
     77
     78    private void Content_ProgressStateChanged(object sender, EventArgs e) {
     79      UpdateProgressState();
     80      UpdateButtonsState();
     81    }
     82
     83    private void Content_MessageChanged(object sender, EventArgs e) {
     84      UpdateProgressMessage();
     85    }
     86
     87    private void Content_ProgressBarModeChanged(object sender, EventArgs e) {
     88      UpdateProgressValue();
     89    }
     90    private void Content_ProgressValueChanged(object sender, EventArgs e) {
     91      UpdateProgressValue();
     92    }
     93
     94    private void Content_CanBeStoppedChanged(object sender, EventArgs e) {
     95      UpdateButtonsState();
     96    }
     97    private void Content_CanBeCanceledChanged(object sender, EventArgs e) {
     98      UpdateButtonsState();
    7899    }
    79100
     
    83104        return;
    84105      }
    85       int height = Content.CanBeCanceled ? Height : collapsedControlHeight;
     106      if (Parent != null) return;
    86107
    87108      Left = (Control.ClientRectangle.Width / 2) - (Width / 2);
    88       Top = (Control.ClientRectangle.Height / 2) - (height / 2);
     109      Top = (Control.ClientRectangle.Height / 2) - (Height / 2);
    89110      Anchor = AnchorStyles.None;
    90111
    91       control.Enabled = false;
     112      UpdateProgressMessage();
     113      UpdateProgressValue();
     114      UpdateButtonsState();
     115
     116      Control.Enabled = false;
    92117      Parent = Control.Parent;
    93118      BringToFront();
    94 
    95       UpdateProgressValue();
    96       UpdateProgressStatus();
    97       UpdateCancelButton();
    98119      Visible = true;
    99120    }
    100121
    101122    private void HideProgress() {
    102       if (InvokeRequired) Invoke((Action)HideProgress);
    103       else {
    104         control.Enabled = true;
    105         Parent = null;
    106         Visible = false;
     123      if (Control.InvokeRequired) {
     124        Control.Invoke((Action)HideProgress);
     125        return;
     126      }
     127      if (Parent == null) return;
     128
     129      Visible = false;
     130      Control.Enabled = true;
     131      Parent = null;
     132    }
     133
     134    private void UpdateProgressState() {
     135      if (Control.InvokeRequired) {
     136        Control.Invoke((Action)UpdateProgressState);
     137        return;
     138      }
     139
     140      if (Content.ProgressState != ProgressState.Finished)
     141        ShowProgress();
     142      else
     143        HideProgress();
     144    }
     145
     146    private void UpdateProgressMessage() {
     147      if (Control.InvokeRequired) {
     148        Control.Invoke((Action)UpdateProgressMessage);
     149        return;
     150      }
     151
     152      messageLabel.Text = content.Message;
     153    }
     154
     155    private void UpdateProgressValue() {
     156      if (InvokeRequired) {
     157        Invoke((Action)UpdateProgressValue);
     158        return;
     159      }
     160
     161      switch (Content.ProgressMode) {
     162        case ProgressMode.Determinate:
     163          progressBar.Style = ProgressBarStyle.Continuous;
     164          progressBar.Value = (int)Math.Round(progressBar.Minimum + content.ProgressValue * (progressBar.Maximum - progressBar.Minimum));
     165          break;
     166        case ProgressMode.Indeterminate:
     167          progressBar.Style = ProgressBarStyle.Marquee;
     168          progressBar.Value = 0;
     169          break;
     170        default:
     171          throw new NotImplementedException($"Invalid Progress Mode: {content.ProgressMode}");
    107172      }
    108173    }
    109174
    110     private void progress_StatusChanged(object sender, EventArgs e) {
    111       UpdateProgressStatus();
     175    private void UpdateButtonsState() {
     176      if (Control.InvokeRequired) {
     177        Control.Invoke((Action)UpdateButtonsState);
     178        return;
     179      }
     180
     181      stopButton.Visible = Content.CanBeStopped;
     182      stopButton.Enabled = Content.CanBeStopped && content.ProgressState == ProgressState.Started;
     183
     184      cancelButton.Visible = Content.CanBeCanceled;
     185      cancelButton.Enabled = Content.CanBeCanceled && content.ProgressState == ProgressState.Started;
    112186    }
    113187
    114     private void progress_ProgressValueChanged(object sender, EventArgs e) {
    115       UpdateProgressValue();
     188    private void stopButton_Click(object sender, EventArgs e) {
     189      Content.Stop();
    116190    }
    117 
    118     private void Content_ProgressStateChanged(object sender, EventArgs e) {
    119       switch (content.ProgressState) {
    120         case ProgressState.Finished: HideProgress(); break;
    121         case ProgressState.Canceled: HideProgress(); break;
    122         case ProgressState.Started: ShowProgress(); break;
    123         default: throw new NotSupportedException("The progress state " + content.ProgressState + " is not supported by the ProgressView.");
    124       }
    125     }
    126 
    127     private void Content_CanBeCanceledChanged(object sender, EventArgs e) {
    128       UpdateCancelButton();
    129     }
    130 
    131     private void UpdateCancelButton() {
    132       cancelButton.Visible = content != null && content.CanBeCanceled;
    133       cancelButton.Enabled = content != null && content.CanBeCanceled;
    134 
    135       if (content != null && content.CanBeCanceled) {
    136         Height = defaultControlHeight;
    137       } else if (content != null && !content.CanBeCanceled) {
    138         Height = collapsedControlHeight;
    139       }
    140     }
    141 
    142     private void UpdateProgressValue() {
    143       // prevent problems with object disposal and invoke as suggested by http://stackoverflow.com/a/18647091
    144       if (!IsHandleCreated) return;
    145       if (InvokeRequired) {
    146         try {
    147           Invoke((Action)UpdateProgressValue);
    148         }
    149         catch (InvalidOperationException) {
    150           // swallow ObjectDisposedException
    151           // which might occur if the invoke call is executed after or while the control is disposing
    152         }
    153       } else {
    154         if (content != null) {
    155           double progressValue = content.ProgressValue;
    156           if (progressValue <= 0.0 || progressValue > 1.0) {
    157             progressBar.Style = ProgressBarStyle.Marquee;
    158           } else {
    159             progressBar.Style = ProgressBarStyle.Blocks;
    160             progressBar.Value =
    161               (int)Math.Round(progressBar.Minimum + progressValue * (progressBar.Maximum - progressBar.Minimum));
    162           }
    163         }
    164       }
    165     }
    166 
    167     private void UpdateProgressStatus() {
    168       if (InvokeRequired) Invoke((Action)UpdateProgressStatus);
    169       else if (content != null)
    170         statusLabel.Text = content.Status;
    171     }
    172 
    173191    private void cancelButton_Click(object sender, EventArgs e) {
    174       content.Cancel();
     192      Content.Cancel();
    175193    }
    176194  }
  • stable/HeuristicLab.MainForm.WindowsForms/3.3/Controls/ProgressView.designer.cs

    r15584 r17062  
    2727    private System.ComponentModel.IContainer components = null;
    2828
    29    
     29
    3030    #region Component Designer generated code
    3131
     
    3636    private void InitializeComponent() {
    3737      this.progressBar = new System.Windows.Forms.ProgressBar();
    38       this.statusLabel = new System.Windows.Forms.Label();
     38      this.messageLabel = new System.Windows.Forms.Label();
     39      this.borderPanel = new System.Windows.Forms.Panel();
     40      this.panel = new System.Windows.Forms.Panel();
     41      this.stopButton = new System.Windows.Forms.Button();
    3942      this.cancelButton = new System.Windows.Forms.Button();
    40       this.panel = new System.Windows.Forms.Panel();
     43      this.borderPanel.SuspendLayout();
    4144      this.panel.SuspendLayout();
    4245      this.SuspendLayout();
     
    4851      this.progressBar.Location = new System.Drawing.Point(3, 3);
    4952      this.progressBar.Name = "progressBar";
    50       this.progressBar.Size = new System.Drawing.Size(352, 23);
     53      this.progressBar.Size = new System.Drawing.Size(366, 23);
    5154      this.progressBar.Style = System.Windows.Forms.ProgressBarStyle.Marquee;
    5255      this.progressBar.TabIndex = 0;
    5356      //
    54       // statusLabel
     57      // messageLabel
    5558      //
    56       this.statusLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     59      this.messageLabel.Dock = System.Windows.Forms.DockStyle.Fill;
     60      this.messageLabel.Location = new System.Drawing.Point(0, 0);
     61      this.messageLabel.Name = "messageLabel";
     62      this.messageLabel.Padding = new System.Windows.Forms.Padding(0, 0, 3, 0);
     63      this.messageLabel.Size = new System.Drawing.Size(217, 23);
     64      this.messageLabel.TabIndex = 1;
     65      this.messageLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
     66      //
     67      // borderPanel
     68      //
     69      this.borderPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     70            | System.Windows.Forms.AnchorStyles.Left)
    5771            | System.Windows.Forms.AnchorStyles.Right)));
    58       this.statusLabel.Location = new System.Drawing.Point(3, 33);
    59       this.statusLabel.Name = "statusLabel";
    60       this.statusLabel.Size = new System.Drawing.Size(352, 17);
    61       this.statusLabel.TabIndex = 1;
     72      this.borderPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
     73      this.borderPanel.Controls.Add(this.panel);
     74      this.borderPanel.Controls.Add(this.progressBar);
     75      this.borderPanel.Location = new System.Drawing.Point(0, 0);
     76      this.borderPanel.Name = "borderPanel";
     77      this.borderPanel.Size = new System.Drawing.Size(374, 62);
     78      this.borderPanel.TabIndex = 3;
     79      //
     80      // panel
     81      //
     82      this.panel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     83            | System.Windows.Forms.AnchorStyles.Right)));
     84      this.panel.Controls.Add(this.messageLabel);
     85      this.panel.Controls.Add(this.stopButton);
     86      this.panel.Controls.Add(this.cancelButton);
     87      this.panel.Location = new System.Drawing.Point(3, 32);
     88      this.panel.Name = "panel";
     89      this.panel.Size = new System.Drawing.Size(367, 23);
     90      this.panel.TabIndex = 4;
     91      //
     92      // stopButton
     93      //
     94      this.stopButton.Dock = System.Windows.Forms.DockStyle.Right;
     95      this.stopButton.Location = new System.Drawing.Point(217, 0);
     96      this.stopButton.Name = "stopButton";
     97      this.stopButton.Size = new System.Drawing.Size(75, 23);
     98      this.stopButton.TabIndex = 3;
     99      this.stopButton.Text = "Stop";
     100      this.stopButton.UseVisualStyleBackColor = true;
     101      this.stopButton.Click += new System.EventHandler(this.stopButton_Click);
    62102      //
    63103      // cancelButton
    64104      //
    65       this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    66       this.cancelButton.Location = new System.Drawing.Point(280, 53);
     105      this.cancelButton.Dock = System.Windows.Forms.DockStyle.Right;
     106      this.cancelButton.Location = new System.Drawing.Point(292, 0);
    67107      this.cancelButton.Name = "cancelButton";
    68108      this.cancelButton.Size = new System.Drawing.Size(75, 23);
     
    72112      this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
    73113      //
    74       // panel
    75       //
    76       this.panel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    77             | System.Windows.Forms.AnchorStyles.Left)
    78             | System.Windows.Forms.AnchorStyles.Right)));
    79       this.panel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
    80       this.panel.Controls.Add(this.progressBar);
    81       this.panel.Controls.Add(this.cancelButton);
    82       this.panel.Controls.Add(this.statusLabel);
    83       this.panel.Location = new System.Drawing.Point(0, 0);
    84       this.panel.Name = "panel";
    85       this.panel.Size = new System.Drawing.Size(360, 88);
    86       this.panel.TabIndex = 3;
    87       //
    88114      // ProgressView
    89115      //
    90116      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    91       this.Controls.Add(this.panel);
     117      this.Controls.Add(this.borderPanel);
    92118      this.Name = "ProgressView";
    93       this.Size = new System.Drawing.Size(360, 88);
     119      this.Size = new System.Drawing.Size(374, 62);
     120      this.borderPanel.ResumeLayout(false);
    94121      this.panel.ResumeLayout(false);
    95122      this.ResumeLayout(false);
     
    100127
    101128    private System.Windows.Forms.ProgressBar progressBar;
    102     private System.Windows.Forms.Label statusLabel;
     129    private System.Windows.Forms.Label messageLabel;
     130    private System.Windows.Forms.Panel borderPanel;
     131    private System.Windows.Forms.Button stopButton;
     132    private System.Windows.Forms.Panel panel;
    103133    private System.Windows.Forms.Button cancelButton;
    104     private System.Windows.Forms.Panel panel;
    105134  }
    106135}
  • stable/HeuristicLab.MainForm.WindowsForms/3.3/HeuristicLab.MainForm.WindowsForms-3.3.csproj

    r11920 r17062  
    151151    </Compile>
    152152    <Compile Include="Plugin.cs" />
     153    <Compile Include="Progress.cs" />
    153154    <Compile Include="Views\AsynchronousContentView.cs">
    154155      <SubType>UserControl</SubType>
  • stable/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/MainForm.cs

    r15584 r17062  
    6161      set {
    6262        if (InvokeRequired) {
    63           Action<string> action = delegate(string s) { this.Title = s; };
     63          Action<string> action = delegate (string s) { this.Title = s; };
    6464          Invoke(action, value);
    6565        } else
     
    7272      set {
    7373        if (InvokeRequired) {
    74           Action<Cursor> action = delegate(Cursor c) { this.Cursor = c; };
     74          Action<Cursor> action = delegate (Cursor c) { this.Cursor = c; };
    7575          Invoke(action, value);
    7676        } else
     
    9595        if (this.activeView != value) {
    9696          if (InvokeRequired) {
    97             Action<IView> action = delegate(IView activeView) { this.ActiveView = activeView; };
     97            Action<IView> action = delegate (IView activeView) { this.ActiveView = activeView; };
    9898            Invoke(action, value);
    9999          } else {
     
    230230    }
    231231
    232     public IContentView ShowContent<T>(T content, bool reuseExistingView, IEqualityComparer<T> comparer = null) where T : class,IContent {
     232    public IContentView ShowContent<T>(T content, bool reuseExistingView, IEqualityComparer<T> comparer = null) where T : class, IContent {
    233233      if (content == null) throw new ArgumentNullException("Content cannot be null.");
    234234      if (!reuseExistingView) return ShowContent(content);
     
    353353    /// Adds a <see cref="ProgressView"/> to the <see cref="ContentView"/>s showing the specified content.
    354354    /// </summary>
    355     public IProgress AddOperationProgressToContent(IContent content, string progressMessage, bool addToObjectGraphObjects = true) {
     355    internal void AddProgressToContent(IContent content, IProgress progress, bool addToObjectGraphObjects) {
    356356      if (InvokeRequired) {
    357         IProgress result = (IProgress)Invoke((Func<IContent, string, bool, IProgress>)AddOperationProgressToContent, content, progressMessage, addToObjectGraphObjects);
    358         return result;
     357        Invoke((Action<IContent, IProgress, bool>)AddProgressToContent, content, progress, addToObjectGraphObjects);
     358        return;
    359359      }
    360360      if (contentProgressLookup.ContainsKey(content))
     
    371371        contentViews = contentViews.Where(v => v.Content == content);
    372372
    373       var progress = new Progress(progressMessage, ProgressState.Started);
    374373      foreach (var contentView in contentViews) {
    375374        progressViews.Add(new ProgressView(contentView, progress));
     
    377376
    378377      contentProgressLookup[content] = progress;
    379       return progress;
    380378    }
    381379
     
    383381    /// Adds a <see cref="ProgressView"/> to the specified view.
    384382    /// </summary>
    385     public IProgress AddOperationProgressToView(Control control, string progressMessage) {
    386       var progress = new Progress(progressMessage, ProgressState.Started);
    387       AddOperationProgressToView(control, progress);
    388       return progress;
    389     }
    390 
    391     public void AddOperationProgressToView(Control control, IProgress progress) {
     383    internal void AddProgressToControl(Control control, IProgress progress) {
    392384      if (InvokeRequired) {
    393         Invoke((Action<Control, IProgress>)AddOperationProgressToView, control, progress);
     385        Invoke((Action<Control, IProgress>)AddProgressToControl, control, progress);
    394386        return;
    395387      }
     
    413405    /// Removes an existing <see cref="ProgressView"/> from the <see cref="ContentView"/>s showing the specified content.
    414406    /// </summary>
    415     public void RemoveOperationProgressFromContent(IContent content, bool finishProgress = true) {
     407    internal void RemoveProgressFromContent(IContent content, bool finishProgress) {
    416408      if (InvokeRequired) {
    417         Invoke((Action<IContent, bool>)RemoveOperationProgressFromContent, content, finishProgress);
     409        Invoke((Action<IContent, bool>)RemoveProgressFromContent, content, finishProgress);
    418410        return;
    419411      }
     
    429421      }
    430422      contentProgressLookup.Remove(content);
    431 
    432423    }
    433424
     
    435426    /// Removes an existing <see cref="ProgressView"/> from the specified view.
    436427    /// </summary>
    437     public void RemoveOperationProgressFromView(Control control, bool finishProgress = true) {
     428    internal void RemoveProgressFromControl(Control control, bool finishProgress) {
    438429      if (InvokeRequired) {
    439         Invoke((Action<Control, bool>)RemoveOperationProgressFromView, control, finishProgress);
     430        Invoke((Action<Control, bool>)RemoveProgressFromControl, control, finishProgress);
    440431        return;
    441432      }
     
    560551      try {
    561552        ((IActionUserInterfaceItem)item.Tag).Execute();
    562       }
    563       catch (Exception ex) {
     553      } catch (Exception ex) {
    564554        ErrorHandling.ShowErrorDialog((Control)MainFormManager.MainForm, ex);
    565555      }
  • stable/HeuristicLab.MainForm/3.3/HeuristicLab.MainForm-3.3.csproj

    r11920 r17062  
    124124    <Compile Include="Interfaces\IProgress.cs" />
    125125    <Compile Include="Plugin.cs" />
    126     <Compile Include="Progress.cs" />
    127126    <Compile Include="ViewAttribute.cs" />
    128127    <Compile Include="Interfaces\IContentView.cs" />
  • stable/HeuristicLab.MainForm/3.3/Interfaces/IProgress.cs

    r15584 r17062  
    2424
    2525namespace HeuristicLab.MainForm {
    26   public enum ProgressState { Started = 1, Canceled = 2, Finished = 3 };
     26  public enum ProgressState { Started, Finished, StopRequested, CancelRequested }
     27  public enum ProgressMode { Determinate, Indeterminate }
    2728
    2829  public interface IProgress : IContent {
     30    ProgressState ProgressState { get; }
     31
     32    string Message { get; set; }
     33
     34    ProgressMode ProgressMode { get; set; }
    2935    /// <summary>
    30     /// Gets or sets the currently associated status text with the progress.
     36    /// Gets or sets the currently associated progress value in the range [0;1] (values outside the range are truncated).
     37    /// Changing the ProgressValue when <c>ProgressMode</c> is <c>Indeterminate</c> raises an Exception.
    3138    /// </summary>
    32     string Status { get; set; }
    33     /// <summary>
    34     /// Gets or sets the currently associated progress value in the range (0;1].
    35     ///  Values outside this range are permitted and need to be handled in some feasible manner.
    36     /// </summary>
     39    /// <exception cref="InvalidOperationException">Setting the ProgressValue-property while in the Indeterminate state is invalid.</exception>
    3740    double ProgressValue { get; set; }
    38     /// <summary>
    39     /// Gets or sets the current state of the progress. Every progress starts in state
    40     /// Started and then becomes either Canceled or Finished.
    41     /// If it is reused it may be Started again.
    42     /// </summary>
    43     ProgressState ProgressState { get; }
    44     /// <summary>
    45     /// Returns whether the operation can be canceled or not.
    46     /// This can change during the course of the progress.
    47     /// </summary>
    48     bool CanBeCanceled { get; }
    4941
    50     /// <summary>
    51     /// Requests the operation behind the process to cancel.
    52     /// Check the !ProgressState property when the cancellation succeeded.
    53     /// The corresponding event will also notify of a success.
    54     /// </summary>
    55     /// <exception cref="NotSupportedException">Thrown when cancellation is not supported.</exception>
     42    bool CanBeStopped { get; set; }
     43    bool CanBeCanceled { get; set; }
     44
     45    void Start(string message, ProgressMode mode = ProgressMode.Determinate);
     46    void Finish();
     47    void Stop();
    5648    void Cancel();
    57     /// <summary>
    58     /// Sets the ProgressValue to 1 and the ProgressState to Finished.
    59     /// </summary>
    60     void Finish();
    6149
    62     /// <summary>
    63     /// Starts or restarts a Progress.
    64     /// </summary>
    65     void Start();
    66 
    67     void Start(string status);
    68 
    69     /// <summary>
    70     /// The status text changed.
    71     /// </summary>
    72     event EventHandler StatusChanged;
    73     /// <summary>
    74     /// The value of the progress changed. This is the (0;1] progress value from starting to finish. Values outside this range are permitted and need to be handled in some feasible manner.
    75     /// </summary>
     50    event EventHandler ProgressStateChanged;
     51    event EventHandler MessageChanged;
     52    event EventHandler ProgressBarModeChanged;
    7653    event EventHandler ProgressValueChanged;
    77     /// <summary>
    78     /// The state of the progress changed. The handler is supposed to query the ProgressState property.
    79     /// </summary>
    80     event EventHandler ProgressStateChanged;
    81     /// <summary>
    82     /// The progress' ability to cancel changed.
    83     /// </summary>
     54    event EventHandler CanBeStoppedChanged;
    8455    event EventHandler CanBeCanceledChanged;
    85     /// <summary>
    86     /// A cancelation is requested.
    87     /// </summary>
     56    event EventHandler StopRequested;
    8857    event EventHandler CancelRequested;
    8958  }
  • stable/HeuristicLab.Optimization

  • stable/HeuristicLab.Optimization.Views

  • stable/HeuristicLab.Optimization/3.3/Problems/SingleObjectiveHeuristicOptimizationProblem.cs

  • stable/HeuristicLab.Optimizer

  • stable/HeuristicLab.Optimizer/3.3/FileManager.cs

    r15584 r17062  
    7878        if (view == null)
    7979          ErrorHandling.ShowErrorDialog("There is no view for the loaded item. It cannot be displayed.", new InvalidOperationException("No View Available"));
    80       }
    81       catch (Exception ex) {
     80      } catch (Exception ex) {
    8281        ErrorHandling.ShowErrorDialog((Control)MainFormManager.MainForm, "Cannot open file.", ex);
    83       }
    84       finally {
     82      } finally {
    8583        ((MainForm.WindowsForms.MainForm)MainFormManager.MainForm).ResetAppStartingCursor();
    8684      }
     
    145143        if (error != null) throw error;
    146144        MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().UpdateTitle();
    147       }
    148       catch (Exception ex) {
     145      } catch (Exception ex) {
    149146        ErrorHandling.ShowErrorDialog((Control)MainFormManager.MainForm, "Cannot save file.", ex);
    150       }
    151       finally {
     147      } finally {
    152148        SetSaveOperationProgressInContentViews(content, false);
    153149        MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().ResetAppStartingCursor();
     
    161157      mainForm.Invoke((Action)delegate {
    162158        if (showProgress) {
    163           mainForm.AddOperationProgressToContent(content, string.Format("Saving to file \"{0}\"...", Path.GetFileName(fileName ?? content.Filename)));
     159          Progress.Show(content, string.Format("Saving to file \"{0}\"...", Path.GetFileName(fileName ?? content.Filename)));
    164160        } else
    165           mainForm.RemoveOperationProgressFromContent(content);
     161          Progress.Hide(content);
    166162      });
    167163      #endregion
  • stable/HeuristicLab.Optimizer/3.3/StartPage.cs

    r15584 r17062  
    8888
    8989    private void LoadSamples(object state) {
    90       progress = MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(samplesListView, "Loading...");
     90      progress = Progress.ShowOnControl(samplesListView, "Loading...");
    9191      try {
    9292        var assembly = Assembly.GetExecutingAssembly();
     
    112112        OnAllSamplesLoaded();
    113113      } finally {
    114         MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(samplesListView);
     114        Progress.HideFromControl(samplesListView);
    115115      }
    116116    }
     
    138138        };
    139139      groupLookup[standardProblemsGroup] = standardProblems;
    140       var dataAnalysisProblems = new List<string> { "ALPSGP_SymReg", "SGP_SymbClass", "SGP_SymbReg","OSGP_SymReg", "OSGP_TimeSeries", "GE_SymbReg", "GPR" };
     140      var dataAnalysisProblems = new List<string> { "ALPSGP_SymReg", "SGP_SymbClass", "SGP_SymbReg", "OSGP_SymReg", "OSGP_TimeSeries", "GE_SymbReg", "GPR" };
    141141      groupLookup[dataAnalysisGroup] = dataAnalysisProblems;
    142142      var scripts = new List<string> { "GA_QAP_Script", "GUI_Automation_Script", "OSGA_Rastrigin_Script",
  • stable/HeuristicLab.Persistence

  • stable/HeuristicLab.Problems.BinPacking

  • stable/HeuristicLab.Problems.BinPacking.Views

  • stable/HeuristicLab.Problems.DataAnalysis

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/SymbolicClassificationSolutionView.cs

    r15584 r17062  
    6060        var name = exportFileDialog.FileName;
    6161        using (BackgroundWorker bg = new BackgroundWorker()) {
    62           MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, "Exportion solution to " + name + ".");
     62          Progress.Show(this, "Exportion solution to " + name + ".", ProgressMode.Indeterminate);
    6363          bg.DoWork += (o, a) => exporter.Export(Content, name);
    64           bg.RunWorkerCompleted += (o, a) => MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this);
     64          bg.RunWorkerCompleted += (o, a) => Progress.Hide(this);
    6565          bg.RunWorkerAsync();
    6666        }
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/SymbolicDiscriminantFunctionClassificationSolutionView.cs

    r15584 r17062  
    5959        var name = exportFileDialog.FileName;
    6060        using (BackgroundWorker bg = new BackgroundWorker()) {
    61           MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, "Exportion solution to " + name + ".");
     61          Progress.Show(this, "Exportion solution to " + name + ".", ProgressMode.Indeterminate);
    6262          bg.DoWork += (o, a) => exporter.Export(Content, name);
    63           bg.RunWorkerCompleted += (o, a) => MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this);
     63          bg.RunWorkerCompleted += (o, a) => Progress.Hide(this);
    6464          bg.RunWorkerAsync();
    6565        }
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/SymbolicRegressionSolutionView.cs

    r15584 r17062  
    6161        var name = exportFileDialog.FileName;
    6262        using (BackgroundWorker bg = new BackgroundWorker()) {
    63           MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, "Exporting solution to " + name + ".");
     63          Progress.Show(this, "Exporting solution to " + name + ".", ProgressMode.Indeterminate);
    6464          bg.DoWork += (o, a) => exporter.Export(Content, name);
    65           bg.RunWorkerCompleted += (o, a) => MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this);
     65          bg.RunWorkerCompleted += (o, a) => Progress.Hide(this);
    6666          bg.RunWorkerAsync();
    6767        }
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs

    r15584 r17062  
    2424using System.Drawing;
    2525using System.Linq;
     26using System.Threading;
    2627using System.Threading.Tasks;
    2728using System.Windows.Forms;
     
    4041    private readonly ISymbolicDataAnalysisSolutionImpactValuesCalculator impactCalculator;
    4142
    42     private readonly IProgress progress = new Progress();
     43    private readonly Progress progress = new Progress();
     44    private CancellationTokenSource cancellationTokenSource;
    4345
    4446    private enum TreeState { Valid, Invalid }
     
    152154      Content.ProblemDataChanged += Content_Changed;
    153155      treeChart.Repainted += treeChart_Repainted;
    154       MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().AddOperationProgressToView(grpSimplify, progress);
     156      Progress.ShowOnControl(grpSimplify, progress);
     157      progress.StopRequested += progress_StopRequested;
    155158    }
    156159    protected override void DeregisterContentEvents() {
     
    159162      Content.ProblemDataChanged -= Content_Changed;
    160163      treeChart.Repainted -= treeChart_Repainted;
    161       MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(grpSimplify, false);
     164      Progress.HideFromControl(grpSimplify, false);
     165      progress.StopRequested -= progress_StopRequested;
    162166    }
    163167
     
    178182    }
    179183
     184    private void progress_StopRequested(object sender, EventArgs e) {
     185      cancellationTokenSource.Cancel();
     186    }
     187
    180188    private async void UpdateView() {
    181189      if (Content == null || Content.Model == null || Content.ProblemData == null) return;
     
    184192
    185193      progress.Start("Calculate Impact and Replacement Values ...");
     194      progress.CanBeStopped = true;
     195      cancellationTokenSource = new CancellationTokenSource();
    186196      var impactAndReplacementValues = await Task.Run(() => CalculateImpactAndReplacementValues(tree));
    187       await Task.Delay(500); // wait for progressbar to finish animation
     197      try {
     198        await Task.Delay(500, cancellationTokenSource.Token); // wait for progressbar to finish animation
     199      } catch (OperationCanceledException) { }
    188200      var replacementValues = impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item2);
    189201      foreach (var pair in replacementValues.Where(pair => !(pair.Key is ConstantTreeNode))) {
     
    192204      nodeImpacts = impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item1);
    193205      progress.Finish();
     206      progress.CanBeStopped = false;
    194207      PaintNodeImpacts();
    195208    }
     
    198211      var impactAndReplacementValues = new Dictionary<ISymbolicExpressionTreeNode, Tuple<double, double>>();
    199212      foreach (var node in tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix()) {
     213        if (progress.ProgressState == ProgressState.StopRequested) continue;
    200214        double impactValue, replacementValue, newQualityForImpactsCalculation;
    201215        impactCalculator.CalculateImpactAndReplacementValues(Content.Model, node, Content.ProblemData, Content.ProblemData.TrainingIndices, out impactValue, out replacementValue, out newQualityForImpactsCalculation);
  • stable/HeuristicLab.Problems.DataAnalysis.Views

  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionVariableImpactsView.cs

    r16438 r17062  
    120120
    121121      //Prepare arguments
    122       var mainForm = (MainForm.WindowsForms.MainForm)MainFormManager.MainForm;
    123122      var replMethod = (ClassificationSolutionVariableImpactsCalculator.ReplacementMethodEnum)replacementComboBox.Items[replacementComboBox.SelectedIndex];
    124123      var factorReplMethod = (ClassificationSolutionVariableImpactsCalculator.FactorReplacementMethodEnum)factorVarReplComboBox.Items[factorVarReplComboBox.SelectedIndex];
     
    126125
    127126      variableImpactsArrayView.Caption = Content.Name + " Variable Impacts";
    128       progress = mainForm.AddOperationProgressToView(this, "Calculating variable impacts for " + Content.Name);
    129       progress.ProgressValue = 0;
    130 
     127      progress = Progress.Show(this, "Calculating variable impacts for " + Content.Name);
    131128      cancellationToken = new CancellationTokenSource();
    132129
     
    146143        rawVariableImpacts.AddRange(impacts);
    147144        UpdateOrdering();
    148       }
    149       finally {
    150         ((MainForm.WindowsForms.MainForm)MainFormManager.MainForm).RemoveOperationProgressFromView(this);
     145      } finally {
     146        Progress.Hide(this);
    151147      }
    152148    }
     
    175171        if (cancellationToken.Token.IsCancellationRequested) { return null; }
    176172        progress.ProgressValue = (double)++i / count;
    177         progress.Status = string.Format("Calculating impact for variable {0} ({1} of {2})", variableName, i, count);
     173        progress.Message = string.Format("Calculating impact for variable {0} ({1} of {2})", variableName, i, count);
    178174
    179175        double impact = 0;
  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/MenuItems/ShrinkDataAnalysisRunsMenuItem.cs

    r15584 r17062  
    7272    public override void Execute() {
    7373      IContentView activeView = (IContentView)MainFormManager.MainForm.ActiveView;
    74       var mainForm = (MainForm.WindowsForms.MainForm)MainFormManager.MainForm;
    75       mainForm.AddOperationProgressToContent(activeView.Content, "Removing duplicate datasets.");
     74      var content = activeView.Content;
     75      Progress.Show(content, "Removing duplicate datasets.", ProgressMode.Indeterminate);
    7676
    7777      Action<IContentView> action = (view) => DatasetUtil.RemoveDuplicateDatasets(view.Content);
     
    7979      action.BeginInvoke(activeView, delegate (IAsyncResult result) {
    8080        action.EndInvoke(result);
    81         mainForm.RemoveOperationProgressFromContent(activeView.Content);
     81        Progress.Hide(content);
    8282      }, null);
    8383    }
  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionVariableImpactsView.cs

    r16438 r17062  
    111111
    112112    private async void UpdateVariableImpact() {
    113       IProgress progress;
    114 
    115113      //Check if the selection is valid
    116114      if (Content == null) { return; }
     
    120118
    121119      //Prepare arguments
    122       var mainForm = (MainForm.WindowsForms.MainForm)MainFormManager.MainForm;
    123120      var replMethod = (RegressionSolutionVariableImpactsCalculator.ReplacementMethodEnum)replacementComboBox.Items[replacementComboBox.SelectedIndex];
    124121      var factorReplMethod = (RegressionSolutionVariableImpactsCalculator.FactorReplacementMethodEnum)factorVarReplComboBox.Items[factorVarReplComboBox.SelectedIndex];
     
    126123
    127124      variableImpactsArrayView.Caption = Content.Name + " Variable Impacts";
    128       progress = mainForm.AddOperationProgressToView(this, "Calculating variable impacts for " + Content.Name);
    129       progress.ProgressValue = 0;
    130 
     125      var progress = Progress.Show(this, "Calculating variable impacts for " + Content.Name);
    131126      cancellationToken = new CancellationTokenSource();
    132127
     
    148143      }
    149144      finally {
    150         ((MainForm.WindowsForms.MainForm)MainFormManager.MainForm).RemoveOperationProgressFromView(this);
     145        Progress.Hide(this);
    151146      }
    152147    }
     
    175170        if (cancellationToken.Token.IsCancellationRequested) { return null; }
    176171        progress.ProgressValue = (double)++i / count;
    177         progress.Status = string.Format("Calculating impact for variable {0} ({1} of {2})", variableName, i, count);
     172        progress.Message = string.Format("Calculating impact for variable {0} ({1} of {2})", variableName, i, count);
    178173
    179174        double impact = 0;
  • stable/HeuristicLab.Problems.DataAnalysis/3.4

  • stable/HeuristicLab.Problems.GrammaticalEvolution

  • stable/HeuristicLab.Problems.Instances

  • stable/HeuristicLab.Problems.Instances.DataAnalysis

  • stable/HeuristicLab.Problems.Instances.DataAnalysis.Views

  • stable/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/RegressionInstanceProviderView.cs

    r15584 r17062  
    4646
    4747        Task.Factory.StartNew(() => {
    48           var mainForm = (MainForm.WindowsForms.MainForm)MainFormManager.MainForm;
     48          var activeView = (IContentView)MainFormManager.MainForm.ActiveView;
     49          var content = activeView.Content;
    4950          // lock active view and show progress bar
    50           IContentView activeView = (IContentView)MainFormManager.MainForm.ActiveView;
     51          try {
     52            var progress = Progress.Show(content, "Loading problem instance.");
    5153
    52           try {
    53             var progress = mainForm.AddOperationProgressToContent(activeView.Content,
    54               "Loading problem instance.");
     54            Content.ProgressChanged += (o, args) => { progress.ProgressValue = args.ProgressPercentage / 100.0; };
    5555
    56             Content.ProgressChanged +=
    57               (o, args) => { progress.ProgressValue = args.ProgressPercentage / 100.0; };
    58 
    59             instance = Content.ImportData(importTypeDialog.Path, importTypeDialog.ImportType,
    60               importTypeDialog.CSVFormat);
     56            instance = Content.ImportData(importTypeDialog.Path, importTypeDialog.ImportType, importTypeDialog.CSVFormat);
    6157          } catch (Exception ex) {
    6258            ErrorWhileParsing(ex);
    6359            return;
    6460          } finally {
    65             mainForm.RemoveOperationProgressFromContent(activeView.Content);
     61            Progress.Hide(content);
    6662          }
    6763
  • stable/HeuristicLab.Problems.Instances.TSPLIB.Views

  • stable/HeuristicLab.Problems.Instances.Views/3.3/ProblemInstanceProviderViewGeneric.cs

    r15584 r17062  
    121121
    122122        IContentView activeView = (IContentView)MainFormManager.MainForm.ActiveView;
    123         var mainForm = (MainForm.WindowsForms.MainForm)MainFormManager.MainForm;
     123        var content = activeView.Content;
    124124        // lock active view and show progress bar
    125         mainForm.AddOperationProgressToContent(activeView.Content, "Loading problem instance.");
     125        Progress.Show(content, "Loading problem instance.", ProgressMode.Indeterminate);
    126126
    127127        Task.Factory.StartNew(() => {
     
    131131          } catch (Exception ex) {
    132132            ErrorHandling.ShowErrorDialog(String.Format("Could not load the problem instance {0}", descriptor.Name), ex);
    133             mainForm.RemoveOperationProgressFromContent(activeView.Content);
     133            Progress.Hide(content);
    134134            return;
    135135          }
     
    139139            ErrorHandling.ShowErrorDialog(String.Format("This problem does not support loading the instance {0}", descriptor.Name), ex);
    140140          } finally {
    141             mainForm.RemoveOperationProgressFromContent(activeView.Content);
     141            Progress.Hide(content);
    142142          }
    143143        });
  • stable/HeuristicLab.Problems.QuadraticAssignment

  • stable/HeuristicLab.Problems.QuadraticAssignment.Views

  • stable/HeuristicLab.Problems.TestFunctions

  • stable/HeuristicLab.Problems.TravelingSalesman.Views

  • stable/HeuristicLab.Problems.VehicleRouting

  • stable/HeuristicLab.Problems.VehicleRouting.Views

  • stable/HeuristicLab.Random

  • stable/HeuristicLab.Scripting.Views/3.3/ScriptView.cs

    r16832 r17062  
    180180
    181181    private void AddProgressView(string progressMessage) {
    182       var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
    183       mainForm.AddOperationProgressToView(this, progressMessage);
     182      Progress.Show(this, progressMessage, ProgressMode.Indeterminate);
    184183      progressViewCreated = true;
    185184    }
     
    187186    private void RemoveProgressView() {
    188187      if (!progressViewCreated) return;
    189       var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
    190       mainForm.RemoveOperationProgressFromView(this);
     188      Progress.Hide(this);
    191189      progressViewCreated = false;
    192190    }
  • stable/HeuristicLab.Services.Access

  • stable/HeuristicLab.Services.Access.DataAccess

  • stable/HeuristicLab.Services.Deployment

  • stable/HeuristicLab.Services.Deployment.DataAccess

  • stable/HeuristicLab.Services.Hive

  • stable/HeuristicLab.Services.Hive.DataAccess

  • stable/HeuristicLab.Services.Hive.JanitorService

  • stable/HeuristicLab.Services.Hive.Web

  • stable/HeuristicLab.Services.OKB

  • stable/HeuristicLab.Services.OKB.DataAccess

  • stable/HeuristicLab.Services.WebApp

  • stable/HeuristicLab.Services.WebApp.Maintenance

  • stable/HeuristicLab.Services.WebApp.Statistics

  • stable/HeuristicLab.Tests

Note: See TracChangeset for help on using the changeset viewer.