Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/05/12 08:34:36 (12 years ago)
Author:
svonolfe
Message:

Merged changes from trunk into branch (#1177)

Location:
branches/VRP/HeuristicLab.Problems.Instances.VehicleRouting.Views/3.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/VRP/HeuristicLab.Problems.Instances.VehicleRouting.Views/3.4

  • branches/VRP/HeuristicLab.Problems.Instances.VehicleRouting.Views/3.4/VRPInstanceProviderView.cs

    r7882 r7958  
    2121
    2222using System;
     23using System.IO;
    2324using System.Windows.Forms;
    2425using HeuristicLab.MainForm;
    2526using HeuristicLab.MainForm.WindowsForms;
    2627using HeuristicLab.Problems.Instances.Views;
    27 using System.IO;
    2828
    2929namespace HeuristicLab.Problems.Instances.VehicleRouting.Views {
    3030  [View("VRP InstanceProvider View")]
    31   [Content(typeof(VRPInstanceProvider<>), IsDefaultView = true)]
    32   public partial class VRPInstanceProviderView<T> : ProblemInstanceProviderViewGeneric<T> where T : class, IVRPData {
     31  [Content(typeof(IProblemInstanceConsumer<IVRPData>), IsDefaultView = true)]
     32  public partial class VRPInstanceProviderView<T> : ProblemInstanceConsumerViewGeneric<T> where T : class, IVRPData {
    3333
    34     public new VRPInstanceProvider<T> Content {
    35       get { return (VRPInstanceProvider<T>)base.Content; }
     34    public new IProblemInstanceConsumer<T> Content {
     35      get { return (IProblemInstanceConsumer<T>)base.Content; }
    3636      set { base.Content = value; }
    3737    }
     
    4242
    4343    protected override void importButton_Click(object sender, EventArgs e) {
    44       using (var dialog = new VRPImportDialog(Content.Name)) {
    45         if (dialog.ShowDialog() == DialogResult.OK) {
    46           var instance = Content.LoadData(dialog.VRPFileName, dialog.TourFileName);
    47           try {
    48             GenericConsumer.Load(instance as T);
    49           }
    50           catch (Exception ex) {
    51             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");
     44      IVRPInstanceProvider provider = SelectedProvider as IVRPInstanceProvider;
     45      if (provider != null) {
     46        using (var dialog = new VRPImportDialog(SelectedProvider.Name)) {
     47          if (dialog.ShowDialog() == DialogResult.OK) {
     48            var instance = provider.LoadData(dialog.VRPFileName, dialog.TourFileName);
     49            try {
     50              GenericConsumer.Load(instance as T);
     51            }
     52            catch (Exception ex) {
     53              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");
     54            }
    5255          }
    5356        }
Note: See TracChangeset for help on using the changeset viewer.