Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/08/16 12:25:13 (8 years ago)
Author:
mkommend
Message:

#2595: Merged r13766, r13942, r13985, r13986, r13987 into stable.

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.DataAnalysis.Views

  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/RegressionSolutionView.cs

    r12009 r14022  
    2020#endregion
    2121
     22using System;
     23using System.Linq;
     24using System.Threading.Tasks;
    2225using System.Windows.Forms;
    2326using HeuristicLab.Core;
     27using HeuristicLab.Data;
     28using HeuristicLab.Data.Views;
    2429using HeuristicLab.MainForm;
     30using HeuristicLab.MainForm.WindowsForms;
    2531
    2632namespace HeuristicLab.Problems.DataAnalysis.Views {
     
    3541      get { return (RegressionSolutionBase)base.Content; }
    3642      set { base.Content = value; }
     43    }
     44
     45    protected override void SetEnabledStateOfControls() {
     46      base.SetEnabledStateOfControls();
     47      btnImpactCalculation.Enabled = Content != null && !Locked;
     48    }
     49
     50    protected virtual void btnImpactCalculation_Click(object sender, EventArgs e) {
     51      var mainForm = (MainForm.WindowsForms.MainForm)MainFormManager.MainForm;
     52      var view = new StringConvertibleArrayView();
     53      view.Caption = Content.Name + " Variable Impacts";
     54      view.Show();
     55
     56      Task.Factory.StartNew(() => {
     57        try {
     58          mainForm.AddOperationProgressToView(view, "Calculating variable impacts for " + Content.Name);
     59
     60          var impacts = RegressionSolutionVariableImpactsCalculator.CalculateImpacts(Content);
     61          var impactArray = new DoubleArray(impacts.Select(i => i.Item2).ToArray());
     62          impactArray.ElementNames = impacts.Select(i => i.Item1);
     63          view.Content = (DoubleArray)impactArray.AsReadOnly();
     64        }
     65        finally {
     66          mainForm.RemoveOperationProgressFromView(view);
     67        }
     68      });
    3769    }
    3870
Note: See TracChangeset for help on using the changeset viewer.