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

#2110: refactored ProblemInstanceProviderViews

Location:
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3
Files:
1 edited
2 copied
8 moved

Legend:

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

    r9999 r10000  
    2121
    2222namespace HeuristicLab.Problems.Instances.DataAnalysis.Views {
    23   partial class ClassificationInstanceConsumerView {
     23  partial class ClassificationInstanceProviderView {
    2424    /// <summary>
    2525    /// Required designer variable.
  • 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    }
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/ClusteringInstanceProviderView.Designer.cs

    r9999 r10000  
    2121
    2222namespace HeuristicLab.Problems.Instances.DataAnalysis.Views {
    23   partial class ClassificationInstanceConsumerView {
     23  partial class ClusteringInstanceProviderView {
    2424    /// <summary>
    2525    /// Required designer variable.
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/ClusteringInstanceProviderView.cs

    r9999 r10000  
    2727
    2828namespace HeuristicLab.Problems.Instances.DataAnalysis.Views {
    29   [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; }
     29  [View("Clustering InstanceProvider View")]
     30  [Content(typeof(ClusteringInstanceProvider), IsDefaultView = true)]
     31  public partial class ClusteringInstanceProviderView : DataAnalysisInstanceProviderView<IClusteringProblemData> {
     32
     33    public new ClusteringInstanceProvider Content {
     34      get { return (ClusteringInstanceProvider)base.Content; }
    3435      set { base.Content = value; }
    3536    }
    3637
    37     public ClassificationInstanceConsumerView() {
     38    public ClusteringInstanceProviderView() {
    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 DataAnalysisImportTypeDialog();
     44      if (importTypeDialog.ShowDialog() == DialogResult.OK) {
     45        IClusteringProblemData 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    }
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/DataAnalysisInstanceProviderView.Designer.cs

    r9999 r10000  
    2121
    2222namespace HeuristicLab.Problems.Instances.DataAnalysis.Views {
    23   partial class DataAnalysisInstanceConsumerView<T> {
     23  partial class DataAnalysisInstanceProviderView<T> {
    2424    /// <summary>
    2525    /// Required designer variable.
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/DataAnalysisInstanceProviderView.cs

    r9999 r10000  
    2929namespace HeuristicLab.Problems.Instances.DataAnalysis.Views {
    3030  [View("DataAnalysis InstanceProvider View")]
    31   [Content(typeof(IProblemInstanceConsumer<IDataAnalysisProblemData>), IsDefaultView = true)]
    32   [Content(typeof(IProblemInstanceConsumer<IClusteringProblemData>), IsDefaultView = true)]
    33   public partial class DataAnalysisInstanceConsumerView<T> : ProblemInstanceConsumerViewGeneric<T>
     31  public partial class DataAnalysisInstanceProviderView<T> : ProblemInstanceProviderViewGeneric<T>
    3432    where T : class, IDataAnalysisProblemData {
    35     public new IProblemInstanceConsumer<T> Content {
    36       get { return (IProblemInstanceConsumer<T>)base.Content; }
    37       set { base.Content = value; }
    38     }
    3933
    40     public DataAnalysisInstanceConsumerView() {
     34    public DataAnalysisInstanceProviderView() {
    4135      InitializeComponent();
    4236    }
    4337
    4438    protected override void importButton_Click(object sender, EventArgs e) {
    45       var provider = SelectedProvider as DataAnalysisInstanceProvider<T, DataAnalysisImportType>;
     39      var provider = Content as DataAnalysisInstanceProvider<T, DataAnalysisImportType>;
    4640      if (provider != null) {
    47         DataAnalysisImportTypeDialog importTypeDialog = new DataAnalysisImportTypeDialog();
     41        var importTypeDialog = new DataAnalysisImportTypeDialog();
    4842        if (importTypeDialog.ShowDialog() == DialogResult.OK) {
    4943          T instance = default(T);
    5044          try {
    5145            instance = provider.ImportData(importTypeDialog.Path, importTypeDialog.ImportType, importTypeDialog.CSVFormat);
    52           }
    53           catch (IOException ex) {
     46          } catch (IOException ex) {
    5447            ErrorWhileParsing(ex);
    5548            return;
     
    5750          try {
    5851            GenericConsumer.Load(instance);
    59           }
    60           catch (IOException ex) {
     52            instancesComboBox.SelectedIndex = -1;
     53          } catch (IOException ex) {
    6154            ErrorWhileLoading(ex, importTypeDialog.Path);
    6255          }
    63         } else {
    64           return;
    6556        }
    6657      } else {
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/HeuristicLab.Problems.Instances.DataAnalysis.Views-3.3.csproj

    r8885 r10000  
    9292      <DependentUpon>ClassificationImportTypeDialog.cs</DependentUpon>
    9393    </Compile>
    94     <Compile Include="ClassificationInstanceConsumerView.cs">
    95       <SubType>UserControl</SubType>
    96     </Compile>
    97     <Compile Include="ClassificationInstanceConsumerView.Designer.cs">
    98       <DependentUpon>ClassificationInstanceConsumerView.cs</DependentUpon>
     94    <Compile Include="ClassificationInstanceProviderView.cs">
     95      <SubType>UserControl</SubType>
     96    </Compile>
     97    <Compile Include="ClassificationInstanceProviderView.Designer.cs">
     98      <DependentUpon>ClassificationInstanceProviderView.cs</DependentUpon>
     99    </Compile>
     100    <Compile Include="ClusteringInstanceProviderView.cs">
     101      <SubType>UserControl</SubType>
     102    </Compile>
     103    <Compile Include="ClusteringInstanceProviderView.Designer.cs">
     104      <DependentUpon>ClusteringInstanceProviderView.cs</DependentUpon>
    99105    </Compile>
    100106    <Compile Include="TimeSeriesPrognosisImportTypeDialog.cs">
     
    104110      <DependentUpon>TimeSeriesPrognosisImportTypeDialog.cs</DependentUpon>
    105111    </Compile>
    106     <Compile Include="TimeSeriesPrognosisInstanceConsumerView.cs">
    107       <SubType>UserControl</SubType>
    108     </Compile>
    109     <Compile Include="TimeSeriesPrognosisInstanceConsumerView.Designer.cs">
    110       <DependentUpon>TimeSeriesPrognosisInstanceConsumerView.cs</DependentUpon>
     112    <Compile Include="TimeSeriesPrognosisInstanceProviderView.cs">
     113      <SubType>UserControl</SubType>
     114    </Compile>
     115    <Compile Include="TimeSeriesPrognosisInstanceProviderView.Designer.cs">
     116      <DependentUpon>TimeSeriesPrognosisInstanceProviderView.cs</DependentUpon>
    111117    </Compile>
    112118    <Compile Include="DataAnalysisImportTypeDialog.cs">
     
    116122      <DependentUpon>DataAnalysisImportTypeDialog.cs</DependentUpon>
    117123    </Compile>
    118     <Compile Include="DataAnalysisInstanceConsumerView.cs">
    119       <SubType>UserControl</SubType>
    120     </Compile>
    121     <Compile Include="DataAnalysisInstanceConsumerView.Designer.cs">
    122       <DependentUpon>DataAnalysisInstanceConsumerView.cs</DependentUpon>
     124    <Compile Include="DataAnalysisInstanceProviderView.cs">
     125      <SubType>UserControl</SubType>
     126    </Compile>
     127    <Compile Include="DataAnalysisInstanceProviderView.Designer.cs">
     128      <DependentUpon>DataAnalysisInstanceProviderView.cs</DependentUpon>
    123129    </Compile>
    124130    <Compile Include="Plugin.cs" />
     
    129135      <DependentUpon>RegressionImportTypeDialog.cs</DependentUpon>
    130136    </Compile>
    131     <Compile Include="RegressionInstanceConsumerView.cs">
    132       <SubType>UserControl</SubType>
    133     </Compile>
    134     <Compile Include="RegressionInstanceConsumerView.Designer.cs">
    135       <DependentUpon>RegressionInstanceConsumerView.cs</DependentUpon>
     137    <Compile Include="RegressionInstanceProviderView.cs">
     138      <SubType>UserControl</SubType>
     139    </Compile>
     140    <Compile Include="RegressionInstanceProviderView.Designer.cs">
     141      <DependentUpon>RegressionInstanceProviderView.cs</DependentUpon>
    136142    </Compile>
    137143    <None Include="HeuristicLab.snk" />
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/RegressionInstanceProviderView.Designer.cs

    r9999 r10000  
    2121
    2222namespace HeuristicLab.Problems.Instances.DataAnalysis.Views {
    23   partial class RegressionInstanceConsumerView {
     23  partial class RegressionInstanceProviderView {
    2424    /// <summary>
    2525    /// Required designer variable.
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/RegressionInstanceProviderView.cs

    r9999 r10000  
    2828namespace HeuristicLab.Problems.Instances.DataAnalysis.Views {
    2929  [View("Regression InstanceProvider View")]
    30   [Content(typeof(IProblemInstanceConsumer<IRegressionProblemData>), IsDefaultView = true)]
    31   public partial class RegressionInstanceConsumerView : DataAnalysisInstanceConsumerView<IRegressionProblemData> {
    32     public new IProblemInstanceConsumer<IRegressionProblemData> Content {
    33       get { return (IProblemInstanceConsumer<IRegressionProblemData>)base.Content; }
     30  [Content(typeof(RegressionInstanceProvider), IsDefaultView = true)]
     31  public partial class RegressionInstanceProviderView : DataAnalysisInstanceProviderView<IRegressionProblemData> {
     32
     33    public new RegressionInstanceProvider Content {
     34      get { return (RegressionInstanceProvider)base.Content; }
    3435      set { base.Content = value; }
    3536    }
    3637
    37     public RegressionInstanceConsumerView() {
     38    public RegressionInstanceProviderView() {
    3839      InitializeComponent();
    3940    }
    4041
    4142    protected override void importButton_Click(object sender, EventArgs e) {
    42       var provider = SelectedProvider as RegressionInstanceProvider;
    43       if (provider != null) {
    44         RegressionImportTypeDialog importTypeDialog = new RegressionImportTypeDialog();
    45         if (importTypeDialog.ShowDialog() == DialogResult.OK) {
    46           IRegressionProblemData 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 RegressionImportTypeDialog();
     44      if (importTypeDialog.ShowDialog() == DialogResult.OK) {
     45        IRegressionProblemData 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    }
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/TimeSeriesPrognosisInstanceProviderView.Designer.cs

    r9999 r10000  
    2121
    2222namespace HeuristicLab.Problems.Instances.DataAnalysis.Views {
    23   partial class TimeSeriesPrognosisInstanceConsumerView {
     23  partial class TimeSeriesPrognosisInstanceProviderView {
    2424    /// <summary>
    2525    /// Required designer variable.
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/TimeSeriesPrognosisInstanceProviderView.cs

    r9999 r10000  
    2828namespace HeuristicLab.Problems.Instances.DataAnalysis.Views {
    2929  [View("TimeSeriesPrognosis InstanceProvider View")]
    30   [Content(typeof(IProblemInstanceConsumer<ITimeSeriesPrognosisProblemData>), IsDefaultView = true)]
    31   public partial class TimeSeriesPrognosisInstanceConsumerView : DataAnalysisInstanceConsumerView<ITimeSeriesPrognosisProblemData> {
    32     public new IProblemInstanceConsumer<ITimeSeriesPrognosisProblemData> Content {
    33       get { return (IProblemInstanceConsumer<ITimeSeriesPrognosisProblemData>)base.Content; }
     30  [Content(typeof(TimeSeriesPrognosisInstanceProvider), IsDefaultView = true)]
     31  public partial class TimeSeriesPrognosisInstanceProviderView : DataAnalysisInstanceProviderView<ITimeSeriesPrognosisProblemData> {
     32
     33    public new TimeSeriesPrognosisInstanceProvider Content {
     34      get { return (TimeSeriesPrognosisInstanceProvider)base.Content; }
    3435      set { base.Content = value; }
    3536    }
    3637
    37     public TimeSeriesPrognosisInstanceConsumerView() {
     38    public TimeSeriesPrognosisInstanceProviderView() {
    3839      InitializeComponent();
    3940    }
    4041
    4142    protected override void importButton_Click(object sender, EventArgs e) {
    42       var provider = SelectedProvider as TimeSeriesPrognosisInstanceProvider;
    43       if (provider != null) {
    44         TimeSeriesPrognosisImportTypeDialog importTypeDialog = new TimeSeriesPrognosisImportTypeDialog();
    45         if (importTypeDialog.ShowDialog() == DialogResult.OK) {
    46           ITimeSeriesPrognosisProblemData 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 TimeSeriesPrognosisImportTypeDialog();
     44      if (importTypeDialog.ShowDialog() == DialogResult.OK) {
     45        ITimeSeriesPrognosisProblemData 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.