Changeset 4847 for trunk/sources/HeuristicLab.Problems.VehicleRouting.Views/3.3/VehicleRoutingProblemView.cs
- Timestamp:
- 11/19/10 11:12:40 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.VehicleRouting.Views/3.3/VehicleRoutingProblemView.cs
r4722 r4847 27 27 using HeuristicLab.MainForm; 28 28 using HeuristicLab.Parameters; 29 using HeuristicLab.PluginInfrastructure; 29 30 30 31 namespace HeuristicLab.Problems.VehicleRouting.Views { … … 32 33 [Content(typeof(VehicleRoutingProblem), true)] 33 34 public partial class VehicleRoutingProblemView : NamedItemView { 35 private VRPImportDialog vrpImportDialog; 36 34 37 public new VehicleRoutingProblem Content { 35 38 get { return (VehicleRoutingProblem)base.Content; } … … 67 70 parameterCollectionView.Enabled = Content != null; 68 71 vrpSolutionView.Enabled = Content != null; 69 importB estButton.Enabled = importButton.Enabled = importButton2.Enabled = importButton3.Enabled = Content != null && !ReadOnly;72 importButton.Enabled = Content != null && !ReadOnly; 70 73 } 71 74 72 75 private void importButton_Click(object sender, EventArgs e) { 73 OpenFileDialog dialog = new OpenFileDialog(); 74 dialog.Filter = "Solomon files (*.txt)|*.txt"; 76 if (vrpImportDialog == null) vrpImportDialog = new VRPImportDialog(); 75 77 76 if (dialog.ShowDialog() == DialogResult.OK) { 77 Content.ImportFromSolomon(dialog.FileName); 78 if (vrpImportDialog.ShowDialog(this) == DialogResult.OK) { 79 try { 80 switch (vrpImportDialog.Format) { 81 case VRPFormat.TSPLib: 82 Content.ImportFromTSPLib(vrpImportDialog.VRPFileName); 83 break; 84 85 case VRPFormat.Solomon: 86 Content.ImportFromSolomon(vrpImportDialog.VRPFileName); 87 break; 88 89 case VRPFormat.ORLib: 90 Content.ImportFromORLib(vrpImportDialog.VRPFileName); 91 break; 92 } 93 94 if(!string.IsNullOrEmpty(vrpImportDialog.TourFileName)) 95 Content.ImportSolution(vrpImportDialog.TourFileName); 96 } 97 catch (Exception ex) { 98 ErrorHandling.ShowErrorDialog(this, ex); 99 } 78 100 } 79 101 } 80 81 private void importButton2_Click(object sender, EventArgs e) {82 OpenFileDialog dialog = new OpenFileDialog();83 dialog.Filter = "TSPLib files (*.vrp)|*.vrp";84 85 if (dialog.ShowDialog() == DialogResult.OK) {86 Content.ImportFromTSPLib(dialog.FileName);87 }88 }89 90 private void importBestButton_Click(object sender, EventArgs e) {91 OpenFileDialog dialog = new OpenFileDialog();92 dialog.Filter = "VRP solution files (*.opt)|*.opt";93 94 if (dialog.ShowDialog() == DialogResult.OK) {95 Content.ImportSolution(dialog.FileName);96 }97 }98 99 private void importButton3_Click(object sender, EventArgs e) {100 OpenFileDialog dialog = new OpenFileDialog();101 dialog.Filter = "ORLib files (*.txt)|*.txt";102 103 if (dialog.ShowDialog() == DialogResult.OK) {104 Content.ImportFromORLib(dialog.FileName);105 }106 }107 102 108 103 private void CoordinatesParameter_ValueChanged(object sender, EventArgs e) {
Note: See TracChangeset
for help on using the changeset viewer.