Free cookie consent management tool by TermsFeed Policy Generator

Changeset 11420


Ignore:
Timestamp:
10/06/14 16:20:02 (10 years ago)
Author:
pfleck
Message:

#2229

  • Changed the Content type of VRPInstanceProviderView. In the previous version the VRPInstanceProviderView is not used correctly as default View for VRPInstances and therefore the VRPImportDialog is not shown.
  • Made IVRPInstanceProvider generic for consistency and to avoid unnecessary casts.
Location:
trunk/sources
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting.Views/3.4/VRPInstanceProviderView.cs

    r11287 r11420  
    2929namespace HeuristicLab.Problems.Instances.VehicleRouting.Views {
    3030  [View("VRP InstanceProvider View")]
    31   [Content(typeof(IProblemInstanceProvider<IVRPData>), IsDefaultView = true)]
     31  [Content(typeof(IVRPInstanceProvider<>), IsDefaultView = true)]
    3232  public partial class VRPInstanceProviderView<T> : ProblemInstanceProviderView<T> where T : class, IVRPData {
    3333
     
    3737
    3838    protected override void importButton_Click(object sender, EventArgs e) {
    39       var provider = Content as IVRPInstanceProvider;
     39      var provider = Content as IVRPInstanceProvider<T>;
    4040      if (provider != null) {
    4141        using (var dialog = new VRPImportDialog(Content.Name)) {
     
    5454
    5555    protected override void exportButton_Click(object sender, EventArgs e) {
    56       var provider = Content as IVRPInstanceProvider;
     56      var provider = Content as IVRPInstanceProvider<T>;
    5757      if (provider != null) {
    5858        if (saveFileDialog.ShowDialog(this) == DialogResult.OK) {
  • trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/IVRPInstanceProvider.cs

    r11287 r11420  
    2121
    2222namespace HeuristicLab.Problems.Instances.VehicleRouting {
    23   public interface IVRPInstanceProvider {
     23  public interface IVRPInstanceProvider<T> {
    2424    bool CanImportData { get; }
    25     IVRPData Import(string vrpFile, string tourFile);
     25    T Import(string vrpFile, string tourFile);
    2626
    2727    bool CanExportData { get; }
    28     void Export(IVRPData instance, string path);
     28    void Export(T instance, string path);
    2929  }
    3030}
  • trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/VRPInstanceProvider.cs

    r11295 r11420  
    2929
    3030namespace HeuristicLab.Problems.Instances.VehicleRouting {
    31   public abstract class VRPInstanceProvider<T> : ProblemInstanceProvider<T>, IVRPInstanceProvider where T : IVRPData {
     31  public abstract class VRPInstanceProvider<T> : ProblemInstanceProvider<T>, IVRPInstanceProvider<T> where T : IVRPData {
    3232    protected abstract string FileName { get; }
    3333
     
    114114    protected abstract T LoadData(Stream stream);
    115115
    116     public IVRPData Import(string vrpFile, string tourFile) {
     116    public T Import(string vrpFile, string tourFile) {
    117117      var data = ImportData(vrpFile);
    118118      if (!String.IsNullOrEmpty(tourFile)) {
     
    122122    }
    123123
    124     public void Export(IVRPData instance, string path) {
    125       ExportData((T)instance, path);
     124    public void Export(T instance, string path) {
     125      ExportData(instance, path);
    126126    }
    127127
Note: See TracChangeset for help on using the changeset viewer.