Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/24/13 11:49:28 (11 years ago)
Author:
jkarder
Message:

#2110: refactored ProblemInstanceProviderViews

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/ClassificationInstanceProviderView.cs

    r9999 r10000  
    2828namespace HeuristicLab.Problems.Instances.DataAnalysis.Views {
    2929  [View("Classification InstanceProvider View")]
    30   [Content(typeof(IProblemInstanceConsumer<IClassificationProblemData>), IsDefaultView = true)]
    31   public partial class ClassificationInstanceConsumerView : DataAnalysisInstanceConsumerView<IClassificationProblemData> {
    32     public new IProblemInstanceConsumer<IClassificationProblemData> Content {
    33       get { return (IProblemInstanceConsumer<IClassificationProblemData>)base.Content; }
     30  [Content(typeof(ClassificationInstanceProvider), IsDefaultView = true)]
     31  public partial class ClassificationInstanceProviderView : DataAnalysisInstanceProviderView<IClassificationProblemData> {
     32
     33    public new ClassificationInstanceProvider Content {
     34      get { return (ClassificationInstanceProvider)base.Content; }
    3435      set { base.Content = value; }
    3536    }
    3637
    37     public ClassificationInstanceConsumerView() {
     38    public ClassificationInstanceProviderView() {
    3839      InitializeComponent();
    3940    }
    4041
    4142    protected override void importButton_Click(object sender, EventArgs e) {
    42       var provider = SelectedProvider as ClassificationInstanceProvider;
    43       if (provider != null) {
    44         ClassificationImportTypeDialog importTypeDialog = new ClassificationImportTypeDialog();
    45         if (importTypeDialog.ShowDialog() == DialogResult.OK) {
    46           IClassificationProblemData instance = null;
    47           try {
    48             instance = provider.ImportData(importTypeDialog.Path, importTypeDialog.ImportType, importTypeDialog.CSVFormat);
    49           }
    50           catch (IOException ex) {
    51             ErrorWhileParsing(ex);
    52             return;
    53           }
    54           try {
    55             GenericConsumer.Load(instance);
    56           }
    57           catch (IOException ex) {
    58             ErrorWhileLoading(ex, importTypeDialog.Path);
    59           }
    60         } else {
     43      var importTypeDialog = new ClassificationImportTypeDialog();
     44      if (importTypeDialog.ShowDialog() == DialogResult.OK) {
     45        IClassificationProblemData instance = null;
     46        try {
     47          instance = Content.ImportData(importTypeDialog.Path, importTypeDialog.ImportType, importTypeDialog.CSVFormat);
     48        } catch (IOException ex) {
     49          ErrorWhileParsing(ex);
    6150          return;
    6251        }
    63       } else {
    64         base.importButton_Click(sender, e);
     52        try {
     53          GenericConsumer.Load(instance);
     54          instancesComboBox.SelectedIndex = -1;
     55        } catch (IOException ex) {
     56          ErrorWhileLoading(ex, importTypeDialog.Path);
     57        }
    6558      }
    6659    }
Note: See TracChangeset for help on using the changeset viewer.