Changeset 7958 for branches/VRP/HeuristicLab.Problems.Instances.VehicleRouting.Views/3.4/VRPInstanceProviderView.cs
- Timestamp:
- 06/05/12 08:34:36 (12 years ago)
- 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
-
Property
svn:mergeinfo
set to
/trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting.Views/3.4 merged eligible
-
Property
svn:mergeinfo
set to
-
branches/VRP/HeuristicLab.Problems.Instances.VehicleRouting.Views/3.4/VRPInstanceProviderView.cs
r7882 r7958 21 21 22 22 using System; 23 using System.IO; 23 24 using System.Windows.Forms; 24 25 using HeuristicLab.MainForm; 25 26 using HeuristicLab.MainForm.WindowsForms; 26 27 using HeuristicLab.Problems.Instances.Views; 27 using System.IO;28 28 29 29 namespace HeuristicLab.Problems.Instances.VehicleRouting.Views { 30 30 [View("VRP InstanceProvider View")] 31 [Content(typeof( VRPInstanceProvider<>), IsDefaultView = true)]32 public partial class VRPInstanceProviderView<T> : ProblemInstance ProviderViewGeneric<T> where T : class, IVRPData{31 [Content(typeof(IProblemInstanceConsumer<IVRPData>), IsDefaultView = true)] 32 public partial class VRPInstanceProviderView<T> : ProblemInstanceConsumerViewGeneric<T> where T : class, IVRPData { 33 33 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; } 36 36 set { base.Content = value; } 37 37 } … … 42 42 43 43 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 } 52 55 } 53 56 }
Note: See TracChangeset
for help on using the changeset viewer.