Ignore:
Timestamp:
10/02/13 20:11:14 (9 years ago)
Author:
abeham
Message:

#2110: merged to stable

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

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

  • stable/HeuristicLab.Problems.Instances.TSPLIB.Views/3.3/TSPLIBTSPInstanceProviderView.cs

    r9456 r10021  
    2424using System.Windows.Forms;
    2525using HeuristicLab.MainForm;
    26 using HeuristicLab.MainForm.WindowsForms;
    2726using HeuristicLab.Problems.Instances.Views;
    2827
    2928namespace HeuristicLab.Problems.Instances.TSPLIB.Views {
    3029  [View("TSPLIB TSP InstanceProvider View")]
    31   [Content(typeof(IProblemInstanceConsumer<TSPData>), IsDefaultView = true)]
    32   public partial class TSPLIBTSPInstanceProviderView : ProblemInstanceConsumerViewGeneric<TSPData> {
    33     public new IProblemInstanceConsumer<TSPData> Content {
    34       get { return (IProblemInstanceConsumer<TSPData>)base.Content; }
     30  [Content(typeof(TSPLIBTSPInstanceProvider), IsDefaultView = true)]
     31  public partial class TSPLIBTSPInstanceProviderView : ProblemInstanceProviderView<TSPData> {
     32    public new TSPLIBTSPInstanceProvider Content {
     33      get { return (TSPLIBTSPInstanceProvider)base.Content; }
    3534      set { base.Content = value; }
    3635    }
     
    4140
    4241    protected override void importButton_Click(object sender, EventArgs e) {
    43       TSPLIBTSPInstanceProvider provider = SelectedProvider as TSPLIBTSPInstanceProvider;
    44       if (provider != null) {
    45         using (var dialog = new TSPLIBImportDialog()) {
    46           if (dialog.ShowDialog() == DialogResult.OK) {
    47             var instance = provider.LoadData(dialog.TSPFileName, dialog.TourFileName, dialog.Quality);
    48             try {
    49               GenericConsumer.Load(instance);
    50             }
    51             catch (Exception ex) {
    52               MessageBox.Show(String.Format("This problem does not support loading the instance {0}: {1}", Path.GetFileName(openFileDialog.FileName), Environment.NewLine + ex.Message), "Cannot load instance");
    53             }
     42      using (var dialog = new TSPLIBImportDialog()) {
     43        if (dialog.ShowDialog() == DialogResult.OK) {
     44          var instance = Content.LoadData(dialog.TSPFileName, dialog.TourFileName, dialog.Quality);
     45          try {
     46            GenericConsumer.Load(instance);
     47            instancesComboBox.SelectedIndex = -1;
     48          } catch (Exception ex) {
     49            MessageBox.Show(String.Format("This problem does not support loading the instance {0}: {1}", Path.GetFileName(openFileDialog.FileName), Environment.NewLine + ex.Message), "Cannot load instance");
    5450          }
    5551        }
    56       } else {
    57         base.importButton_Click(sender, e);
    5852      }
    5953    }
Note: See TracChangeset for help on using the changeset viewer.